Sorry, I guess my examples were a little confusing. They are correct, I
(Bjust
(Bwanted to show what my problem was. The new example is different from my
(Bproblem. I know that in my example it seems that specifying ns2.xsd in the
(BschemaLocation would be the correct solution. However, I have a C++
(Bapplication (which uses Xerces-C) with its XML data. I wrote a Java
(Bversion
(Bof the same application (with Xerces-J), but got an error and couldn't
(Bfigure
(Bout why so I have sent these e-mails for some help. I guess this is due to
(Bthe
(Bimplementation matter differences which Bob and Jeff have kindly been
(Bexplaining.
(B
(B>From: [EMAIL PROTECTED]
(B>Reply-To: [EMAIL PROTECTED]
(B>To: [EMAIL PROTECTED]
(B>Subject: Re: Schema validation using multiple schemas
(B>Date: Tue, 26 Aug 2003 18:13:02 -0400
(B>
(B>
(B>It seems to me that what was primarily wrong with your first example was a
(B>confusion of the depencies. (I'm going to assume that the intention was
(Bfor
(B>ns2:report to be defined to contain ns1:textData--from your new example I
(B>assume you've gotten past that problem.) While ns2:report seems to be
(B>intended to depend on ns1:textData, your xsd importing implies the
(Bopposite
(B>dependency: ns1.xsd imports ns2.xsd when ns2.xsd should import
(B>ns1.xsd....and test.xml should point to ns2.xsd for its schemaLocation.
(B>
(B>Eric
(B>
(B>
(B>
(B>
(B>
(B>
(B> "Adachi Seiichi"
(B> <[EMAIL PROTECTED] To:
(B[EMAIL PROTECTED]
(B> otmail.com> cc:
(B> Subject: Re: Schema
(Bvalidation using multiple schemas
(B> 08/26/2003 08:15
(B> AM
(B> Please respond to
(B> xerces-j-user
(B>
(B>
(B>
(B>
(B>
(B>
(B>Bob, Jeff,
(B>
(B>Thank you for your replies.
(B>
(B>I have 2 questions.
(B>
(B>1. I understand that there may be a need to specify schema#2 in the
(B>xsi:SchemaLocation of the XML file. However, for a more complex XML
(B>schema, wouldn't this mean that you would have to specify all the
(B>schemas in each XML file?
(B>
(B>Yes, this problem can be resolved if you specify the location of schema#2
(B>in
(B>the XML file. However, the XML schemas for my application will be more
(B>complex and I do not want to specify all the schemas that are involved.
(B>
(B>I am not that familiar with XML but it was my understanding that when
(B>creating an XML file, you do not need to specify the location of all the
(B>schema files that are declared as namespaces inside the XML file, if
(B>they are defined (imported) by the schemas that are specified in the
(B>xsi:schemaLocation of the XML file. At least, that is what it said in
(B>the 2 XML Schema books I have here. (Sorry, they are in Japanese)
(B>I guess this maybe wrong. To confirm the specification on
(B><xsi:schemaLocation> and <xsd:import> when using multiple namespaces, I
(B>have been looking at the w3c documents and searching the web, but have
(B>not found a clear answer on this topic. Is this specified somewhere?
(B>
(B>2. This relates to question#1, but Xerces-J 2.5.0 is able to
(B>resolve the location of imported schema if it is not the root element.
(B>For example :
(B>
(B>test2.xml
(B>---------
(B><book xmlns='http://foo.com/namespace3'
(B> xmlns:ns4='http://foo.com/namespace4'
(B> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
(B> xsi:schemaLocation='http://foo.com/namespace3 ns3.xsd'>
(B> <ns4:chapter>sample XML file</ns4:chapter>
(B></book>
(B>
(B>ns3.xsd
(B>-------
(B><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
(B> targetNamespace="http://foo.com/namespace3"
(B> xmlns="http://foo.com/namespace3"
(B> xmlns:ns4="http://foo.com/namespace4"
(B> elementFormDefault="qualified">
(B>
(B> <xsd:import namespace="http://foo.com/namespace4"
(B> schemaLocation="ns4.xsd" />
(B>
(B> <xsd:element name="book">
(B> <xsd:complexType>
(B> <xsd:sequence>
(B> <xsd:element ref="ns4:chapter"/>
(B> </xsd:sequence>
(B> </xsd:complexType>
(B> </xsd:element>
(B>
(B></xsd:schema>
(B>
(B>ns4.xsd
(B>-------
(B><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
(B> targetNamespace="http://foo.com/namespace4"
(B> xmlns="http://foo.com/namespace4"
(B> elementFormDefault="qualified">
(B>
(B> <xsd:element name="chapter" type="xsd:string"/>
(B>
(B></xsd:schema>
(B>
(B>Since this file is validated correctly, I had assumed Xerces-J 2.5.0
(B>supports these kind of files. Is there any possibility that unable to
(B>resolve it in the case of the root element is a bug? (I know they are
(B>implemented differently but just as a note, Xerces-C 2.3.0 did not
(B>return any errors.) Or is this strictly an implementation dependent
(Bmatter?
(B>
(B>Thanks,
(B>
(B>Seiichi
(B>
(B>
(B>
(B> >From: "Jeff Greif" <[EMAIL PROTECTED]>
(B> >Reply-To: [EMAIL PROTECTED]
(B> >To: <[EMAIL PROTECTED]>
(B> >Subject: Re: Schema validation using multiple schemas
(B> >Date: Mon, 25 Aug 2003 06:51:45 -0700
(B> >
(B> >Probably xerces proceeds like this:
(B> >
(B> >Xerces must be able to directly locate the schema for the namespace of
(Bthe
(B> >root element. It does not read schema#1 (for a seemingly irrelevant
(B> >namespace) in the hopes of finding the location of schema#2. If schema
(B>#1
(B> >is in the schemaLocation attribute of the instance document, it should
(B>work.
(B> >You can include both schemas there if you choose.
(B> >
(B> >This is not redundant with the import element in schema#1. That import
(Bis
(B> >required in order to make it legal to refer in schema#1 to items from
(B> >schema#2.
(B> >
(B> >Jeff
(B> >
(B> >
(B> >----- Original Message -----
(B> >From: "Adachi Seiichi" <[EMAIL PROTECTED]>
(B> >To: <[EMAIL PROTECTED]>
(B> >Sent: Monday, August 25, 2003 1:39 AM
(B> >Subject: Schema validation using multiple schemas
(B> >
(B> >
(B> > > Hi All,
(B> > >
(B> > > I am trying to validate an xml file using multiple schema files using
(B> > > Xerces-J 2.5.0. The xml file specifies the location of schema#1
(Busing
(B> > > schemaLocation. Inside of schema#1, schema#2 is specified using
(B> > > xsd:import. I get an error when the root element of the xml file is
(Ban
(B> > > element defined in schema#2.
(B> > >
(B> >
(B> >
(B> >---------------------------------------------------------------------
(B> >To unsubscribe, e-mail: [EMAIL PROTECTED]
(B> >For additional commands, e-mail: [EMAIL PROTECTED]
(B> >
(B>
(B>_________________________________________________________________
(B>$B<+Bp$N(B PC $B$G1Q8lNO$r%"%C%W(B MSN $B1Q2qOC(B http://englishtown.msn.co.jp/
(B>
(B>
(B>---------------------------------------------------------------------
(B>To unsubscribe, e-mail: [EMAIL PROTECTED]
(B>For additional commands, e-mail: [EMAIL PROTECTED]
(B>
(B>
(B>
(B>
(B>
(B>
(B>
(B>---------------------------------------------------------------------
(B>To unsubscribe, e-mail: [EMAIL PROTECTED]
(B>For additional commands, e-mail: [EMAIL PROTECTED]
(B>
(B
(B_________________________________________________________________
(BHP $B$d%a!<%k%"%I%l%9$r<+J,[EMAIL PROTECTED](B MSN $B%I%a%$%s(B
(Bhttp://onamae.msn.co.jp/
(B
(B
(B---------------------------------------------------------------------
(BTo unsubscribe, e-mail: [EMAIL PROTECTED]
(BFor additional commands, e-mail: [EMAIL PROTECTED]
- Schema validation using multiple schemas Adachi Seiichi
- Re: Schema validation using multiple schemas Bob Foster
- Re: Schema validation using multiple schemas Jeff Greif
- Re: Schema validation using multiple schemas Adachi Seiichi
- Re: Schema validation using multiple schemas Jeff Greif
- Re: Schema validation using multiple schemas Eric_Schwarzenbach
- Re: Schema validation using multiple schemas Adachi Seiichi
- Re: Schema validation using multiple schemas Adachi Seiichi
- Re: Schema validation using multiple schemas Jeff Greif
- Re: Schema validation using multiple schemas Adachi Seiichi
