Hallo zusammen,
ich habe eine xml Datei erstellt, die (hoffentlich
) syntaktisch korrekt ist. Der Namespace soll so gewählt sein:
Jetzt will ich das ganze mit einem Schema validieren und hab mal eines erstellt, das aber noch nicht ganz fertig ist:
Wenn ich das jetzt mit http://www.xmlme.com/Validator.aspx validieren will sagt er immer "The targetNamespace parameter '' should be the same value as the targetNamespace 'urn: person' of the schema." usw
Was ist an meiner Datei falsch? Danke für Tipps, bin noch xml Neuling
Viele Grüße
Tobias
ich habe eine xml Datei erstellt, die (hoffentlich

Code:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="person.xslt" ?>
<p:person xmlns:p="urn:person">
<p:name>
<p:prename>Tobias</p:prename>
<p:surname>Zepf</p:surname>
</p:name>
<p:personaldata>
<p:birthday>xxx</p:birthday>
<p:adress>
<p:street>xxx</p:street>
<p:plz>xxx</p:plz>
<p:city>Karlsruhe</p:city>
</p:adress>
<p:email>xxx</p:email>
<p:phone>xxx</p:phone>
<p:fax></p:fax>
<p:referencehomepage>xxx</p:referencehomepage>
</p:personaldata>
<p:misc>
<p:hobby>Tennis</p:hobby>
<p:hobby>Homepages erstellen</p:hobby>
<p:hobby>Skifahren</p:hobby>
<p:favouriteteam>Karlsruher SC</p:favouriteteam>
<p:study>
<p:studypath>Informatik (Diplom)</p:studypath>
<p:semester>7</p:semester>
</p:study>
</p:misc>
</p:person>
Code:
<?xml version="1.0"?>
<xs:schema id="person"
targetNamespace="urn:person"
xmlns:mstns="urn:person"
xmlns="urn:person"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified"
elementFormDefault="qualified">
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="name">
<xs:complexType>
<xs:sequence>
<xs:element name="prename" type="xs:string" minOccurs="0" />
<xs:element name="surname" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="personaldata">
<xs:complexType>
<xs:sequence>
<xs:element name="birthday">
<xs:complexType>
<xs:attribute name="birthday">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:pattern value="([0][1-9]|[12][0-9]|[3][01])\.([0][1-9]|[1][12])\.([0-2][0-9][0-9][0-9])"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="adress">
<xs:complexType>
<xs:sequence>
<xs:element name="street" type="xs:string" />
<xs:element name="plz" type="xs:unsignedInt" />
<xs:element name="city" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="email" type="xs:string" />
<xs:element name="phone" type="xs:string" />
<xs:element name="fax" />
<xs:element name="referencehomepage" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="misc">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="hobby" type="xs:string" />
<xs:element name="favouriteteam" type="xs:string" />
<xs:element name="study">
<xs:complexType>
<xs:sequence>
<xs:element name="studypath" type="xs:string" />
<xs:element name="semester" type="xs:unsignedByte" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Was ist an meiner Datei falsch? Danke für Tipps, bin noch xml Neuling

Viele Grüße
Tobias
Zuletzt bearbeitet: