As you have probably seen, I created XERCESJ-1204 for this issue.

Maybe you can take the opportunity to create something like a XMLEntityResolver2, which also has an getExternalSubset method.
In fact EntityResolver2Wrapper has it all.

This way it also would become possible to use the XMLEntityResolver when validating against an external (user assigned) DTD if there is nothing declared in the xml instance. In the getExternalSubset we could then return the external DTD. Now when using XMLEntityResolver in the saxParser there is no other way than actually insert the doctype in the source, because the properties "http://apache.org/xml/properties/schema/external- schemaLocation" or "http://apache.org/xml/properties/schema/external- noNamespaceSchemaLocation" do not have affect when validating against a DTD. In the DomConfiguration this is no problem because DOMConfiguration.setParameter("schema-location", schema) works for both XMLSchema and DTD.




Op 16-okt-2006, om 19:22 heeft Michael Glavassevich het volgende geschreven:

I was going to suggest that you set the "
http://apache.org/xml/properties/internal/entity-resolver"; property on the DOMConfiguration but just noticed that isn't possible. It will throw an
exception without first attempting to set the property on the internal
XMLParserConfiguration. Could you please open a JIRA issue?

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

Dick Deneer <[EMAIL PROTECTED]> wrote on 10/14/2006
07:26:38 AM:

Hi,

I am using the DOM level 3 api to create a DOM using :

        DOMImplementationRegistry registry =
                DOMImplementationRegistry.newInstance();
        DOMImplementationLS domImpl = (DOMImplementationLS)
                registry.getDOMImplementation("LS 3.0");

        LSParser parser = domImpl
                .createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS,
                                XMLConstants.W3C_XML_SCHEMA_NS_URI);

      org.w3c.dom.DOMConfiguration config = parser.getDomConfig();
      config.setParameter("resource-resolver", resolver);  //where
resolver is an LSResolver

        Document doc = parser.parseURI(sourceURI);

Afterwards I am using the DOM Validation api to validate the DOM
when it is modified.

The LSResolver  has the resolveResoure method:

public LSInput resolveResource(String type, String namespaceURI,
String publicId, String systemId, String baseURI)

My problem is that I need much more information about the resource
than what is passed to this method.
For instance I can not distinguish a DTD grammar from an
XMLEntityDescription because from the "type" parameter passed.
From the debugger I saw that one level higher in the stack the
DOMEntityResolverWrapper has all the information I need in
the XMLResourceIdentifier interface object.
Is there anyway to get acces to this.

By the way, at the "sax-side" of my program I do not have this
issue, by using the   XMLEntityResolver() with has this method:
public XMLInputSource resolveEntity(XMLResourceIdentifier
arg0) throws XNIException, IOException)

Dick Deneer

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to