Hi Coram,

Indeed the getTextValue() on a start element returns the concatenated
text of all the entities inside the element, including the processing
instructions, it doesn't do exactly what it says in the javadoc.
I guess the most useful behavior would be the one described in the
javadoc, than the one it actually does. 

Please file a bug and a bug fix would be much appreciated.

Cezar

> -----Original Message-----
> From: cbryant [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 25, 2007 12:34 PM
> To: dev@xmlbeans.apache.org
> Subject: XmlBeans bugs involving comments and processing instructions
> 
> 
> All,
> 
> We have recently stumbled upon two (possibly related) issues involving
> comments and processing instructions that appear to be bugs in
XMLBeans.
> 
> The first involves the XmlCursor.getTextValue() method.  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 does not appear to be 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
> 
> 
> This apparent bug becomes more critical when evaluating XPath
expressions.
> It appears that the same value returned by getTextValue is that which
is
> passed on to the Saxon XPath engine for evaluating element values, as
the
> following test shows:
> 
> String xml = "<element><!--A Comment-->999<?PI A Processing
> Instruction?></element>";
> XmlObject xo = XmlObject.Factory.parse(xml);
> xo.selectPath("/element = 3");
> 
> This code snippet causes a Saxon ValidationException, with the
message:
> Cannot convert string " A Comment 999A Processing Ins..." to a double
> 
> 
> If these results are a side-effect of misunderstanding, then we would
> greatly appreciate some insight.  Otherwise, we're not sure how to
enter
> them as bugs, other than to post on this forum.
> 
> Thanks,
> Coram
> 
> --
> View this message in context: http://www.nabble.com/XmlBeans-bugs-
> involving-comments-and-processing-instructions-tf3118340.html#a8638741
> Sent from the Xml Beans - Dev mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

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

Reply via email to