Hi,
ich will das folgende XML (Beispiel) validieren:
Und zwar mit folgendem Schema:
Alles anzeigen
Funktioniert auch wunderbar, solange ich die Attribute src:col und src:key nicht berücksichtige :rolleyes:. Sobald ich versuche mit den Attributen zu validieren, scheiterts an dem src. Wie kann ich also gegen verschieden namespaces validieren?
Wäre super, wenn ihr mir helfen könntet.
Gruß,
Matthias
ich will das folgende XML (Beispiel) validieren:
Quellcode
- <question language="de" stage="0" correct="C" src:col="/db/wwm/questions" src:key="0000000010fe25a90000011960b22717" xmlns:src="http://xml.apache.org/xindice/Query" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="questionSchema.xsd">
- <text>Welcher Buchstabe ist kein Konsonant?</text>
- <A>T</A>
- <B>D</B>
- <C>E</C>
- <D>B</D>
- </question>
Und zwar mit folgendem Schema:
Quellcode
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- XSD for question XML files -->
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:src="http://xml.apache.org/xindice/Query" elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:element name="question" id="question">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="text" id="text">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="160"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- <xs:element name="A" id="A">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="30"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- <xs:element name="B" id="B">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="30"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- <xs:element name="C" id="C">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="30"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- <xs:element name="D" id="D">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="30"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="language" use="required" id="language">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="de"/>
- <xs:enumeration value="en"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="stage" use="required" id="stage">
- <xs:simpleType>
- <xs:restriction base="xs:integer">
- <xs:minInclusive value="0"/>
- <xs:maxInclusive value="14"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="correct" use="required" id="correct">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="A"/>
- <xs:enumeration value="B"/>
- <xs:enumeration value="C"/>
- <xs:enumeration value="D"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="col" use="optional" id="col"/>
- <xs:attribute name="key" use="optional" id="key"/>
- </xs:complexType>
- </xs:element>
- </xs:schema>
Funktioniert auch wunderbar, solange ich die Attribute src:col und src:key nicht berücksichtige :rolleyes:. Sobald ich versuche mit den Attributen zu validieren, scheiterts an dem src. Wie kann ich also gegen verschieden namespaces validieren?
Wäre super, wenn ihr mir helfen könntet.
Gruß,
Matthias