2016-10-29 3 views
1

Probleme mit XML-Schema. Es verursacht einen Validierungsfehler, und ich frage mich, was das Problem ist.Auf den Elementtyp "xs: element" müssen die Attributspezifikationen ">" oder "/>" folgen.

<?xml version="1.0" encoding="UTF-8"?> 
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
     <xs:element name="row"> 
     <xs:complexType> 
      <xs:sequence> 
      <xs:element type="xs:string" name="abstract"/> 
      <xs:element type="xs:string" name="bibliography"/> 
      <xs:element type="xs:string" name="catno"/> 
      <xs:element type="xs:string" name="citation"/> 
      <xs:element type="xs:string" name="copyrightnotice"/> 
      <xs:element type="xs:string" name="description"/ minOccurs="0" maxOccurs="unbounded"/> 
      <xs:element type="xs:string" name="image"/> 
      <xs:element type="xs:string" name="metadatamodificationdate"/> 
      <xs:element type="xs:byte" name="pagetotal"/> 
      <xs:element type="xs:string" name="publisher"/> 
      <xs:element type="xs:string" name="publishercity"/> 
      <xs:element type="xs:string" name="publishercountry"/> 
      <xs:element type="xs:string" name="sponsor"/> 
      <xs:element type="xs:string" name="title"/> 
      <xs:element type="xs:string" name="titlelargerentity"/> 
      <xs:element type="xs:float" name="datemonth"/> 
      <xs:element type="xs:string" name="datetype"/> 
      <xs:element type="xs:float" name="dateyear"/> 
      <xs:element type="xs:string" name="era"/> 
      <xs:element type="xs:string" name="language" minOccurs="0" maxOccurs="unbounded"/> 
      </xs:sequence> 
      <xs:attribute type="xs:byte" name="modid"/> 
      <xs:attribute type="xs:short" name="recordid"/> 
     </xs:complexType> 
     </xs:element> 
    </xs:schema> 

Was ist das Problem mit den xsd:schema im Code? Fehlt etwas? Es ist nicht gültig aufgrund der Linie 2?

Antwort

2

Dieser Fehler tritt auf, wenn eine Elementdeklaration schlecht gebildet wird. Suchen Sie nach Zeichen oder Schlüsselwörtern, die nicht in eine Elementdeklaration gehören.

In Ihrem Fall haben Sie eine streunende / in der Deklaration description.

ändern

<xs:element type="xs:string" name="description"/ minOccurs="0" maxOccurs="unbounded"/> 

zu

<xs:element type="xs:string" name="description" minOccurs="0" maxOccurs="unbounded"/> 

und Sie werden den Fehler zu beseitigen.

Verwandte Themen