Results 1 to 2 of 2

Thread: Valid xml DTD PCDATA does not work

  1. #1
    Join Date
    Jun 2012

    Valid xml DTD PCDATA does not work

    Hi to all,
    I have the following XML parsed with javascript.
    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 code:

    <?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)> 
    	 <motor>sample </motor>  
    	<summary> sample </summary> 	     
        <summary> this is a sample summary for no & </summary>       

  2. #2
    Join Date
    Jul 2010
    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: '&amp;' (without the quotes) to make it a valid XML document.

    The same for the '<' and '>' characters: '&lt;' and '&gt;' respectively. Else the parser stops.
    Last edited by seniseven; 09-20-2012 at 10:22 AM. Reason: preface added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center