axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-565) Namespace vanishes using StAXOMBuilder
Date Tue, 18 Apr 2006 13:37:48 GMT
    [ http://issues.apache.org/jira/browse/AXIS2-565?page=comments#action_12374935 ] 

Davanum Srinivas commented on AXIS2-565:
----------------------------------------

OOPS!!! looking at the wrong xml. AXIOM *ADDS* an extra xmlns:col="urn:mycolor" to the color
element even though it is present in the parent. Please let me know and we can reopen the
problem if you feel it. 

<pre>

<root>
	<node>Some text</node>
	<node>More test</node>
	<items>
		<item xmlns:col="urn:mycolor" shape="rectangle">
			<col:color xmlns:col="urn:mycolor" rgb="#FF0000">red</col:color>
			<name>My fine <b>item</b>
			</name>
		</item>
		<item xmlns:col="urn:mycolor" shape="circle">
			<col:color xmlns:col="urn:mycolor" rgb="#0000FF">blue</col:color>
			<name>Something else</name>
		</item>
	</items>
	<shapes>
		<shape>rectangle</shape>
		<shape>circle</shape>
		<shape basedOn="rectangle">square</shape>
	</shapes>
</root>
 
</pre>

> Namespace vanishes using StAXOMBuilder
> --------------------------------------
>
>          Key: AXIS2-565
>          URL: http://issues.apache.org/jira/browse/AXIS2-565
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>     Versions: 0.95
>  Environment: Windows XP, Java 1.5
>     Reporter: Ant Grinyer
>     Assignee: Eran Chinthaka

>
> Below is the simple Junit test code which demonstrates the bug comments:
> package com.mytest;
> import org.apache.ws.commons.om.impl.builder.StAXOMBuilder;
> import org.apache.ws.commons.om.impl.llom.factory.OMXMLBuilderFactory;
> import org.apache.ws.commons.om.OMAbstractFactory;
> import org.jdom.Document;
> import org.jdom.output.XMLOutputter;
> import org.jdom.input.SAXBuilder;
> import javax.xml.stream.XMLStreamReader;
> import javax.xml.stream.XMLInputFactory;
> import java.io.StringReader;
> import junit.framework.TestCase;
> /**
>  * Test class to demonstrate namespace problem.
>  *
>  * Date: 11-Apr-2006
>  */
> public class Axis2Test extends TestCase {
>     public Axis2Test(String string) { super(string); }
>     protected void setUp() throws Exception { super.setUp(); }
>     protected void tearDown() throws Exception { super.tearDown(); }
>     public void testNameSpaces() {
>         StringBuffer sb = new StringBuffer();
>         sb.append("<root>");
>         sb.append("  <node>Some text</node>");
>         sb.append("  <node>More test</node>");
>         sb.append("  <items>");
>         sb.append("    <item shape=\"rectangle\" xmlns:col=\"urn:mycolor\"><col:color
rgb=\"#FF0000\">red</col:color><name>My fine <b>item</b></name></item>");
>         sb.append("    <item shape=\"circle\" xmlns:col=\"urn:mycolor\"><col:color
rgb=\"#0000FF\">blue</col:color><name>Something else</name></item>");
>         sb.append("  </items>");
>         sb.append("  <shapes>");
>         sb.append("    <shape>rectangle</shape>");
>         sb.append("    <shape>circle</shape>");
>         sb.append("    <shape basedOn=\"rectangle\">square</shape>");
>         sb.append("  </shapes>");
>         sb.append("</root>");
>         try {
>             // TRY WITH AXIS2 (loses xmlns:col="urn:mycolor" namespace on
>             // the <item shape="circle" xmlns:col="urn:mycolor"> element
>             XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new
StringReader(sb.toString()));
>             StAXOMBuilder builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(),parser);
>             System.out.println(builder.getDocumentElement().toString());
>             // TRY JDOM (works fine)
>             Document d = new SAXBuilder().build(new StringReader(sb.toString()));
>             new XMLOutputter().output(d, System.out);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message