You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Thilina Gunarathne <cs...@gmail.com> on 2006/08/09 04:07:14 UTC

[XMLSchema] Problem with ADB serializing

Hi all,

I came up with the following behavior while preparing the exercises for the
SkillMatter ADB presentation.

Getting the pull parser and serializing gave me only the following.

<varString>Hello</varString>

While taking OMElement and serializing resulted in the following correct
serialization.

<ns1:myElement xmlns:ns1="http://soapinterop.org/types
"><varString>Hello</varString><varInt>12</varInt><varFloat>12.33
</varFloat></ns1:myElement>


Schema and the code are as attached with this mail.

Am I missing anything in the pullparser scenario?

Thanks,

~Thilina



<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="
http://www.w3.org/2001/XMLSchema"

xmlns:tns="http://soapinterop.org/types" targetNamespace="
http://soapinterop.org/types">

<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>

 <complexType name="SOAPStruct">

  <sequence>

   <element name="varString" type="xsd:string"/>

   <element name="varInt" type="xsd:int"/>

   <element name="varFloat" type="xsd:float"/>

  </sequence>

 </complexType>

<element name="myElement" type="tns:SOAPStruct"/>

</schema>



            public static void main(String[] args) throws Exception {

                        MyElement elt = new MyElement();

                        SOAPStruct s = new SOAPStruct();

                        s.setVarString("Hello");

                        s.setVarInt(12);

                        s.setVarFloat(12.33F);

                        elt.setMyElement(s);



                        XMLStreamReader reader = elt.getPullParser(null);

                        OMElement omElt =

                              new
StAXOMBuilder(reader).getDocumentElement();

                        omElt.serialize(System.out);



                        OMFactory factory = new OMLinkedListImplFactory();

                        OMElement omElement = elt.getOMElement
(null,factory);

                        omElement.serialize(System.out);

            }


-- 
"May the SourcE be with u"
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/
http://www.bloglines.com/blog/Thilina

[XMLSchema] Problem with ADB serializing

Posted by Thilina Gunarathne <cs...@gmail.com>.
 Hi all,

I came up with the following different behaviors when trying out a simple
sample with ADB.

Getting the pull parser and serializing gave me only the following.

<varString>Hello</varString>

While taking OMElement and serializing resulted in the following correct
serialization.

<ns1:myElement xmlns:ns1="http://soapinterop.org/types
"><varString>Hello</varString><varInt>12</varInt><varFloat>12.33</varFloat></ns1:myElement>



Schema and the code are as attached with this mail.

Am I missing anything in the pullparser scenario?Or is this the expected
behaviour?

Thanks,

~Thilina



<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="
http://www.w3.org/2001/XMLSchema"

xmlns:tns="http://soapinterop.org/types" targetNamespace="
http://soapinterop.org/types">

<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>

 <complexType name="SOAPStruct">

  <sequence>

   <element name="varString" type="xsd:string"/>

   <element name="varInt" type="xsd:int"/>

   <element name="varFloat" type="xsd:float"/>

  </sequence>

 </complexType>

<element name="myElement" type="tns:SOAPStruct"/>

</schema>



            public static void main(String[] args) throws Exception {

                        MyElement elt = new MyElement();

                        SOAPStruct s = new SOAPStruct();

                        s.setVarString("Hello");

                        s.setVarInt(12);

                        s.setVarFloat(12.33F);

                        elt.setMyElement(s);



                        XMLStreamReader reader = elt.getPullParser(null);

                        OMElement omElt =

                              new
StAXOMBuilder(reader).getDocumentElement();

                        omElt.serialize(System.out);



                        OMFactory factory = new OMLinkedListImplFactory();

                        OMElement omElement = elt.getOMElement
(null,factory);

                        omElement.serialize(System.out);

            }


-- 
"May the SourcE be with u"
http://webservices.apache.org/~thilina/<http://webservices.apache.org/%7Ethilina/>
http://thilinag.blogspot.com/
http://www.bloglines.com/blog/Thilina


-- 
"May the SourcE be with u"
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/
http://www.bloglines.com/blog/Thilina