You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Ng, Clarence" <cl...@amazon.com> on 2008/12/11 22:35:30 UTC

Implementation difference of DOMParser and DocumentBuilderFactoryImpl in XercesJ

Hi.

We have been using the documentbuilderfactory interface, which defaults to java's implementation of dom parser (com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactory). We are planning to upgrade it to xerces-j 2.8.1. However we found the interfaceImpl (org.apache.xerces.jaxp.DocumentBuilderFactory) insufficient for our needs, and would want to use Xerces' other implementation of the dom parser (org.apache.xerces.parsers.DOMParser).
Problem is, we have a large amount of existing xml files stored and it is critical the parser behavior stays relatively constant through the upgrade, ie what validates should stay the same , as well as for those that didn't.
Question is, is there a different between the implementation of DOMParser vs DocumentBuilderFactory we should be aware of that might lead to difference in terms of xml validation?

Thanks.
Clarence Ng

Thanks,
Clarence Ng
SDE : Content Management
Website Application Platform


Re: Implementation difference of DOMParser and DocumentBuilderFactoryImpl in XercesJ

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Clarence,

They are part of the same implementation. DocumentBuilderFactory creates
DocumentBuilders and the DocumentBuilder implementation in Xerces wraps a
DOMParser. Not sure what more you're expecting to get from DOMParser.
Arguably the DocumentBuilder has more capability (e.g.
setSchema(javax.xml.validation.Schema)) and you should generally be
obtaining it through the JAXP API, not by hardcoding to the implementation.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Ng, Clarence" <cl...@amazon.com> wrote on 12/11/2008 04:35:30 PM:

> Hi.
>
> We have been using the documentbuilderfactory interface, which
> defaults to java's implementation of dom parser (com.sun.org.apache.
> xerces.internal.jaxp.DocumentBuilderFactory). We are planning to
> upgrade it to xerces-j 2.8.1. However we found the interfaceImpl
> (org.apache.xerces.jaxp.DocumentBuilderFactory) insufficient for our
> needs, and would want to use Xerces' other implementation of the dom
> parser (org.apache.xerces.parsers.DOMParser).
> Problem is, we have a large amount of existing xml files stored and
> it is critical the parser behavior stays relatively constant through
> the upgrade, ie what validates should stay the same , as well as for
> those that didn?t.
> Question is, is there a different between the implementation of
> DOMParser vs DocumentBuilderFactory we should be aware of that might
> lead to difference in terms of xml validation?
>
> Thanks.
> Clarence Ng
>
> Thanks,
> Clarence Ng
> SDE : Content Management
> Website Application Platform