I am pretty new to xsd. I have also found a lot of questions on the Q&A but non was able to solve my problem. I have an html file which I want to validate using xsd validation. The standard am using is http://www.ihe.net/uploadedFiles/Documents/Radiology/IHE_RAD_Suppl_MRRT.pdf. And it says that the way the html files are formatted, it should be possible to validate it using any xml validator. Note this question XSD for same tag different attribute names, is kind of close but not what i want. Here is the section of the html i want to validate
<!DOCTYPE html>
<html>
<head>
<tittle>Hello World</title>
<meta charset="UTF-8"/>
<meta name="d1" content="c1"/>
<meta name="d2" content="c2"/>
</head>
</html>
The standard says there must be exactly 1 meta tag with attribute charset, and zero or more with attributes name, and content. So i tried to make the following xsd files.
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="html">
<xs:complextType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="meta">
<xs:complexType>
<xs:attribute name="charset" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- obviously this wouldn't work -->
<xs:element name="meta" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="content" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Obviously the schema above will not work due to the repetition of the meta element. I get a mutliple elements error. So i tried to rap the other meta tags in a group element like below, but even that did not work.
<xs:group name="otherMetatags">
<xs:element name="meta" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="content" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:group>
</xs:schema>
I know my two approaches seem to be stupid, but like I earlier said, am new to xsd.