Michael Glavassevich | 7 Apr 2011 17:58
Picon

Re: Xerces builds - Why don't they include line number attributes?

Aaron,

You picked the wrong mailing list. c-users <at> is for Xerces-C. I'm sure you meant to post this to the Java users list.

Also, please see previous discussion on this topic in the archives [1].

Thanks.

[1] http://markmail.org/thread/qkbaup5dzjrx5ffj

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

"Pieper, Aaron" <PieperA <at> Pragmatics.com> wrote on 04/07/2011 11:40:16 AM:

> Hello,
>
>  
>
> Is it possible that when building Xerces builds for Java in the future,
> you could turn the line number attributes on? It makes it easier for
> developers to set breakpoints and trace through code. Currently, any
> Java stack traces involving xerces look something like this (with line
> number information not available):
>
>  
>
>  
> org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLInputSource[])
> line: not available        
>
>  
> org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Source[])
> line: not available              
>
>  
> org.springframework.xml.validation.SchemaLoaderUtils.loadSchema(Resource
> [], String) line: 73              
>
>  
> org.springframework.xml.validation.Jaxp13ValidatorFactory.createValidato
> r(Resource[], String) line: 40              
>
>  
>
> You can see that the SpringFramework JARs include line numbers, making
> their code easier to trace; the Xerces JARs do not, which means we can
> only see the class/method names. The last time I built Xerces, I
> remember this behavior was already integrated into the Xerces build, but
> was disabled by default. Not sure if this is by design or simply an
> oversight. Maybe it should be enabled by default, or maybe whatever
> process or person builds these final releases could be updated/educated
> to include this flag?
>
>  
>
> Thanks,
>
>  
>
> - Aaron

Pieper, Aaron | 7 Apr 2011 18:27

Re: Xerces builds - Why don't they include line number attributes?

I was trying to figure out why certain XML validation operations had gotten slower, so I was digging into Xerces’ source when I noticed it didn’t have line number attributes. I was directed to the previous discussion at http://markmail.org/thread/qkbaup5dzjrx5ffj which indicates that the decision was made to omit these attributes, in order to reduce jar file size. This makes sense, although it’s curious that no other apache projects (such as such as Spring or CXF ) have taken a similar direction, despite having much larger JAR files.

 

I don’t mind checking out and build the debug versions of the Xerces libraries myself, and indeed I’ve already done so. But maybe for future releases, it would make sense to make these “debug jars” available as separate resources on the download page, for easier access? Or maybe it makes sense to make the “debug jars” as the default ones, and to have the smaller “non debug” jars available as separate resources?

 

Thanks,

 

- Aaron

 

Michael Glavassevich | 8 Apr 2011 01:24
Picon

Re: Xerces builds - Why don't they include line number attributes?

Aaron,

"Pieper, Aaron" <PieperA <at> Pragmatics.com> wrote on 04/07/2011 12:27:10 PM:

> I was trying to figure out why certain XML validation operations had
> gotten slower, so I was digging into Xerces’ source when I noticed
> it didn’t have line number attributes. I was directed to the
> previous discussion at http://markmail.org/thread/qkbaup5dzjrx5ffj
> which indicates that the decision was made to omit these attributes,
> in order to reduce jar file size. This makes sense, although it’s
> curious that no other apache projects (such as such as Spring or CXF
> ) have taken a similar direction, despite having much larger JAR files.

I can't speak for what others do. Each project community decides what's best for it.

> I don’t mind checking out and build the debug versions of the Xerces
> libraries myself, and indeed I’ve already done so. But maybe for
> future releases, it would make sense to make these “debug jars”
> available as separate resources on the download page, for easier
> access? Or maybe it makes sense to make the “debug jars” as the
> default ones, and to have the smaller “non debug” jars available as
> separate resources?

Sure, that's possible for a future release.

> Thanks,
>  
> - Aaron
>  

Thanks.

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

Schwarz, Konrad | 11 Apr 2011 18:17
Picon

DOM Load and Store parser filter & document element

Hi,
 
