FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


XML Schema validation question (solved)





boinsterman
The following XSD file gives a validation error (in EditX) of
Quote:
The element type "xs:sequence" must be terminated by the matching end-tag "</xs:sequence>".


That condition is met. However, the element "lebels" was at first coded as a complexType when it only needed to be a simpleType. (It is a list of individual label that I mistakenly thought needed a sequence tag.) The error displays seem to show up at those lines of code.

Code:
<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/1999/xlink"
xmlns:xlink="http://www.w3.org/1999/xlink">

<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd" />

  <xs:attributeGroup name="xlinkAttributeGroup"> 
     <xs:attribute name="xlink:type" type="xs:string"/> 
     <xs:attribute name="xlink:href" type="xs:string"/> 
  </xs:attributeGroup> 

  <xs:element name="blog">
      <xs:complexType>
          <xs:sequence>
              <xs:element name="news_item_id" type="xs:string"/>
              <xs:element name="date_written" type="xs:datetime"/>
              <xs:element name="date_submitted" type="xs:date"/>
              <xs:element name="time_submitted" type="xs:time"/>
              <xs:element name="item_body" type="xs:string"/>
       
              <xs:element name="item_title" type="xs:string">
                  <xs:complexType>
                      <xs:attributeGroup ref="xlinkAttributeGroup"/>
                  </xs:complexType>
              </xs:element>
             
              <xs:element name="author" type="xs:string">
                  <xs:complexType>
                      <xs:attributeGroup ref="xlinkAttributeGroup"/>
                  </xs:complexType>
              </xs:element>
       
              <xs:element name="posted_by" type="xs:string">
                  <xs:complexType>
                      <xs:attributeGroup ref="xlinkAttributeGroup"/>
                  </xs:complexType>
              </xs:element>
       
              <xs:element name="labels" type="xs:string"/>
                  <xs:simpleType>
                        <xs:element name="label" type="xs:string"/>
                  </xs:simpleType>
              </xs:element>
 
          </xs:sequence>
      </xs:complexType>
  </xs:element>
 
</xs:schema>


[/quote]
Fire Boar
Your last xs:element block in the xs:sequence is self-closed. Therefore, when XML parses the final </xs:element> tag the top open tag is an xs:sequence tag, hence your error. Just remove the / from the opening tag of the last xs:element block in the xs:sequence and it will parse correctly.
boinsterman
Yeah, I just found it. Now I'm getting a bunch of other errors, but Ill try to work through them before I post another question. I'm a little ahead of myself, anyway. I'm still working on the XSLT.

For those interested, the code for the "labels" element should be:

Code:

              <xs:element name="labels" type="xs:string">
                  <xs:simpleType>
                        <xs:element name="label" type="xs:string"/>
                  </xs:simpleType>
              </xs:element>


I had the opening tag as:

Code:

<xs:element name="labels" type="xs:string"/>


Thanks anyway, Smile
Boinsterman
Related topics
NotePad Replacements
Does mysql have a limited!
[RESOLVED] Is 20 mb too big?
The Next Step?
PHP Question
Let W3C Validate Your website
email question - Solved
PHP Question - Solved
Unix Python Code Execution
Help!! Date question.. (SOLVED)
xml from mysql
How to prepare a true "GOOGLE XML" file - SITEMAP.
Xml coder needed!!!
Help coding a php back end for an xml website! Radio646.com
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.