try.pl is a script that is trying to generate sample.xml which should validate against sample.xsd. I am getting some errors. Guide me if possible.
portion of sample.xsd
<xs:element name="element1" maxOccurs="unbounded">
<xs:complexType>
<xs:SimpleContent> <---- line number of error
<xs:extension base="xs:token">
<xs:attribute name="attrib1" type="xs:token"/>
</xs:extension>
</xs:SimpleContent>
</xs:complexType>
</xs:element>
sample.xml should look:
<elements>
<element1 attrib1="value">abc</element1> <---I am trying to achive this
<element1 attrib1="value">xyz</element1>
</elements>
try.pl which tries to generate sample.xml file:
my $element1 = $doc->createElement('element1');
$element1->setAttribute('attrib1', $family);
insertnode($element1, 'element1', $platformName, 6);
Am I doing something wrong here? How do I add an attribute to an element?
error:
sample.xsd:3: element SimpleContent: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))). WXS schema sample.xsd failed to compile