[Home] [By Thread] [By Date] [Recent Entries]

  • From: Michael Glavassevich <mrglavas@c...>
  • To: "Costello, Roger L." <costello@m...>
  • Date: Wed, 4 Aug 2010 17:06:02 -0400

It depends on what you put in Library.xsd. If you import Book.xsd then it will get loaded with it:

<xs:import namespace="http://www.book.org" schemaLocation="Book.xsd"/>
<xs:complexType name="BooksType">
 <xs:sequence>
  <xs:element xmlns:x="http://www.book.org" ref="x:Book"/>
 </xs:sequence>
</xs:complexType>

If the schema documents aren't directly connected:

<xs:complexType name="BooksType">
 <xs:sequence>
  <xs:any namespace="http://www.book.org"/>
 </xs:sequence>
</xs:complexType>

then Book.xsd won't be loaded until Xerces-J's validator hits <Book>.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@c...

E-mail: mrglavas@a...

"Costello, Roger L." <costello@m...> wrote on 08/04/2010 04:33:41 PM:

> Hi Michael,
>
> Sorry for my misunderstanding. Let me be sure that I now understand
> correctly.  
>
> Consider this XML document:
>
> <?xml version="1.0"?>
> <Library xmlns="http://www.library.org"
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation=
>                     "http://www.library.org
>                      Library.xsd">
>     <Books>
>         <Book xmlns=http://www.book.org
>               xsi:schemaLocation=
>                            "http://www.book.org
>                             Book.xsd">
>                 <Title>My Life and Times</Title>
>                 <Author>Paul McCartney</Author>
>                 <Date>1998</Date>
>                 <ISBN>1-56592-235-2</ISBN>
>                 <Publisher>Macmillan Publishing</Publisher>
>         </Book>
>         ...
>     </Books>
> </Library>
>
> Xerces-J will not read Book.xsd until it gets to the <Book> element.
> It will read Library.xsd immediately. Is that correct?
>
> /Roger
>
>
> From: Michael Glavassevich [mailto:mrglavas@c...]
> Sent: Wednesday, August 04, 2010 3:43 PM
> To: xml-dev@l...
> Subject: Re: [Summary] Big hierarchy of XML Schema
> documents ... which XML Schema validators bring in the documents on demand?
>
> Roger,
>
> "Costello, Roger L." <costello@m...> wrote on 07/31/2010 01:50:37 PM:
>
> > Hi Folks,
> >
> > Thanks to Michael Glavassevich, Michael Kay, and Boris Kolpackov for
> > your excellent inputs.
> >
> > Here's what I learned (please correct any errors):
> >
> > Suppose that your XML Schema imports/includes some XML Schemas, and
> > they import/include some XML Schemas, and so on. Thus, there is a
> > big hierarchy of XML Schema documents.
> >
> > When does a validator read the XML Schema documents? Here are two
> > ways that XML Schema validators could be implemented:
> >
> > 1. Just-in-time loading (a.k.a. on-demand loading): the validator
> > reads an XML Schema document during instance validation, when a
> > component from the relevant namespace is first encountered.
> >
> > 2. Eager loading: all XML Schema documents are (recursively) read
> > prior to validating the XML instance document.
>
> This is quite a different statement than what you originally had and
> is no longer an accurate description of how / when Xerces-J
> dynamically loads schemas. There could be multiple schema location
> hints (i.e. xsi:schemaLocation) in a document and Xerces-J won't
> load those schema documents unless the validator hits an element,
> attribute or type which has the target namespace of those schemas.
> If they don't import each other loading one of them won't cause the
> others to be loaded. The others might be loaded later if they're needed.
>
> > The following XML Schema validators all use eager loading:
> >
> >     SAXON (Java)
> >
> >     SAXON (.NET)
> >
> >     XERCES (Java)
> >
> >     XERCES (C++)
> >
> >     XERCES (Perl)
> >
> >     LIBXML (Gnome's libxml2)
> >
> >     MSXML
> >
> >     XSV
> >
> >
> > /Roger
> >
> > _______________________________________________________________________
> >
> > XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> > to support XML implementation and development. To minimize
> > spam in the archives, you must subscribe before posting.
> >
> > [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> > Or unsubscribe: xml-dev-unsubscribe@l...
> > subscribe: xml-dev-subscribe@l...
> > List archive: http://lists.xml.org/archives/xml-dev/
> > List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@c...
> E-mail: mrglavas@a...
>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l...
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member