axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anil Arora" <aar...@interlacesystems.com>
Subject Serializing schema document
Date Wed, 12 Oct 2005 19:11:30 GMT
I am using AXIS 1.1 and I am trying to serialize a schema document
within my SOAP response XML as so...

 

I need to add some schema information to my return XML as so...

 

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 

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

                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

 <soapenv:Header>

  <ns1:Session xsi:nil="true"
xmlns:ns1="urn:schemas-microsoft-com:xml-analysis"/>

 </soapenv:Header>

 <soapenv:Body>

  <DiscoverResponse xmlns="urn:schemas-microsoft-com:xml-analysis">

   <return>

    <ns2:root xsi:type="ns2:RowResult"
xmlns:ns2="urn:schemas-microsoft-com:xml-analysis:rowset">

     <xsd:schema elementFormDefault="qualified" 

 
targetNamespace="urn:schemas-microsoft-com:xml-analysis:rowset" 

                 xmlns:sql="urn:schemas-microsoft-com:xml-sql">

 

         <xsd:element name="root">

            <xsd:complexType>

               <xsd:sequence maxOccurs="unbounded" minOccurs="0">

                  <xsd:element name="row" type="row"/>

               </xsd:sequence>

            <xsd:complexType>

         </xsd:element>

         <xsd:complexType name="row">

            <xsd:sequence maxOccurs="unbounded" minOccurs="0">

               <xsd:element name="CATALOG_NAME" sql:field="CATALOG_NAME"
type="xsd:string"/>

               <xsd:element name="DESCRIPTION" sql:field="DESCRIPTION"
type="xsd:string"/>

            </xsd:sequence> 

         </xsd:complexType>

     </xsd:schema>

     <ns2:row>

      <CATALOG_NAME>Interlace</CATALOG_NAME>

      <DESCRIPTION>Interlace Catalog</DESCRIPTION>

     </ns2:row>

    </ns2:root>

   </return>

  </DiscoverResponse>

 </soapenv:Body>

</soapenv:Envelope>

 

 

Since I had predefined xsd files, I figured that the best way would be
to get my xsd file, create a Document object using the javax parsers,
and then serialize the document using the DocumentSerializer.  However,
when I do this, I get the following:

 

  <DiscoverResponse xmlns="urn:schemas-microsoft-com:xml-analysis">

   <return>

    <ns2:root xsi:type="ns2:RowResult"
xmlns:ns2="urn:schemas-microsoft-com:xml-analysis:rowset">

     <xsd:schema>

        <xsd:schema elementFormDefault="qualified" 

 
targetNamespace="urn:schemas-microsoft-com:xml-analysis:rowset" 

                    xmlns:sql="urn:schemas-microsoft-com:xml-sql">

        ...

        </xsd:schema>

     </xsd:schema>

 

     ...

    </ns2:root>

   </return>

   </DiscoverResponse>

 

 

Notice that the xsd:schema is embedded within another xsd:schema tag.
If I try to call context.writeDOMElement(document.getElement())
directly, I get close to what I want, but it is not merging the
namespaces like I would expect.  It is taking my xsd file as is.  Is
there a way I can merge the namespaces with minimal code?

 

Thanks,

Anil

 

 


Mime
View raw message