Skip to Content
0

How to add namespace to xsd ?

Mar 06, 2017 at 09:47 AM

26

avatar image

i have Structure in Wsdl like:

<ns0:Root>

<header>

</A>

</header>

<Body>

</B>

</Body>

<ns0:/Root>

How to generate xsd with namespace.

Regards,

Aditya

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Sriprasad Shivaram Bhat Mar 06, 2017 at 10:00 AM
0

Hello Aditya,

You have to set below two parameters in your XSD which will make your XSD fully qualified.

attributeFormDefault="qualified" elementFormDefault="qualified"

XML:

<ns0:Root xmlns:ns0="http://test.com">
    <ns0:Header>
        <ns0:H1>Hii</ns0:H1>
    </ns0:Header>
    <ns0:Record>
        <ns0:R1>Hello</ns0:R1>
    </ns0:Record>
</ns0:Root>

XSD:

<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://test.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Root">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Header">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element type="xs:string" name="H1"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="Record">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element type="xs:string" name="R1"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

Regards,

Sriprasad Shivaram Bhat

Share
10 |10000 characters needed characters left characters exceeded