473,574 Members | 3,172 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot validate a ".xsd" file (Xerces 2.7.0 C++ on Windows XP)

Hi folks,

I downloaded the binary version of Xerces C++ 2.7.0 for Windows and am
using it to help me get up to speed with XML and XML Schema. So please
excuse me if this is a "novice" question.

In the samples/data directory, I ran the following command for all the
files:

DOMPrint -n -s -f -v=always <filename>

The above command worked for the two ".xml" files. So far, so good.

The above command failed for the ".dtd" files. This is fine because a
".dtd" file is *not* in XML format.

What confuses me is that the above command failed for the ".xsd" file.
The file is "well formed", as I can see if I run DOMPrint on it
*without* the schema validation options. However, when I use the schema
validation options then DOMPrint complains about 128 "validity" errors.

This surprises me because I was expecting to be able to use a
validating
parser (such as Xerces) to validate schemas as well as schema
instances.

Am I doing something wrong? Is there a mistake in the ".xsd" document?
Is there a bug in Xerces?

I am including the ".xsd" file below for people who do not have Xerces
C++.

----start of .xsd file----
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>

<xs:import namespace="http ://www.w3.org/XML/1998/namespace">
<xs:annotatio n>
<xs:documentati on>
The schemaLocation of the relevant file is
"http://www.w3.org/2001/xml.xsd"; however,
we don't want to assume people are always
connected to the 'net when playing with this file.
</xs:documentatio n>
</xs:annotation>
</xs:import>

<xs:element name="personnel ">
<xs:complexType >
<xs:sequence>
<xs:element ref="person" minOccurs='1' maxOccurs='unbo unded'/>
</xs:sequence>
</xs:complexType>

<xs:unique name="unique1">
<xs:selector xpath="person"/>
<xs:field xpath="name/given"/>
<xs:field xpath="name/family"/>
</xs:unique>
<xs:key name='empid'>
<xs:selector xpath="person"/>
<xs:field xpath="@id"/>
</xs:key>
<xs:keyref name="keyref1" refer='empid'>
<xs:selector xpath="person"/>
<xs:field xpath="link/@manager"/>
</xs:keyref>

</xs:element>

<xs:element name="person">
<xs:complexType >
<xs:sequence>
<xs:element ref="name"/>
<xs:element ref="email" minOccurs='0' maxOccurs='unbo unded'/>
<xs:element ref="url" minOccurs='0' maxOccurs='unbo unded'/>
<xs:element ref="link" minOccurs='0' maxOccurs='1'/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use='required'/>
<xs:attribute name="note" type="xs:string "/>
<xs:attribute name="contr" default="false" >
<xs:simpleTyp e>
<xs:restricti on base = "xs:string" >
<xs:enumerati on value="true"/>
<xs:enumerati on value="false"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="salary" type="xs:intege r"/>
<xs:anyAttribut e namespace="http ://www.w3.org/XML/1998/namespace"
processContents ="skip"/>
</xs:complexType>
</xs:element>

<xs:element name="name">
<xs:complexType >
<xs:all>
<xs:element ref="family"/>
<xs:element ref="given"/>
</xs:all>
<xs:anyAttribut e namespace="http ://www.w3.org/XML/1998/namespace"
processContents ="skip"/>
</xs:complexType>
</xs:element>

<xs:element name="family">
<xs:complexType >
<xs:simpleConte nt>
<xs:extension base='xs:string '>
<xs:anyAttribut e
namespace="http ://www.w3.org/XML/1998/namespace"
processContents ="skip"/>
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
</xs:element>

<xs:element name="given" >
<xs:complexType >
<xs:simpleConte nt>
<xs:extension base='xs:string '>
<xs:anyAttribut e
namespace="http ://www.w3.org/XML/1998/namespace"
processContents ="skip"/>
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
</xs:element>

<xs:element name="email" type='xs:string '/>

<xs:element name="url">
<xs:complexType >
<xs:attribute name="href" type="xs:string " default="http://"/>
</xs:complexType>
</xs:element>

<xs:element name="link">
<xs:complexType >
<xs:attribute name="manager" type="xs:IDREF"/>
<xs:attribute name="subordina tes" type="xs:IDREFS "/>
</xs:complexType>
</xs:element>

<xs:notation name='gif' public='-//APP/Photoshop/4.0'
system='photosh op.exe'/>

</xs:schema>
----end of .xsd file----

Regards,
Ciaran.

Nov 23 '05 #1
3 2752
ci***********@i ona.com wrote:
Hi folks,

[cut]

You should not post all your xml xsd here,

