Jump to content

Single Element with Attribute


hismightiness

Recommended Posts

I need to define a single element that has a single attribute. I am having a brain lapse or something. Can someone help me?What I need to define is this:

<myElement myAttribute="textvalue">123.45</myElement>

And this obviously doesn't work, but would define what I am trying to accomplish:

<xs:element name="myElement" type="xs:decimal" minOccurs="0" maxOccurs="1">	<xs:attribute name="myAttribute" type="xs:string" use="required" /></xs:element>

Link to comment
Share on other sites

Never mind... I most certainly did have a brain lapse. I forgot that Visual Studio has a tool that will show how to define that. Here is the answer for anyone that stumbles upon this later:

<xs:element name="myElement">	<xs:complexType>		<xs:simpleContent>			<xs:extension base="xs:decimal">				<xs:attribute name="myAttribute" type="xs:string" use="required" />			</xs:extension>		</xs:simpleContent>	</xs:complexType></xs:element>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...