sulmanpucit
sulmanpucit

Reputation: 456

XSD small help required

I am in need to small. I am having hard time in mapping manually xml schema to simple xml structure. Any one expert in xml can solve my problem in not more than 2 minutes and trust me you can save my life.

Here is schema in xsd.

https://rapidshare.com/files/688147446/schema.zip

In import_customers_request.xsd file we have this element

<xs:element name="customer" type="COCustomerDetail" minOccurs="0" maxOccurs="unbounded"/>

Which have details in file coTypes.xsd

I am not so good in xml so what i have discovered so far is followong xml structure.

<import_customers_request schemaVersion="5.5">

    <customers>

    <customer>
    <useBillingCodeIdentifier>false</useBillingCodeIdentifier>
    <useShippingCodeIdentifier>false</useShippingCodeIdentifier>
    <companyName>Tech Max</companyName>
    <contact>

    <firstName>Sohaib</firstName>
    <lastName>Rajpoot</lastName>
    <email>suhaibpucit\@yahoo.com</email>

    </contact>
    </customer>
    </customers>
    </import_customers_request>

Now i just want two more fields.

  1. Address
  2. Password

can you please refine this structure with good place for these fields as well. I will be truly thankful to you for you time and help.

Upvotes: 0

Views: 89

Answers (2)

Petru Gardea
Petru Gardea

Reputation: 21638

Before changing, you may consider checking on what you have already in your message. I am saying this simply because you may have overlooked, in your "discovery", some of the content. It is a good idea to check the documentation, so that the meaning matches...

Password:

Password

Address Information seems to start with addressLine1 and go for a couple more fields.

Address

Regardless, if you wish to modify the XSD, I would suggest to be consistent. For example, this is what you have as a model in your XSD for password:

<xs:element name="password" minOccurs="0">
    <xs:annotation>
        <xs:documentation> password is of course mandatory on any request message it may not be echoed on responses </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:minLength value="3"/>
            <xs:maxLength value="20"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>

It is always advisable to use a tool for analysis and visualization of XSDs. For example, going across all your XSDs, you can search for patterns such as addr or passw.

Finding XSD content in QTAssistant XSR

Then "zooming in" the use of COAddress may yield its use in various components, and how they related to global content (root elements, types, etc.); this is where you can see its trace back to your root element.

XSD Dependencies diagram

Upvotes: 2

MiMo
MiMo

Reputation: 11953

To add the password as a string with maximum lenght 80 represented as an element:

<xs:complexType name="COCustomer">
  <xs:complexContent>
     <xs:extension base="COAddress">
        <xs:sequence>
           <xs:element name="password">
             <xs:simpleType>
                <xs:restriction base="xs:string">
                   <xs:maxLenght value="80"/>
                </xs:restriction>
              <xs:simpleType/>
           </xs:element>
     . . . .

in this case it will be the first element within customer - you can move it down of course.

Same thing to add address to COContact . . .

Upvotes: 1

Related Questions