just look at the message Xalan gives you..
the message will help you locate the problem.
Nov 23 '05 #2
FWIW, I have never gotten the Java version of Xerces (included in the
Sun JRE) to validate a schema.

--
=============== =============== =============== =============== ============
Ian Pilcher i.*******@comca st.net
=============== =============== =============== =============== ============
Nov 23 '05 #3
ci***********@i ona.com wrote:
Hi folks,

I downloaded the binary version of Xerces C++ 2.7.0 for Windows and am
using it to help me get up to speed with XML and XML Schema. So please
excuse me if this is a "novice" question.

In the samples/data directory, I ran the following command for all the
files:

DOMPrint -n -s -f -v=always <filename>

The above command worked for the two ".xml" files. So far, so good.

The above command failed for the ".dtd" files. This is fine because a
".dtd" file is *not* in XML format.
Strictly speaking, a DTD *is* in XML format -- but it uses XML
Declaration Syntax, not XML Document Syntax. A DTD can't therefore
be validated in the same way as an XML document, but it can be checked
for syntax simply by creating a dummy document instance and running
that through software containing a validating parser.
What confuses me is that the above command failed for the ".xsd" file.
The file is "well formed", as I can see if I run DOMPrint on it
*without* the schema validation options. However, when I use the
schema validation options then DOMPrint complains about 128 "validity"
errors.

This surprises me because I was expecting to be able to use a
validating parser (such as Xerces) to validate schemas as well
as schema instances.

Am I doing something wrong? Is there a mistake in the ".xsd" document?
Is there a bug in Xerces?


I can't speak for Xerces, but the XSD file you posted validates with
the DTD for Schemas.

///Peter
--
XML FAQ: http://xml.silmaril.ie/

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3616
by: JavaDeveloper | last post by:
Is it possible to reference another XSD file within an XSD file? What I'd like to do is have a fairly static XSD file which contains an element whose valid values change often reference a 2nd XSD file which specifies the valid values for that element. This way I could set up a process that reads the valid values for the element from a database...
0
2708
by: Stacey | last post by:
I hate to start the email with the "I'm new to this clause", but there it is. I am understanding how the xsd files work and how the castor SourceGenerator works. What I am not understanding is how the binding of a complexType to another package in java works. Basically I have in my .xsd file: <xs:schema...
1
4059
by: Vitor Rodrigues | last post by:
Hi!! I have a little problem i'm trying to resolve. I've a .xml and it's schema (.xsd). i need to create a XSL file to transform the XML one, but i only now what data types the .xml file has by reading the ..xsd one. There are some examples related with that? An example is:
2
3846
by: jacksuyu | last post by:
For example the XML looks like: <SOAP-ENV:Body> <samlp:Response InResponseTo="abcd" IssueInstant="2005-02-03T20:18:06Z" MajorVersion="1" MinorVersion="0" ResponseID="abcd"> <samlp:Status> <samlp:StatusCode Value="samlp:Success"/>
0
1379
by: heiko | last post by:
Hi, I have written a program for parsing XML data with Xerces and C++. There are still two things, for which I need help: I want to validate a XML file with a schema, given by my xsd-file. I receive the XML data via network. Now, I write the data I receive into a file and then parse it with parseURI(), but I want to parse the XML data...
1
2929
by: Jonathan Gibbs | last post by:
I'm very new to xml, and struggling a bit.. I want to use an .xsd file passed to a windows application to define a dataset's schema, and also (if possible) pass other metadata associated with given elements of the schema (tables and columns) that the application also requires. I've guessed that Annotations are a way to do this, so added...
4
5049
by: A. Gonzalez | last post by:
Hi everyone, Does anyone know how to instantiate, or create an XML document file (either using DOM or Readers) from an XML schema (xsd) file? I'm trying to develop an application that can handle different xml doc structures, but at the same time I need to create these documents, even if there's no content. So I was planning to drive it...
1
13007
by: archana | last post by:
Hi all, Can anyone tell me how to generate xsd file dynamically for datatable. And then how to create datatable from that dynamically generated xsd file. I want to generate datatable from this dynamically generated xsd file. Can anyone tell how to do this? means how to generate xsd file dynamically with for some column default value. ...
2
5840
by: ERingmae | last post by:
Hi, The environment is .NET 2.0, the language is C# and the problem is reading XSD file with xs:redefine section correctly to a XMLDataDocument.DataSet. What I am trying to do: I am trying to create a DataSet object from an XSD file by using XMLDataDocument class.
0
7805
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7726
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8098
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6452
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5620
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5300
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3740
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3749
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1060
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.