Search code examples
xmljsffacelets

The character reference must end with the ';' delimiter


I have an JSF 2.2 Page like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html [
    <!ENTITY times "&#00D7;"> 
]>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:jsf="http://xmlns.jcp.org/jsf" xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<head>

but get an excpetion

javax.faces.view.facelets.FaceletException: Error Parsing /index.xhtml: Error Traced[line: 3] Zeichenreferenz muss mit dem Begrenzungszeichen ";" enden.
    com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:444)
    com.sun.faces.facelets.compiler.SAXCompiler.doMetadataCompile(SAXCompiler.java:427)

The file is saved in UTF-8

whats wrong with my syntax?


Solution

  • You specified a hexadecimal value using the decimal notation. The XML parser got confused when it encountered the D while expecting a ;.

    Hexadecimal entity notation needs a x prefix.

    <!DOCTYPE html [
        <!ENTITY times "&#xD7;">
    ]>
    

    Otherwise, use the decimal notation.

    <!DOCTYPE html [
        <!ENTITY times "&#215;">
    ]>
    

    See also: