[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Fall back to network DTD if local one not found
Hello All, I have an XML document with the following DOCTYPE: <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> 'xmllint --valid --noout book2.xml' takes a while, and it does not care that I renamed the directory where the local DTD is kept, and adding --nonet causes it to fail to load the external entity http://.../docbookx.dtd, so I know it is fetching the network DTD. I copied the catalog.xml that is included in http://www.oasis-open.org/docbook/xml/4.5/docbook-xml-4.5.zip to my project directory. I edited it as follows, according to the example at Bob Stayton's tutorial (XML catalog to locate the DTD) at (http://www.sagehill.net/docbookxsl/ToolsSetup.html#FindDTD) <public publicId="-//OASIS//DTD DocBook XML V4.5//EN" uri="c:/msys/share/xml/docbook/4.5/docbookx.dtd"/> <group id="DocbookDTD" prefer="public"> <!-- path to local DTD --> <system systemId="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" uri="c:/msys/share/xml/docbook/4.5/docbookx.dtd"/> <!-- path to local DTD --> <system systemId="http://docbook.org/xml/4.5/docbookx.dtd" uri="docbookx.dtd"/> </group> I can then 'set SGML_CATALOG_FILES=catalog.xml' 'xmllint --catalogs --valid --noout book2.xml' executes quickly, and still succeeds when --nonet is added, so I know that 'http://www.oasis-open.org/.../docbookx.dtd' is being mapped to 'c:/msys/share/.../docbookx.dtd'. However, if I rename the local folder, the same command line above fails: C:\msys\tmp\book>xmllint --catalogs --valid --noout book2.xml book2.xml:3: warning: failed to load external entity "http://www.oasis-open.org/ docbook/xml/4.5/docbookx.dtd" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> ^ book2.xml:5: validity error : Validation failed: no DTD found ! <book lang="en"> Clearly, it is not trying to access the network DTD. My connection is working, otherwise I couldn't post this message. How can I get it to try the local DTD first, and then the network DTD if it fails?