Jump to content
ReddetEkim

Newbie Schema Validation Errors

Recommended Posts

Hi. I'm new to XML/Schema. I'm trying to learn a little bit about it for my own information and maybe to incorporate it into a web page. It seems correct to me but almost everything I try ends up with an error. Could someone please tell me what I'm doing wrong? Thanks a lot for any assistance. XML Schema:

<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="[url="http://www.w3.org/2001/XMLSchema"]http://www.w3.org/2001/XMLSchema[/url]">  <xs:element name="root_element">    <xs:complexType>	  <xs:sequence>	    <xs:element name="president">		  <xs:complexType>		    <xs:sequence>			  <xs:element name="first_name" type="xs:string"/>			  <xs:element name="last_name" type="xs:string"/>		    </xs:sequence>		  </xs:complexType>	    </xs:element>	  </xs:sequence>    </xs:complexType>  </xs:element></xs:schema>

XML Data:

<?xml version="1.0" encoding="UTF-8"?><root_element xmlns:xsi="[url="http://www.w3.org/2001/XMLSchema-instance"]http://www.w3.org/2001/XMLSchema-instance[/url]"xsi:noNamespaceSchemaLocation="test.xsd"><root_element><president><first_name>George</first_name><last_name>Washington</last_name></president><president><first_name>John</first_name><last_name>Adams</last_name></president></root_element>

Errors without <root_element> in xml file:The following errors were found: TYPE LOC MESSAGE Validation 8, 12 cvc-complex-type.2.4.d: Invalid content was found starting with element 'president'. No child element is expected at this point. Well Formed 11, 13 XML document structures must start and end within the same entity. Errors with <root_element> in XML file:The following errors were found: TYPE LOC MESSAGE Validation 4, 15 cvc-complex-type.2.4.a: Invalid content was found starting with element 'root_element'. One of '{president}' is expected. Validation 9, 12 cvc-complex-type.2.4.d: Invalid content was found starting with element 'president'. No child element is expected at this point. Well Formed 13, 16 XML document structures must start and end within the same entity.

Share this post


Link to post
Share on other sites

I think one of my problems was a missing </xs:element> since I have two simple elements. But then I got the following error: The following errors were found: TYPE LOC MESSAGE Well Formed 14, 11 The element type "xs:sequence" must be terminated by the matching end-tag "‹/xs:sequence>". I thought I had everything matched up. Sheesh!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...