Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2012
    Location
    Bokaro Steel City, India
    Posts
    21
    Thanks
    14
    Thanked 1 Time in 1 Post

    Exclamation Referencing external entity!

    Hello friends,
    I am trying to reference entity from an external dtd.
    But the XML code is not being parsed due to error.

    "I am really stuck and I don't know what to do."

    XML file (note.xml):
    Code:
    <?xml version="1.0" standalone="no"?>
    <!DOCTYPE message SYSTEM "note.dtd">
    <message>
        <to>Love</to>
        <from>&author; Lover</from>
        <body>I love you very much! &lt;3</body>
    </message>
    DTD file (note.dtd):
    Code:
    <!ELEMENT message (to, from, body)>
    <!ELEMENT to (#PCDATA)>
    <!ELEMENT from (#PCDATA)>
    <!ELEMENT body (#PCDATA)>
    <!ENTITY author "Anonymous">
    Thank you!
    "It will never rain roses: when we want to have more roses, we must plant more roses."
    - George Eliot

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,690
    Thanks
    25
    Thanked 656 Times in 655 Posts
    The & sign in front of author; should be &amp;

    You can display this xml in a browser then, but if you want to parse it you might want to remove the <!DOCTYPE message SYSTEM "note.dtd">.


  •  

    Posting Permissions

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