2017-12-24 6 views
2

Hier ist meine DTD-Datei.Validierungsfehler beim Deklarieren des Attributtyps als Entität in XML

?xml version="1.0" encoding="UTF-8"?> 
<!-- edited with XML Spy v3.0.7 NT (http://www.xmlspy.com) by Manukyan (YSU) --> 
<!ENTITY xxx "ccc"> 
<!ENTITY yyy "ddd"> 
<!ELEMENT book (author+, title, publisher)> 
<!ELEMENT author (#PCDATA)> 
<!ELEMENT title (#PCDATA)> 
<!ELEMENT publisher (#PCDATA)> 
<!ATTLIST title 
    aaa ENTITY #IMPLIED 
> 

Und hier ist die entsprechende DSD-Datei.

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE book SYSTEM "C:\Users\PC\Desktop\XML\XMLDB\XML\BOOK.DTD"> 
<book> 
    <author>asd</author> 
    <title aaa="xxx"/> 
    <publisher/> 
</book> 

Und ich habe einen Validierungsfehler, der das sagt. Der Wert 'xxx' des Attributs 'aaa' muss der Name der nicht analysierten Entität sein.

+0

https://stackoverflow.com/ questions/22411695/try-validate-xml-to-dtd-Fehler-Spruch-Entity-is-not-unparsed –

Antwort

2

Als @ Daniel Haley explains in his answer auf eine ähnliche Frage, ob Sie die Entity-Deklaration und die Notation (NDATA) Erklärung für ccc hinzufügen, die XML jetzt gültig ist:

<!DOCTYPE book [ 

<!NOTATION ccc SYSTEM "ccc"> 
<!ENTITY xxx SYSTEM "ccc" NDATA ccc> 

<!ENTITY yyy "ddd"> 
<!ELEMENT book (author+, title, publisher)> 
<!ELEMENT author (#PCDATA)> 
<!ELEMENT title (#PCDATA)> 
<!ELEMENT publisher (#PCDATA)> 
<!ATTLIST title aaa ENTITY #IMPLIED> 
]> 
<book> 
    <author>asd</author> 
    <title aaa="xxx"/> 
    <publisher/> 
</book> 
Verwandte Themen