3

Possible Duplicate:
InDesign CS5 Script: How can I ignore the DTD when importing XML?


Here is a basic XML file with a DTD file declaration:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article SYSTEM "blahblah.dtd">
<root-node></root-node>


I found this XSL solution at http://www.stylusstudio.com/xsllist/200104/post90620.html, which is not working:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

( ...tested at http://www.w3schools.com/XSL/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog_ex2 )



So, is there any other way to ignore the !DOCTYPE declaration, or otherwise ignore the DTD file?

4

1 回答 1

0

我会使用正则表达式来解析 xml 并删除 Doctype 声明。

于 2012-07-31T21:34:53.360 回答