Reputation: 159
It's possible to load and parse DTD schema via javascript or jQuery ? I know that jQuery is able to load XML file which has cross-browser support => and then manipulate with it via DOM Tree
But it's possible (some way) to do with DTD file too?
Thank you.
Upvotes: 4
Views: 1373
Reputation:
Yes, it looks like it's possible. Check the XML Validator at w3schools.com.
The function ValidateXML in the head of the page source will do what you want.
The input for the function is the XML file with a linked or embedded DTD, like this:
<?xml version="1.0" ?>
<!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>
<message>Don't forget me this weekend!</message>
</note>
Please note however, that w3schools.com has the following text on their "About Copyright" page, so you probably need to use the function to write your own variant.
Pages, code or other content from W3Schools may not be redistributed or reproduced in any way, shape, or form without the written permission of Refsnes Data.
Upvotes: 1