You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Jun Qian <jq...@hotmail.com> on 2008/03/20 21:22:34 UTC

Why dropping namespaces when soap encoding is used?

Hi,

Can someone please explain why when soap encoding is used, the instance document generated by XmlBeans' SampleXmlUtil drops all the namespaces, even if the schema says elementFormDefault="qualified"?


>From SampleXmlUtil.java:

        if (_soapEnc)
            xmlc.insertElement(element.getName().getLocalPart()); // soap encoded? drop namespaces.
        else
            xmlc.insertElement(element.getName().getLocalPart(), element.getName().getNamespaceURI());


Schema example:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://foo.org/schema/test"
            xmlns:tns="http://foo.org/schema/test"
            elementFormDefault="qualified">
    <xsd:complexType name="idType">
        <xsd:sequence>
            <xsd:element name="firstname" type="xsd:string"/>
            <xsd:element name="lastname" type="xsd:string"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="contact">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="id" type="tns:idType"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>


In the instance document generated by SampleXmlUtil, if soap encoding is used, then the generated firstname and lastname elements are not ns qualified. On the other hand, if soap encoding is not used, then the generated firstname and lastname elements are ns qualified as expected.

Thanks,
Jun

_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan