Solved

How can I add an attribute to a sequence element in an XSD document?

Posted on 2008-10-23
3
246 Views
Last Modified: 2012-05-05
I currently have an XSD document that gives me the following except for the password attribute Type="PasswordDigest".  Can someone tell me how to add this with my existing xsd?

<?xml version="1.0" encoding="utf-8"?>
<Message xmlns="http://www.surescripts.com/messaging">
            <Header>
                        <To>testsite</To>
                        <From>testsite</From>
                        <MessageID>4654664</MessageID>
                        <SentTime>2008-10-09T19:03:37.9Z</SentTime>
                        <Security>
                                    <UsernameToken>
                                                <Username>testname</Username>
                                                <Password Type="PasswordDigest">testpassword</Password>
                                                <Nonce>2254</Nonce>
                                                <Created>2008-10-09T19:03:37.9Z</Created>
                                    </UsernameToken>
                        </Security>
            </Header>
            <Body>
                        <DirectoryDownload>
                                    <AccountID>444</AccountID>
                                    <VersionID>4</VersionID>
                                    <Taxonomy>
                                                <TaxonomyCode>183500000X</TaxonomyCode>
                                    </Taxonomy>
                        </DirectoryDownload>
            </Body>
</Message>



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

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

	<xs:element name="Message">

		<xs:complexType>

			<xs:sequence>

				<xs:element ref="Header" minOccurs="0"/>

				<xs:element ref="Body" minOccurs="0"/>

			</xs:sequence>

		</xs:complexType>

	</xs:element>

	<xs:element name="Header">

		<xs:complexType>

			<xs:sequence>

				<xs:element ref="To" minOccurs="0" />

				<xs:element ref="From" minOccurs="0"/>

				<xs:element ref="MessageID" minOccurs="0"/>

				<xs:element ref="SentTime" minOccurs="0"/>

				<xs:element ref="Security" minOccurs="0"/>

			</xs:sequence>

		</xs:complexType>

	</xs:element>

	<xs:element name="Body">

		<xs:complexType>

			<xs:sequence>

				<xs:element ref="DirectoryDownload" minOccurs="0"/>

			</xs:sequence>

		</xs:complexType>

	</xs:element>

	<xs:element name="Security">

		<xs:complexType>

			<xs:sequence>

				<xs:element ref="UsernameToken" minOccurs="0" />

			</xs:sequence>

		</xs:complexType>

	</xs:element>	

	<xs:element name="UsernameToken">

		<xs:complexType>

			<xs:sequence>

				<xs:element ref="Username" minOccurs="0" />

				<xs:element ref="Password" minOccurs="0" />   

				<xs:element ref="Nonce" minOccurs="0" />

				<xs:element ref="Created" minOccurs="0" />

			</xs:sequence>

		</xs:complexType>

	</xs:element>	

	<xs:element name="DirectoryDownload">

		<xs:complexType>

			<xs:sequence>

				<xs:element ref="AccountID" minOccurs="0" />

				<xs:element ref="VersionID" minOccurs="0" />

				<xs:element ref="Taxonomy" minOccurs="0" />

				<xs:element ref="DirectoryDate" minOccurs="0" />

			</xs:sequence>

		</xs:complexType>

	</xs:element>	

	<xs:element name="Taxonomy">

		<xs:complexType>

			<xs:sequence>

				<xs:element ref="TaxonomyCode" minOccurs="0" />

			</xs:sequence>

		</xs:complexType>

	</xs:element>		

	<xs:element name="To" type="xs:string"/>

	<xs:element name="From" type="xs:string"/>

	<xs:element name="MessageID" type="xs:string"/>

	<xs:element name="SentTime" type="xs:string"/>

	<xs:element name="Username" type="xs:string"/>

	<xs:element name="Password" type="xs:string"/>

	<xs:element name="Nonce" type="xs:string"/>

	<xs:element name="Created" type="xs:string"/>

	<xs:element name="AccountID" type="xs:string"/>

	<xs:element name="VersionID" type="xs:string"/>

	<xs:element name="TaxonomyCode" type="xs:string"/>

	<xs:element name="DirectoryDate" type="xs:string"/>

</xs:schema>

Open in new window

0
Comment
Question by:cindymccartney
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 22795165
you will need a complexType/simpleContent in your definition for password

    <xs:element name="Password">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="Type"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>

instead of

      <xs:element name="Password" type="xs:string"/>
0
 

Author Closing Comment

by:cindymccartney
ID: 31509459
Thanks!
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22798678
welcome
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now