472,365 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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:annotation>
<xs:documentation>
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:documentation>
</xs:annotation>
</xs:import>

<xs:element name="personnel">
<xs:complexType>
<xs:sequence>
<xs:element ref="person" minOccurs='1' maxOccurs='unbounded'/>
</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='unbounded'/>
<xs:element ref="url" minOccurs='0' maxOccurs='unbounded'/>
<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:simpleType>
<xs:restriction base = "xs:string">
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="salary" type="xs:integer"/>
<xs:anyAttribute 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:anyAttribute namespace="http://www.w3.org/XML/1998/namespace"
processContents="skip"/>
</xs:complexType>
</xs:element>

<xs:element name="family">
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:anyAttribute
namespace="http://www.w3.org/XML/1998/namespace"
processContents="skip"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>

<xs:element name="given" >
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:anyAttribute
namespace="http://www.w3.org/XML/1998/namespace"
processContents="skip"/>
</xs:extension>
</xs:simpleContent>
</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="subordinates" type="xs:IDREFS"/>
</xs:complexType>
</xs:element>

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

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

Regards,
Ciaran.

Nov 23 '05 #1
3 2630
ci***********@iona.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.*******@comcast.net
================================================== ======================
Nov 23 '05 #3
ci***********@iona.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
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...
0
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...
1
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...
2
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>...
0
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. ...
1
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...
4
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...
1
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...
2
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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.