質問

I am a newbie when it comes to XML and DTD values, so forgive me if this is a simple question or if I am going about this in the wrong way. Can you specify a DTD value in the same way you can specify a path to a property in XML?

For instance, if you have the XML file below:

<!DOCTYPE ... SYSTEM "<path_to_file>">
<BOOK>
    <AUTHOR>
        <FIRST>John</FIRST>
        <LAST>Quncy</LAST>
    </AUTHOR>
    <NAME>blah</NAME>
    <DATE>12/23/13</DATE>
</BOOK>

You could specify the first name of the author by the path:

/BOOK/AUTHOR/FIRST

Is there any syntax to specify a DTD entity like the DOCTYPE in the same way?

Ultimately what I would like to do is use an in house XML parser already written in java to find a DTD entry that I specify and delete it from the XML file. For instance, with the above XML, I would like to specify DOCTYPE and have it removed from the XML. There is already code in place that, given a path, will delete that section from the XML file. I would like to leverage that to also delete DTD entries as well, but I have no idea how to reference it.

役に立ちましたか?

解決

No. DOCTYPE is a parsing and validation directive. That is: DOCTYPE and DTD affect parsing and validation but are not a part of the document as separate entities after that. The XML data model does not containDOCTYPE or DTD definitions and they practically don't exist after the document has been parsed.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top