You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by Aleksander Slominski <as...@cs.indiana.edu> on 2005/08/30 19:38:39 UTC

Re: [stax_builders] Re: CDATA Events in STAX parser

recorded as http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=231

alek

Davanum Srinivas wrote:

>+1 to a separate property as is in sjsxp.
>
>thanks,
>dims
>
>--- Aleksander Slominski <as...@extreme.indiana.edu> wrote:
>
>  
>
>>Davanum Srinivas wrote:
>>
>>    
>>
>>>unfortunately does not work. I DID TRY latest SVN before opening the
>>>bug report and i actually created the bug report with a patch :(
>>> 
>>>
>>>      
>>>
>>...
>>
>>    
>>
>>>Testcase: testCData(org.apache.axis2.om.SpacesTest):	FAILED
>>>org.custommonkey.xmlunit.Diff
>>>[different] Expected node type '4' but was '3' - comparing
>>><![CDATA[<foo>]]> at /foo[1]/doc[1]/text()[1] to <doc ...><foo></doc>
>>>at /foo[1]/doc[1]/text()[1]
>>>
>>>junit.framework.AssertionFailedError: org.custommonkey.xmlunit.Diff
>>>[different] Expected node type '4' but was '3' - comparing
>>><![CDATA[<foo>]]> at /foo[1]/doc[1]/text()[1] to <doc ...><foo></doc>
>>>at /foo[1]/doc[1]/text()[1]
>>>
>>>	at org.custommonkey.xmlunit.XMLAssert.assertXMLEqual(XMLAssert.java:111)
>>>	at org.custommonkey.xmlunit.XMLTestCase.assertXMLEqual(XMLTestCase.java:180)
>>>	at org.apache.axis2.om.SpacesTest.checkOMConformance(SpacesTest.java:82)
>>>	at org.apache.axis2.om.SpacesTest.testCData(SpacesTest.java:49)
>>>
>>> 
>>>
>>>      
>>>
>>this is a bug/misfeature of current spec:
>>http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=181
>>
>>however why are you testing for CDATA? from XML Infoset point of view 
>>there is no CDATA only characters:
>>
>>http://www.w3.org/TR/xml-infoset/#omitted
>>(...)The boundaries of CDATA marked sections.(...)
>>
>>and CDATA is essentially replaced with characters content inside CDATA:
>>
>>http://www.w3.org/TR/xml-infoset/#infoitem.character
>>
>>i am pretty sure that the effect of applying the patch would be to break 
>>RI parser compliance:
>>
>>1) the first change would make hasText() work differently than specified 
>>in JavaDoc:
>>
>>XMLStreamReader:
>>  /**
>>   * Return true if the current event has text, false otherwise
>>   * The following events have text:
>>   * CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT, SPACE
>>   */
>>  public boolean hasText();
>>
>>2) second change: as you can see in description of next() reporting 
>>CDATA content as characters is not allowed (even when isCoalescing is 
>>false ...):
>>
>>  /**
>>   * Get next parsing event - a processor may return all contiguous
>>   * character data in a single chunk, or it may split it into several 
>>chunks.
>>   * If the property javax.xml.stream.isCoalescing is set to true
>>   * element content must be coalesced and only one CHARACTERS event
>>   * must be returned for contiguous element content or
>>   * CDATA Sections. 
>>   *
>>   * By default entity references must be
>>   * expanded and reported transparently to the application.
>>   * An exception will be thrown if an entity reference cannot be expanded.
>>   * If element content is empty (i.e. content is "") then no CHARACTERS 
>>event will be reported.
>>   *
>>   * <p>Given the following XML:<br>
>>   * &lt;foo>&lt;!--description-->content 
>>text&lt;![CDATA[&lt;greeting>Hello&lt;/greeting>]]>other 
>>content&lt;/foo><br>
>>   * The behavior of calling next() when being on foo will be:<br>
>>   * 1- the comment (COMMENT)<br>
>>   * 2- then the characters section (CHARACTERS)<br>
>>   * 3- then the CDATA section (another CHARACTERS)<br>
>>   * 4- then the next characters section (another CHARACTERS)<br>
>>   * 5- then the END_ELEMENT<br>
>>   *
>>   * <p><b>NOTE:</b> empty element (such as &lt;tag/>) will be reported
>>   *  with  two separate events: START_ELEMENT, END_ELEMENT - This preserves
>>   *   parsing equivalency of empty element to &lt;tag>&lt;/tag>.
>>   *
>>   * This method will throw an IllegalStateException if it is called 
>>after hasNext() returns false.
>>   * @see javax.xml.stream.events.XMLEvent
>>   * @return the integer code corresponding to the current parse event
>>   * @throws NoSuchElementException if this is called when hasNext() 
>>returns false
>>   * @throws XMLStreamException  if there is an error processing the 
>>underlying XML source
>>   */
>>  public int next() throws XMLStreamException;
>>
>>i think this problem (and few others) should be fixed in maintenance 
>>update of JSR 173 and as we can not currently change spec so parser impl 
>>must follow spec if if it is broken ...
>>to this extent i opened meta issue: 
>>http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=230
>>
>>i am open to some other suggestion - maybe custom property to turn on 
>>returning CDATA for stream reader?
>>
>>thanks,
>>
>>alek
>>
>>    
>>
>>>On 8/30/05, Aleksander Slominski <as...@cs.indiana.edu> wrote:
>>> 
>>>
>>>      
>>>
>>>>Dims,
>>>>
>>>>pelase check with lates StAX RI - i have built new JAR and dropped to
>>>>http://dist.codehaus.org/stax/jars/
>>>>(and that should propagte later ot other maven repos)
>>>>
>>>>best,
>>>>
>>>>alek
>>>>
>>>>Davanum Srinivas wrote:
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>Added a bug report with stax folks (http://jira.codehaus.org/browse/STAX-14)
>>>>>
>>>>>-- dims
>>>>>
>>>>>On 8/29/05, dims@apache.org <di...@apache.org> wrote:
>>>>>
>>>>>
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>>>Author: dims
>>>>>>Date: Mon Aug 29 19:38:04 2005
>>>>>>New Revision: 264675
>>>>>>
>>>>>>URL: http://svn.apache.org/viewcvs?rev=264675&view=rev
>>>>>>Log:
>>>>>>- sjsxp is no good :( as we can't re-distribute it
>>>>>>            
>>>>>>
>>(http://java.sun.com/webservices/docs/1.6/ReleaseNotes.html)
>>    
>>
>>>>>>- Get all the tests working again. EXCEPT SpacesTest (we're not getting the cdata events)
>>>>>>- Get rid of unused Random member
>>>>>>
>>>>>>
>>>>>>Modified:
>>>>>>  webservices/axis/trunk/java/modules/addressing/project.xml
>>>>>>  webservices/axis/trunk/java/modules/core/project.xml
>>>>>>  webservices/axis/trunk/java/modules/integration/project.xml
>>>>>>  webservices/axis/trunk/java/modules/saaj/project.xml
>>>>>>  webservices/axis/trunk/java/modules/samples/project.xml
>>>>>>  webservices/axis/trunk/java/modules/security/project.xml
>>>>>>  webservices/axis/trunk/java/modules/wsdl/project.xml
>>>>>>  webservices/axis/trunk/java/modules/xml/project.xml
>>>>>>  webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
>>>>>> 
>>>>>>            
>>>>>>
>webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
>  
>
>>>>>>Modified: webservices/axis/trunk/java/modules/addressing/project.xml
>>>>>>URL:
>>>>>>            
>>>>>>
>http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/addressing/project.xml?rev=264675&r1=264674&r2=264675&view=diff
>  
>
>>>>>>==============================================================================
>>>>>>--- webservices/axis/trunk/java/modules/addressing/project.xml (original)
>>>>>>+++ webservices/axis/trunk/java/modules/addressing/project.xml Mon Aug 29 19:38:04 2005
>>>>>>@@ -66,17 +66,17 @@
>>>>>>           <url>http://dist.codehaus.org/stax/jars/</url>
>>>>>>
>>>>>>       </dependency>
>>>>>>
>>>>>>       <dependency>
>>>>>>
>>>>>>-            <groupId>sjsxp</groupId>
>>>>>>
>>>>>>-            <artifactId>sjsxp</artifactId>
>>>>>>
>>>>>>-            <version>1.6</version>
>>>>>>
>>>>>>+            <groupId>stax</groupId>
>>>>>>
>>>>>>+            <artifactId>stax</artifactId>
>>>>>>
>>>>>>+            <version>1.1.1-dev</version>
>>>>>>
>>>>>>           <properties>
>>>>>>
>>>>>>               <module>true</module>
>>>>>>
>>>>>>           </properties>
>>>>>>
>>>>>>       </dependency>
>>>>>>
>>>>>>       <dependency>
>>>>>>
>>>>>>-            <groupId>sjsxp</groupId>
>>>>>>
>>>>>>            
>>>>>>
>=== message truncated ===
>
>
>Davanum Srinivas - http://webservices.apache.org/~dims/
>
>
>		
>____________________________________________________
>Start your day with Yahoo! - make it your home page 
>http://www.yahoo.com/r/hs 
> 
>
>
>------------------------ Yahoo! Groups Sponsor --------------------~--> 
>Fair play? Video games influencing politics. Click and talk back!
>http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/NhFolB/TM
>--------------------------------------------------------------------~-> 
>
> 
>Yahoo! Groups Links
>
><*> To visit your group on the web, go to:
>    http://groups.yahoo.com/group/stax_builders/
>
><*> To unsubscribe from this group, send an email to:
>    stax_builders-unsubscribe@yahoogroups.com
>
><*> Your use of Yahoo! Groups is subject to:
>    http://docs.yahoo.com/info/terms/
> 
>
>
>  
>


-- 
The best way to predict the future is to invent it - Alan Kay