[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: [jira] Created: (XMLBEANS-311) XmlCursor.getTextValue returns
From: "Coram Bryant (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date: 2007-01-31 23:37:05
Message-ID: 26591086.1170286625908.JavaMail.jira () brutus
[Download RAW message or body]
XmlCursor.getTextValue returns concatenation of child text, comment, and processing \
instruction nodes
-----------------------------------------------------------------------------------------------------
Key: XMLBEANS-311
URL: https://issues.apache.org/jira/browse/XMLBEANS-311
Project: XMLBeans
Issue Type: Bug
Components: Cursor
Affects Versions: Version 2.2.1
Environment: Microsoft Windows XP Professional Version 2002 (Service Pack 2)
Intel Pentium 4 CPU 3.00GHZ
Reporter: Coram Bryant
Priority: Minor
According to the XmlBeans javadocs, if the XmlCursor corresponds to an element then \
non-text content such as comments and processing instructions are ignored. However, \
as the following test shows, this is not the case:
String xml = "<element><!--A Comment-->999<?PI A Processing Instruction?></element>";
XmlObject xo = XmlObject.Factory.parse(xml);
XmlCursor xc = xo.newCursor();
xc.toFirstChild();
System.out.println(xc.currentTokenType()); // Verify that we are positioned at the \
start of an element System.out.println(xc.getTextValue());
This prints out:
START
A Comment 999A Processing Instruction
Analysis:
In this case, the call stack is as follows:
org.apache.xmlbeans.impl.store.Cursor.getTextValue
org.apache.xmlbeans.impl.store.Cursor._getTextValue
org.apache.xmlbeans.impl.store.Locale.getTextValue
In this method, the text value is built up with the text of instances of Cur for \
which the isText method returns true. I believe the \
org.apache.xmlbeans.impl.store.Cur.isText method should be as follows:
boolean isText ( ) { assert isPositioned(); return _pos > 0 && \
kindIsContainer(_xobj.kind()); }
This would exclude comments and processing instructions.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic