This week's book giveaway is in the
Agile and other Processes
forum.
We're giving away four copies of
The Mikado Method
and have Ola Ellnestam and Daniel Brolund on-line!
See
this thread
for details.
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Engineering
»
XML and Related Technologies
Author
xml validation failure
Satya Maheshwari
Ranch Hand
Joined: Jan 01, 2007
Posts: 368
posted
Oct 25, 2008 05:50:00
0
I have the following XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.netbeans.org/schema/Emp" xmlns:emp="http://xml.netbeans.org/schema/Emp" elementFormDefault="qualified"> <xsd:complexType name="Employee"> <xsd:sequence> <xsd:element name="Name" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema>
And the following xml
<?xml version="1.0" encoding="UTF-8"?> <emp:Employee xmlns:emp="http://xml.netbeans.org/schema/Emp" > <Name>satya deep</Name> </emp:Employee>
If I try to validate the xml with the above xsd, I get this error:
XML validation started. Checking file:/usr/sdm/DemoJavaApplication/xml/EmpDB.xml... cvc-elt.1: Cannot find the declaration of element 'emp:Employee'. [11] XML validation finished.
Could you please help?
Thanks and Regards
Satya Maheshwari
Ranch Hand
Joined: Jan 01, 2007
Posts: 368
posted
Oct 25, 2008 06:13:00
0
Found the problem. I did not have any element in the xsd. I corrected it to:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.netbeans.org/schema/Emp" xmlns:emp="http://xml.netbeans.org/schema/Emp" elementFormDefault="qualified"> <xsd:complexType name="Employee"> <xsd:sequence> <xsd:element name="Name" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:element name="employee" type="emp:Employee"></xsd:element> </xsd:schema>
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: xml validation failure
Similar Threads
XSD problem
Question about xml schemas and the use of unqualified nested elements
Against what schemas validate themselves?
xsd unique identity constraint (parent and child)
jaxb binding rror confused
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter