Jump to content

Recommended Posts

Im just learning XML. I typed the following into a xml file but when I go to test it in FF it gives me the followong error although there are no errors in the xml code. Can anyone help?. The XML file still wont open in FF.Im sorry the code I was going to display: <?xml version="1.0" encoding="utf-8"?><!DOCTYPE note [<!ELEMENT note (to,from,heading,body)><!ELEMENT to (#PCDATA)><!ELEMENT from (#PCDATA)><!ELEMENT heading (#PCDATA)><!ELEMENT body (#PCDATA)>]><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note> Error message:XML Parsing Error: XML or text declaration not at start of entityLocation: file:///C:/xml/TMP34fh9bl3c4.xmlLine Number 1, Column 9:<body ><?xml version="1.0" encoding="utf-8"?>--------^ Im sorry but there is no body tag even if the error message says there is. <?xml version="1.0" encoding="utf-8"?><!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>

Edited by adriantreanor
  • Like 1
Link to post
Share on other sites

You have an unneeded square bracket. at the end of that line.And before the error shows up, you need another ]> after that <!ELEMENT> entity to close the <!DOCTYPE> that's at the beginning of the document.

Link to post
Share on other sites

The XML file still wont open in FF.Im sorry the code I was going to display: <?xml version="1.0" encoding="utf-8"?><!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)>]><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note> Error message:XML Parsing Error: XML or text declaration not at start of entityLocation: file:///C:/xml/TMP34fh9bl3c4.xmlLine Number 1, Column 9:<body ><?xml version="1.0" encoding="utf-8"?>--------^

Link to post
Share on other sites

Im sorry but there is no body tag even if the error message says there is. < ?xml version="1.0" encoding="utf-8"?>< !DOCTYPE note [<!ELEMENT note (to,from,heading,body)><!ELEMENT to (#PCDATA)><!ELEMENT from (#PCDATA)><!ELEMENT heading (#PCDATA)><!ELEMENT body (#PCDATA)>]>< note>< to>Tove</to>< from>Jani</from>< heading>Reminder</heading>< body>Don't forget me this weekend!</body>< /note> XML Parsing Error: XML or text declaration not at start of entityLocation: file:///C:/xml/TMP4yhnhbl5pq.xmlLine Number 1, Column 9:<body ><?xml version="1.0" encoding="utf-8"?>--------^Can you help?.

Edited by adriantreanor
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...