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

Posted on 2008-10-23
Medium Priority
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">
                                                <Password Type="PasswordDigest">testpassword</Password>

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="Message">
				<xs:element ref="Header" minOccurs="0"/>
				<xs:element ref="Body" minOccurs="0"/>
	<xs:element name="Header">
				<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:element name="Body">
				<xs:element ref="DirectoryDownload" minOccurs="0"/>
	<xs:element name="Security">
				<xs:element ref="UsernameToken" minOccurs="0" />
	<xs:element name="UsernameToken">
				<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:element name="DirectoryDownload">
				<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:element name="Taxonomy">
				<xs:element ref="TaxonomyCode" minOccurs="0" />
	<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"/>

Open in new window

Question by:cindymccartney
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 60

Accepted Solution

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

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

instead of

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

Author Closing Comment

ID: 31509459
LVL 60

Expert Comment

by:Geert Bormans
ID: 22798678

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

718 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