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

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

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="">
	<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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AL3 Files 4 72
configure dependency in POM for new database 3 52
XML error not understood 5 33
Import XML File into MS SQL table 3 12
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System ( introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

751 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