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 <[EMAIL PROTECTED]> 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, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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>

-            <artifactId>jsr173_api</artifactId>

-            <version>1.6</version>

+            <groupId>stax</groupId>

+            <artifactId>stax-api</artifactId>

+            <version>1.0</version>

           <properties>

               <module>true</module>

           </properties>


Modified: webservices/axis/trunk/java/modules/core/project.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/project.xml?rev=264675&r1=264674&r2=264675&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/project.xml (original)
+++ webservices/axis/trunk/java/modules/core/project.xml Mon Aug 29 19:38:04 
2005
@@ -62,17 +62,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>

-            <artifactId>jsr173_api</artifactId>

-            <version>1.6</version>

+            <groupId>stax</groupId>

+            <artifactId>stax-api</artifactId>

+            <version>1.0</version>

           <properties>

               <module>true</module>

           </properties>


Modified: webservices/axis/trunk/java/modules/integration/project.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/integration/project.xml?rev=264675&r1=264674&r2=264675&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/integration/project.xml (original)
+++ webservices/axis/trunk/java/modules/integration/project.xml Mon Aug 29 
19:38:04 2005
@@ -116,17 +116,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>

-            <artifactId>jsr173_api</artifactId>

-            <version>1.6</version>

+            <groupId>stax</groupId>

+            <artifactId>stax-api</artifactId>

+            <version>1.0</version>

           <properties>

               <module>true</module>

           </properties>


Modified: webservices/axis/trunk/java/modules/saaj/project.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/project.xml?rev=264675&r1=264674&r2=264675&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/project.xml (original)
+++ webservices/axis/trunk/java/modules/saaj/project.xml Mon Aug 29 19:38:04 
2005
@@ -110,17 +110,17 @@
           </properties>

       </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>

-            <artifactId>jsr173_api</artifactId>

-            <version>1.6</version>

+            <groupId>stax</groupId>

+            <artifactId>stax-api</artifactId>

+            <version>1.0</version>

           <properties>

               <module>true</module>

           </properties>


Modified: webservices/axis/trunk/java/modules/samples/project.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/project.xml?rev=264675&r1=264674&r2=264675&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/project.xml (original)
+++ webservices/axis/trunk/java/modules/samples/project.xml Mon Aug 29 19:38:04 
2005
@@ -103,17 +103,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>

-            <artifactId>jsr173_api</artifactId>

-            <version>1.6</version>

+            <groupId>stax</groupId>

+            <artifactId>stax-api</artifactId>

+            <version>1.0</version>

           <properties>

               <module>true</module>

           </properties>


Modified: webservices/axis/trunk/java/modules/security/project.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/project.xml?rev=264675&r1=264674&r2=264675&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/security/project.xml (original)
+++ webservices/axis/trunk/java/modules/security/project.xml Mon Aug 29 
19:38:04 2005
@@ -74,17 +74,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>
-            <artifactId>jsr173_api</artifactId>
-            <version>1.6</version>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+            <version>1.0</version>
           <properties>
               <module>true</module>
           </properties>

Modified: webservices/axis/trunk/java/modules/wsdl/project.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/project.xml?rev=264675&r1=264674&r2=264675&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/project.xml (original)
+++ webservices/axis/trunk/java/modules/wsdl/project.xml Mon Aug 29 19:38:04 
2005
@@ -61,17 +61,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>

-            <artifactId>jsr173_api</artifactId>

-            <version>1.6</version>

+            <groupId>stax</groupId>

+            <artifactId>stax-api</artifactId>

+            <version>1.0</version>

           <properties>

               <module>true</module>

           </properties>


Modified: webservices/axis/trunk/java/modules/xml/project.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/project.xml?rev=264675&r1=264674&r2=264675&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/project.xml (original)
+++ webservices/axis/trunk/java/modules/xml/project.xml Mon Aug 29 19:38:04 2005
@@ -32,6 +32,7 @@


       <unitTest>

           <excludes>

+                <exclude>**/*SpacesTest.java</exclude>

           </excludes>

           <includes>

               <include>**/*Test.java</include>

@@ -95,17 +96,17 @@
           </properties>

       </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>

-            <artifactId>jsr173_api</artifactId>

-            <version>1.6</version>

+            <groupId>stax</groupId>

+            <artifactId>stax-api</artifactId>

+            <version>1.0</version>

           <properties>

               <module>true</module>

           </properties>


Modified: 
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java?rev=264675&r1=264674&r2=264675&view=diff
==============================================================================
--- 
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
 (original)
+++ 
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
 Mon Aug 29 19:38:04 2005
@@ -40,8 +40,6 @@

   protected boolean isBinary = false;

-    private static Random rnd = new Random(new Date().getTime());
-
   /**
    * Field contentID for the mime part used when serialising Binary stuff as
    * MTOM optimised

Modified: 
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java?rev=264675&r1=264674&r2=264675&view=diff
==============================================================================
--- 
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
 (original)
+++ 
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
 Mon Aug 29 19:38:04 2005
@@ -136,19 +136,16 @@
    * @throws OMException

    */

   protected OMNode createOMText(int textType) throws OMException {

+        OMNode node = null;

       if (lastNode == null) {

-            throw new OMException();

+            return null;

+        } else if (!lastNode.isComplete()) {

+            node = omfactory.createText((OMElement) lastNode, 
parser.getText());

+            node.setType(textType);

+        } else if (!(lastNode.getParent() instanceof OMDocument)) {

+            node = omfactory.createText((OMElement)lastNode.getParent(), 
parser.getText());

+            node.setType(textType);

       }

-        OMNode node;

-        if (lastNode.isComplete()) {

-            node =

-                    omfactory.createText((OMElement) lastNode.getParent(),

-                            parser.getText());

-        } else {

-            OMElement e = (OMElement) lastNode;

-            node = omfactory.createText(e, parser.getText());

-        }

-        node.setType(textType);

       return node;

   }










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






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

Reply via email to