XSD that allows attributes on elements in a sequence

Heaven__

New Member
I want to create an XSD schema that will permit the following XML. I think I have everything except for the attribute on the \[code\]<subsegent>\[/code\] element. Can some one provide a sample XSD? Everything I've tried produces an error.\[code\]<Segment> <Subsegment target="all">This is test 1</Subsegment> <Subsegment target="some">This is test 2</Subsegment></Segment>\[/code\]UPDATEHere is one XSD I tried. I want the elements within the sequence to have attributes. I get this error: "The 'http://www.w3.org/2001/XMLSchema:attribute' element is not supported in this context." from my tool.thanks\[code\]<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ><xsd:complexType name="Segment"> <xsd:sequence> <xsd:element name="Subsegment" minOccurs="1" maxOccurs="unbounded" type="xsd:string"> <xsd:attribute name="target" type="xsd:string" use="required" /> </xsd:element> </xsd:sequence></xsd:complexType></xsd:schema>\[/code\]
 
Back
Top