Valid xml DTD PCDATA does not work
Hi to all,
I added a doctype - however the #PCDATA type of element SUMMARY does not work. (fyi: it works if I remove the '&' - but that is the whole point)
What am I doing wrong?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog [
<!ELEMENT catalog (car)>
<!ELEMENT car (marc,model,summary)>
<!ELEMENT marc (#PCDATA)>
<!ELEMENT model (#PCDATA)>
<!ELEMENT summary (#PCDATA)>
<summary> sample </summary>
<summary> this is a sample summary for no & </summary>
I know this post is a month after, and maybe you already got your answer:
Okay, you have a standalone XML document.
And the contained text in the summary element has an '&' character.
Since '&' is understood in the XML doctype to indicate an entity reference, if you want the '&' character, you must use its character entity reference: '&' (without the quotes) to make it a valid XML document.
The same for the '<' and '>' characters: '<' and '>' respectively. Else the parser stops.
Last edited by seniseven; 09-20-2012 at 10:22 AM.
Reason: preface added
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread