Hi Neeraj,

If you're asking questions about what ships in Sun's JDK, I have no idea
and it's not relevant here. This is an Apache mailing list after all.

In Apache Xerces, XIncludeHandler is never created unless XInclude support
has been enabled, for example by calling
DocumentBuilderFactory.setXIncludeAware(true). Even when it is added to the
configuration reset() is fairly inexpensive after the first time (assuming
you don't modify the parser's config between parses). It will return before
it ever gets to the point where it would copy feature values.

Thanks.

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

niraj19july <[EMAIL PROTECTED]> wrote on 07/02/2008 07:26:58 AM:

> Hi Michael,
> Thanks for your quick response.
>
> XinlcudeHandler is being reset even though DocumentBuilderFactory is not
> XIncludeAware. After looking at the JDK parser code, it seems that
component
> XInclude is added for xml 1.0 documents and not for xml 1.1 documents.
>
> However, In xerces 2.9.1 implementation, XIncludeHandler is added as a
> common component.
>
> Any idea, what features are checked by XIncludeHandler which can lead to
> XMLConfigurationException (especially when none of the features were
added
> by the application code in DocumentBuilderFactory)?
> Can i somehow disable those features so that reset() of XIncludeHandler
> doesn't result in feature check failure?
>
> Can something me missing in the application code which results in the
> failure of feature check of XIncludeHandler?
>
> Please help.
>
> Thanks,
> Neeraj
>
>
>
> Michael Glavassevich wrote:
> >
> >
> > Hi Neeraj,
> >
> > What ships in Java 5 isn't exactly Xerces. It's Sun's four year old
fork
> > off the Apache codebase. It has bugs (and performance issues) which are
> > unique to it and others which have long been fixed in Apache. We have
no
> > influence over what code ships in the JDK or know specifically what
they
> > changed. If you're looking for improvements to jdk1.5.0_06 you'll need
to
> > approach Sun in one of their forums.
> >
> > I doubt you'll find that any of these are hot-spots in the current
version
> > of Apache Xerces (2.9.1).
> >
> > Thanks.
> >
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: [EMAIL PROTECTED]
> > E-mail: [EMAIL PROTECTED]
> >
> > niraj19july <[EMAIL PROTECTED]> wrote on 06/16/2008 10:07:52 AM:
> >
> >> Hi,
> >>
> >> I am using the apache xerces DOM distribution embedded in jdk1.5.0_06.
I
> >> have configured the DOM Parser to be in the non-validation mode and to
be
> >> not namespace aware. No other 'features' have been enabled as well.
While
> >> profiling the code I am seeing some hotspots in the HPROF dump. My
> > profiling
> >> included millions of small xml documents.
> >>
> >> Here are my questions on the same (see the actual stack further
below):
> >>
> >> STACK 1
> >> It is probably checking for EOF and hence resulting in EOFException.
Why
> > to
> >> throw Exception? It is wasting CPU cycles.
> >>
> >> STACK 2 and STACK 3 are identical except that STACK 3 is throwing
> >> XNIException. Why is checkFeature() getting called ?
> >>
> >> After looking at the parser code it looks like XIncludeHandler is
added
> > as
> >> XMLcomponent (for xml 1.0 documents ) and reset() flow of
XIncludeHandler
> >> results in checkFeature(). Is there any way to prevent such checks and
> > save
> >> CPU cycles? What features parser is trying to check?
> >>
> >> Further, my application is not able to catch XNIException even though
it
> > is
> >> been wrapped in SAXException in the parser code? So it looks that this
is
> >> not a fatal error.
> >>
> >> I think if xml version of the documents is 1.1 then XIncludeHandler's
> >> reset() method will not be invoked in the resetXML11() method . But
this
> > is
> >> not a solution for me as I am dealing with xml 1.0 documents.
> >>
> >> Please help.
> >>
> >> Thanks,
> >> Neeraj.
> >>
> >> Complete stack traces follow:
> >>
> >> STACK-1
> >>
> >> TRACE 305135:
> >> java.lang.Throwable.fillInStackTrace(Throwable.java:Unknown line)
> >> java.lang.Throwable.<init>(Throwable.java:181)
> >> java.lang.Exception.<init>(Exception.java:29)
> >> java.io.IOException.<init>(IOException.java:28)
> >> java.io.EOFException.<init>(EOFException.java:32)
> >> com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.
> >> load(XMLEntityScanner.java:1760)
> >> com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.
> >> skipSpaces(XMLEntityScanner.java:1259)
> >> com.sun.org.apache.xerces.internal.impl.
> >> XMLDocumentScannerImpl$TrailingMiscDispatcher.
> >> dispatch(XMLDocumentScannerImpl.java:1247)
> >> com.sun.org.apache.xerces.internal.impl.
> >> XMLDocumentFragmentScannerImpl.
> >> scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> parse(XML11Configuration.java:834)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> parse(XML11Configuration.java:764)
> >>
> > com.sun.org.apache.xerces.internal.parsers.XMLParser.
> parse(XMLParser.java:148)
> >
> >>
> > com.sun.org.apache.xerces.internal.parsers.DOMParser.
> parse(DOMParser.java:250)
> >
> >> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.
> >> parse(DocumentBuilderImpl.java:292)
> >> oracle.ocs.protocols.xmpp.library.ParserInitializer.
> >> getXMLDocument(ParserInitializer.java:268)
> >> STACK 2
> >>
> >> TRACE 305871:
> >> com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings.
> >> checkFeature(ParserConfigurationSettings.java:300)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> checkFeature(XML11Configuration.java:1313)
> >> com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings.
> >> getFeature(ParserConfigurationSettings.java:245)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> getFeature(XML11Configuration.java:873)
> >> com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.
> >> copyFeatures1(XIncludeHandler.java:2093)
> >> com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.
> >> copyFeatures(XIncludeHandler.java:2068)
> >> com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.
> >> reset(XIncludeHandler.java:446)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> reset(XML11Configuration.java:973)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> parse(XML11Configuration.java:805)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> parse(XML11Configuration.java:764)
> >>
> > com.sun.org.apache.xerces.internal.parsers.XMLParser.
> parse(XMLParser.java:148)
> >
> >>
> > com.sun.org.apache.xerces.internal.parsers.DOMParser.
> parse(DOMParser.java:250)
> >
> >> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.
> >> parse(DocumentBuilderImpl.java:292)
> >> oracle.ocs.protocols.xmpp.library.ParserInitializer.
> >> getXMLDocument(ParserInitializer.java:268)
> >>
> >> _
> >> TRACE 306139:
> >> java.lang.Throwable.fillInStackTrace(Throwable.java:Unknown line)
> >> java.lang.Throwable.<init>(Throwable.java:196)
> >> java.lang.Exception.<init>(Exception.java:41)
> >> java.lang.RuntimeException.<init>(RuntimeException.java:43)
> >> com.sun.org.apache.xerces.internal.xni.XNIException.
> >> <init>(XNIException.java:94)
> >> com.sun.org.apache.xerces.internal.xni.parser.
> >> XMLConfigurationException.<init>(XMLConfigurationException.java:109)
> >> com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings.
> >> checkFeature(ParserConfigurationSettings.java:300)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> checkFeature(XML11Configuration.java:1313)
> >> com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings.
> >> getFeature(ParserConfigurationSettings.java:245)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> getFeature(XML11Configuration.java:873)
> >> com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.
> >> copyFeatures1(XIncludeHandler.java:2093)
> >> com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.
> >> copyFeatures(XIncludeHandler.java:2070)
> >> com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.
> >> reset(XIncludeHandler.java:446)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> reset(XML11Configuration.java:973)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> parse(XML11Configuration.java:805)
> >> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> >> parse(XML11Configuration.java:764)
> >>
> > com.sun.org.apache.xerces.internal.parsers.XMLParser.
> parse(XMLParser.java:148)
> >
> >>
> > com.sun.org.apache.xerces.internal.parsers.DOMParser.
> parse(DOMParser.java:250)
> >
> >> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.
> >> parse(DocumentBuilderImpl.java:292)
> >> oracle.ocs.protocols.xmpp.library.ParserInitializer.
> >> getXMLDocument(ParserInitializer.java:268)
> >> --
> >> View this message in context: http://www.nabble.com/JDK-XERCES-DOM-
> >> PARSER-WASTES-CPU-ON-NON-PARSING-TASKS-tp17865215p17865215.html
> >> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> --
> View this message in context: http://www.nabble.com/JDK-XERCES-DOM-
> PARSER-WASTES-CPU-ON-NON-PARSING-TASKS-tp17865215p18235392.html
> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to