Robert Bienert: Datei gegen Schema validieren (Namensraum-Problem)

Beitrag lesen

Moin!

Kann es sein, dass du deinen Namenraum nicht mit angibst ;-)

Wie jetzt?

also statt

<xsd:element name="layout" type="LayoutDefinition" />

muesste es lauten:

<xsd:element name="layout" type="xsd:LayoutDefinition" />

Das glaube ich nicht, denn ändere ich dies (xsd: vor sämtlichen Typ-Namen und Definitionen beschwert sich der Parser:

layout.xsd:21: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType', attribute 'name': 'xsd:LayoutDefinition' is not a valid value of the atomic type 'xs:NCName'.
layout.xsd:48: element simpleType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}simpleType', attribute 'name': 'xsd:MIMEType' is not a valid value of the atomic type 'xs:NCName'.
layout.xsd:72: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType', attribute 'name': 'xsd:FaviconFile' is not a valid value of the atomic type 'xs:NCName'.
layout.xsd:88: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType', attribute 'name': 'xsd:StyleFile' is not a valid value of the atomic type 'xs:NCName'.
layout.xsd:108: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType', attribute 'name': 'xsd:NavFile' is not a valid value of the atomic type 'xs:NCName'.
layout.xsd:125: element simpleType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}simpleType', attribute 'name': 'xsd:NavTypes' is not a valid value of the atomic type 'xs:NCName'.
layout.xsd:136: element simpleType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}simpleType', attribute 'name': 'xsd:NavPositions' is not a valid value of the atomic type 'xs:NCName'.

Der Standard-Namensraum ist ja auch "http://laymansys.sf.net/rdf/layout", d.h. alle Typen, die ich selbst definiere, gehören hierzu (soweit ich XSD verstanden habe).

Verwende ich lediglich xsd: vor den Typ-Angaben, wie in deinem Beispiel, erhalte ich:

layout.xsd:19: element element: Schemas parser error : element decl. '{http://laymansys.sf.net/rdf/layout}layout', attribute 'type': The QName value '{http://www.w3.org/2001/XMLSchema}LayoutDefinition' does not resolve to a(n) type definition.

Liegt das Problem daran, dass ich in der XML-Datei kein Schema referenziere?

Viele Grüße,
Robert