I have the following problem: I have an XML document with a number of namespaces - here is the opening tag:
<?xml version="1.0" encoding="UTF-8"?>
<REQ-IF
xmlns="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd"
xmlns:doors="http://www.ibm.com/rdm/doors/REQIF/xmlns/1.0"
xmlns:reqif="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd"
xmlns:reqif-common="http://www.prostep.org/reqif"
xmlns:reqif-xhtml="http://www.w3.org/1999/xhtml"
xmlns:rm="http://www.ibm.com/rm"
xmlns:rm-reqif="http://www.ibm.com/rm/reqif"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
As you can see, there are number of namespaces. I use Xerces as the parser. The problem is that the parser attempts to visit the URIs from the namespaces that it does not know about. This is bad, because it slows the parsing down. For instance, "http://www.prostep.org/reqif" resolves to a web page. The content is parsed just fine (of course, as the Namespace URI is just a name), it just takes a long time, because the Parser hangs for a long time when retrieving the URI.
So, two questions:
- Why would Xerces attempt to treat the namespace URI like URI with "real" content?
- How can I disable this?
For the record, The URI is neither the location for Schema or DTD. I still tried to disable loading external DTDs, which, of course, didn't do anything:
parser.setProperty("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
Any thoughts?