Given below are my note.xml and Note.dtd files. I am validating a XML file with external DTD using XMLStarlet from Cygwin. When I give the command
xml val --dtd Note.dtd note.xml
I get
cannot parse DTD file
Can someone help me to rectify this?
note.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE note SYSTEM "Note.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
Note.dtd
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
Change
<!ELEMENT (#PCDATA)>
to
<!ELEMENT to (#PCDATA)>
and your XML will be valid against your DTD
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.