contrary to my reading of the DOM load and store specification, the document element node (that is, the top-level element at the root of an XML document, not the document node itself) is not being passed to my LSParserFilter's startElement() and acceptNode() methods.  My getWhatToShow() routine always returns 1, that is SHOW_ELEMENT.
 
Is this a bug?
 
I am using JDK 1.6_24 -- I think this incorporates Xerces.
 
 
Regards,
Konrad Schwarz
 
Siemens AG
Corporate Technology
Corporate Research and Technologies
CT T DE IT1
Otto-Hahn-Ring 6
81739 München, Deutschland
Tel.: +49 (89) 636-53579
Fax: +49 (89) 636-45450
 
Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard Cromme; Vorstand: Peter Löscher, Vorsitzender; Roland Busch, Brigitte Ederer, Klaus Helmrich, Joe Kaeser, Barbara Kux, Hermann Requardt, Siegfried Russwurm, Peter Y. Solmssen, Michael Süß; Sitz der Gesellschaft: Berlin und München, Deutschland; Registergericht: Berlin Charlottenburg, HRB 12300, München, HRB 6684; WEEE-Reg.-Nr. DE 23691322
 
 
 
Michael Glavassevich | 11 Apr 2011 19:28
Picon

Re: DOM Load and Store parser filter & document element

Hi Konrad,

The document element (node) is never passed to an LSParserFilter. It says that clearly in the Javadoc [1].

Please also note that you're not using Apache Xerces at all. The implementation which ships in the Oracle JDK is a fork of the Apache code base which Oracle/Sun has made all sorts of changes and additions to. If you are experiencing issues with that code base you would need to pursue it with Oracle. We have no influence over what they include in their versions.

Thanks.

[1] http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSParserFilter.html

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

"Schwarz, Konrad" <konrad.schwarz <at> siemens.com> wrote on 04/11/2011 12:17:29 PM:

> Hi,
>  
> contrary to my reading of the DOM load and store specification, the
> document element node (that is, the top-level element at the root of
> an XML document, not the document node itself) is not being passed
> to my LSParserFilter's startElement() and acceptNode() methods.  My
> getWhatToShow() routine always returns 1, that is SHOW_ELEMENT.
>  
> Is this a bug?
>  
> I am using JDK 1.6_24 -- I think this incorporates Xerces.
>  
>  
> Regards,
> Konrad Schwarz
>  
> Siemens AG
> Corporate Technology
> Corporate Research and Technologies
> CT T DE IT1
> Otto-Hahn-Ring 6
> 81739 München, Deutschland
> Tel.: +49 (89) 636-53579
> Fax: +49 (89) 636-45450
> mailto:konrad.schwarz <at> siemens.com

Schwarz, Konrad | 12 Apr 2011 09:38
Picon

RE: DOM Load and Store parser filter & document element

Thank you very much.
 
I must have read that paragraph half a dozen times, but missed the key sentence.
 
Best regards,
Konrad Schwarz
 
 
Thiwanka Somasiri | 15 Apr 2011 19:37
Picon

Difference between Document.getNodeValue() and Document.getTextContent()?

Hi all,


    I wrote a sample program parse an XML file and tried to traverse through the DOM tree. I used Document.getNodeValue() method and Document.getTextContent() method to access the text values values of the nodes and getNodeValue() gave "null" values to the nodes, but getTextContent() gave correct values in the XML itself. Can someone explain me the difference between these two methods?

This is the XML file I was using :

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Thiwanka</to>
<from>Erangi</from>
</note>

Thanks.

--

Regards

A.S.Thiwanka Somasiri

Skype : executionerwild
MSN   : thiwas <at> ymail.com


keshlam | 15 Apr 2011 19:41
Picon
Favicon

Re: Difference between Document.getNodeValue() and Document.getTextContent()?

The node value of a Document node is null. [1]
The text content of a Document node is the concatenation of the textContent value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. [2]

[1] http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1950641247
[2] http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent

