473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

XML Schema validation problem

Hey, I have a little problem in my XML Schema that ive been thinking for some time but as a beginner I think it would be better that I ask opinions from experts.

So I have this simple xsd file
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"  encoding="utf-8"?>
  2. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  3.  
  4. <xs:complexType name="Henkilokunta">
  5. <xs:sequence>
  6.       <xs:element name="tiskaus" type="xs:string"/>
  7.       <xs:element name="kokki" type="xs:string"/>
  8.       <xs:element name="tarjoilija" type="xs:string"/>
  9.       <xs:element name="Keittio" type="xs:string"/>
  10.       <xs:element name="sihteeri" type="xs:string"/>
  11.       <xs:element name="Toimisto" type="xs:string"/>
  12.       <xs:element name="siivooja" type="xs:string"/>
  13.       <xs:element name="huoltomies" type="xs:string"/>
  14.       <xs:element name="Kiinteistohuolto" type="xs:string"/>
  15.       <xs:element name="IT-tuki" type="xs:string"/>
  16.     </xs:sequence>
  17. </xs:complexType>
  18.  
  19. <xs:element name="Henkilokunta" type="xs:string"/>
  20. </xs:schema>
  21.  
And after some time of work I managed to leave only 1 error, which is following:

cvc-type.3.1.2: Element 'Henkilokunta' is a simple type, so it must have no element information item [children].

I dont understand the problem, because 'Henkilokunta' is my root element.
Mar 23 '12 #1
3 3018
Luuk
1,047 Expert 1GB
After looking at the xsd (and consulting http://www.w3schools.com/schema/schema_howto.asp), i would do this:
Try changing your xsd to:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"  encoding="utf-8"?>
  2. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  3.  
  4. <xs:element name="Henkilokunta">
  5. <xs:complexType>
  6. <xs:sequence>
  7.       <xs:element name="tiskaus" type="xs:string"/>
  8.       <xs:element name="kokki" type="xs:string"/>
  9.       <xs:element name="tarjoilija" type="xs:string"/>
  10.       <xs:element name="Keittio" type="xs:string"/>
  11.       <xs:element name="sihteeri" type="xs:string"/>
  12.       <xs:element name="Toimisto" type="xs:string"/>
  13.       <xs:element name="siivooja" type="xs:string"/>
  14.       <xs:element name="huoltomies" type="xs:string"/>
  15.       <xs:element name="Kiinteistohuolto" type="xs:string"/>
  16.       <xs:element name="IT-tuki" type="xs:string"/>
  17.     </xs:sequence>
  18. </xs:complexType>
  19. </xs:element>
  20.  
  21. </xs:schema>
but i'm not an XSD-expert too ;)
Mar 23 '12 #2
Thank you for responding, but changing this gave me a couple more problems. So my xsd looks exactly like that now, and the errors are following:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'Keittio'. One of '{tiskaus}' is expected.

cvc-type.3.1.2: Element 'Keittio' is a simple type, so it must have no element information item [children].

cvc-type.3.1.2: Element 'Toimisto' is a simple type, so it must have no element information item [children].

and same thing with element 'Kiinteistohuolto'

why it says they are simple type?

EDIT: I added this in the beginning and now I have 1 error again.


<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">

the error is following:

cvc-elt.1.a: Cannot find the declaration of element 'Henkilokunta'

Confused again, as always
Mar 23 '12 #3
Luuk
1,047 Expert 1GB
Thank you for responding, but changing this gave me a couple more problems. So my xsd looks exactly like that now, and the errors are following:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'Keittio'. One of '{tiskaus}' is expected.
so, i think you did not copy it exactly, or made a typing error.....
EDIT: I added this in the beginning and now I have 1 error again.
Because it makes no sence putting that at the beginning. Now it only shows 1 error because it does not understand the rest of your XSD...

Confused again, as always
Confused /me is to.....
Mar 24 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Zandy Marantal | last post by:
Hello everyone, I'm having trouble using Xerces2(2.4, 2.5) when validating against an XML schema if a general entity reference is defined within the XML file. The error I'm getting is this:...
0
by: RockyH | last post by:
Hello, I'm having a problem when trying to use the XmlReader.Create(nodeReader, settings) method to validate an XML document against a schema. The problem is that if there are multiple missing...
2
by: Shone | last post by:
I would like to perform a 2-pass XML reading from a stream. Once using the Validating reader, just to confirm the validity against the schema, and next time to do a reading to extract the data....
3
by: Michael Skulsky | last post by:
Hi all, I've got the following validation problem. There are 2 schemas and a document: ----------------------------------------------------------------- bar.xsd ====== <?xml version="1.0"...
0
by: Ricky Li | last post by:
I went through some article to see how I can add schema validation for my templated control by adding an XSD file into the VS.NET schema folder. Everything works fine for a schema like this: ...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
12
by: steve_marjoribanks | last post by:
I'm fairly new to XML and schemas and I'm trying to work out why a schema I've been given keeps throwing up validation errors in XMLSpy. The section of code with the problem is: ...
3
by: Adam Clauss | last post by:
I'm running into a problem with schema validation. For some reason, if a schema has an xs:all section to it, it does not validate correctly. It seems to treat it as a sequence. My understanding...
1
by: Blue Doze | last post by:
Hello, I have the following XML schema fragment: <xs:complexType name="type.1"> <xs:simpleContent> <xs:restriction base="ns:type"> <xs:simpleType> <xs:restriction...
0
by: kenkejas | last post by:
Hello public, Got a problem. While generating proxy classes getting warnings: Schema Validation Errors: Error compiling schema. WSDL descriptor is public:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.