slacksoft
asked on
Very basic XML/DTD CDATA question
I don't want the text in the testchild node to be parsed.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE test [
<!ELEMENT test (testchild)>
<!ELEMENT testchild (#CDATA)>
]>
<test>
<testchild>test once more.</testchild>
</test>
This throws an error when I try to view the file in IE 6.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
-------------------------- ---------- ---------- ---------- ---------- ---------- ----
Content model is invalid. Error processing resource 'file:///C:/Documents and Settings/e58012/My Documents/test.xml'. Line 4, Position 24
<!ELEMENT testchild (#CDATA)>
According to this site, though, CDATA is legal for a DTD element type. http://www.thescarms.com/XML/DTDTutorial.asp
Here's their example:
<?xml version="1.0"?>
<!DOCTYPE message [
<!ELEMENT message (to,from,subject,text)>
<!ELEMENT to (#CDATA)>
<!ELEMENT from (#CDATA)>
<!ELEMENT subject (#CDATA)>
<!ELEMENT text (#CDATA)>
]>
<message>
<to>Dave</to>
<from>Susan</from>
<subject>Reminder</subject >
<text>Don't forget to buy milk on the way home.</text>
</message>
Am I missing something?
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE test [
<!ELEMENT test (testchild)>
<!ELEMENT testchild (#CDATA)>
]>
<test>
<testchild>test once more.</testchild>
</test>
This throws an error when I try to view the file in IE 6.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------
Content model is invalid. Error processing resource 'file:///C:/Documents and Settings/e58012/My Documents/test.xml'. Line 4, Position 24
<!ELEMENT testchild (#CDATA)>
According to this site, though, CDATA is legal for a DTD element type. http://www.thescarms.com/XML/DTDTutorial.asp
Here's their example:
<?xml version="1.0"?>
<!DOCTYPE message [
<!ELEMENT message (to,from,subject,text)>
<!ELEMENT to (#CDATA)>
<!ELEMENT from (#CDATA)>
<!ELEMENT subject (#CDATA)>
<!ELEMENT text (#CDATA)>
]>
<message>
<to>Dave</to>
<from>Susan</from>
<subject>Reminder</subject
<text>Don't forget to buy milk on the way home.</text>
</message>
Am I missing something?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks anyway.