______________________________________
"You build world of steel and stone
I build worlds of words alone
Skilled tradespeople, long years taught:
You shape matter; I shape thought."
(http://www.songworm.com/lyrics/songworm-parody/ShapesofShadow.html)


From: Thiwanka Somasiri <asthiwanka <at> gmail.com>
To: j-users <at> xerces.apache.org
Date: 04/15/2011 01:34 PM
Subject: Difference between Document.getNodeValue() and Document.getTextContent()?




Hi all,

    I wrote a sample program parse an XML file and tried to traverse through the DOM tree. I used Document.getNodeValue() method and Document.getTextContent() method to access the text values values of the nodes and getNodeValue() gave "null" values to the nodes, but getTextContent() gave correct values in the XML itself. Can someone explain me the difference between these two methods?

This is the XML file I was using :

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Thiwanka</to>
<from>Erangi</from>
</note>

Thanks.

--

Regards

A.S.Thiwanka Somasiri

Skype : executionerwild
MSN   : thiwas <at> ymail.com



Michael Glavassevich | 15 Apr 2011 20:03
Picon

Re: Difference between Document.getNodeValue() and Document.getTextContent()?

And if you want to retrieve the text node child of an element node you should be traversing to it with getFirstChild() and the other navigation methods.

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

keshlam <at> us.ibm.com wrote on 04/15/2011 01:41:19 PM:

> The node value of a Document node is null. [1]
> The text content of a Document node is the concatenation of the textContent
> value of every child node, excluding COMMENT_NODE and
> PROCESSING_INSTRUCTION_NODE nodes. [2]
>
> [1] http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1950641247
> [2] http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent
>
> ______________________________________
> "You build world of steel and stone
> I build worlds of words alone
> Skilled tradespeople, long years taught:
> You shape matter; I shape thought."
> (http://www.songworm.com/lyrics/songworm-parody/ShapesofShadow.html)
>

>
> From:
>
> Thiwanka Somasiri <asthiwanka <at> gmail.com>
>
> To:
>
> j-users <at> xerces.apache.org
>
> Date:
>
> 04/15/2011 01:34 PM
>
> Subject:
>
> Difference between Document.getNodeValue() and Document.getTextContent()?
>
>
>
>
>
> Hi all,
>
>     I wrote a sample program parse an XML file and tried to traverse
> through the DOM tree. I used Document.getNodeValue() method and
> Document.getTextContent() method to access the text values values of
> the nodes and getNodeValue() gave "null" values to the nodes, but
> getTextContent() gave correct values in the XML itself. Can someone
> explain me the difference between these two methods?
>
> This is the XML file I was using :
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <note>
> <to>Thiwanka</to>
> <from>Erangi</from>
> </note>
>
> Thanks.
>
> --
>
> Regards
>
> A.S.Thiwanka Somasiri
>
> Skype : executionerwild
> MSN   : thiwas <at> ymail.com

Thiwanka Somasiri | 16 Apr 2011 21:47
Picon

Re: Difference between Document.getNodeValue() and Document.getTextContent()?

Hi Kesh and Michael,


    Thanks for your reply. That worked for me. And also got to know that another node is created for the "new line" which is there in the XML file as follows:

        <note>
<to>Apache</to>
              ............................
   The "note" is the document element and its' node value is null. The next node is a text node where its' node value is "\n". Next node is "to" and its' node value is also null and so on.

Thanks.

On Fri, Apr 15, 2011 at 11:07 PM, Thiwanka Somasiri <asthiwanka <at> gmail.com> wrote:
Hi all,

    I wrote a sample program parse an XML file and tried to traverse through the DOM tree. I used Document.getNodeValue() method and Document.getTextContent() method to access the text values values of the nodes and getNodeValue() gave "null" values to the nodes, but getTextContent() gave correct values in the XML itself. Can someone explain me the difference between these two methods?

This is the XML file I was using :

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Thiwanka</to>
<from>Erangi</from>
</note>

Thanks.

--

Regards

A.S.Thiwanka Somasiri

Skype : executionerwild
MSN   : thiwas <at> ymail.com





--

Regards

A.S.Thiwanka Somasiri

Skype : executionerwild
MSN   : thiwas <at> ymail.com



Gmane