[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Including Schema inside the XML


setexternalnonamespaceschemalocation

If you are using the Xerces parser you can explicitly override any included
schema reference in the XML with your reference (the one pulled from the
database). The actual function is setExternalSchemaLocation() or
setExternalNoNamespaceSchemaLocation() as the case may be. Since you have
the Schema in a database (as opposed to an URL) you will want to implement
the resolveEntity() method of the EntityResolver handler.

- Awez.

-----Original Message-----
From: Naren Koka [mailto:NKoka@s...]
Sent: Monday, July 15, 2002 1:47 PM
To: CHIUSANO, Joseph; XML DEV
Subject: RE:  Including Schema inside the XML


Thank you very much Joe,

    I am working on an application, that pulls the schema from a database
and validates an incoming XML message against the schema.  The DTD and then
the XML are added to a stream and submitted to the parser.  I want to do the
same with the schema.

Thank you,
Naren




> -----Original Message-----
> From:	CHIUSANO, Joseph [SMTP:JCHIUSANO@l...]
> Sent:	Monday, July 15, 2002 10:37 AM
> To:	Naren Koka; XML DEV
> Subject:	RE:  Including Schema inside the XML
> 
> Naren, 
> 
> You can include the location of the schema and its associated
targetNamespace at the top of the instance document as follows:
> 
>         <?xml version="1.0"?> 
>         <Invoice
xmlns:xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" 
>                      xsi:schemaLocation="<http://www.acme.org/invoices>" 
>                                                           InvoiceV1.xsd> 
> 
> where xsi:schemaLocation indicates the targetNamespace of the schema whose
name is given in the second parameter.  This indicates that the schema named
InvoiceV1.xsd (assumed here to be in the same directory as the instance
document, which may not always be the case) has a targetNamespace of
"<http://www.acme.org/invoices>".  
> 
> If the schema does not have a targetNamespace, the declaration would look
as follows: 
> 
>         <?xml version="1.0"?> 
>         <Invoice
xmlns:xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" 
>                      xsi:noNamespaceSchemaLocation="InvoiceV1.xsd> 
> 
> For more information on targetNamespace (and namespaces in general), you
can reference chapter 3 of the W3C Schema Primer:
<http://www.w3.org/TR/2000/CR-xmlschema-0-20001024/>
> 
> Hope that helps, 
> Joe Chiusano 
> LMI 
> 
> >
************************************************************************** 
> >   Joseph M. Chiusano 
> >   Logistics Management Institute 
> >   2000 Corporate Ridge 
> >   McLean, VA 22102 
> >   Email: jchiusano@l... 
> >   Tel: 571.633.7722 
> >
************************************************************************** 
> > 
> 
> 
> -----Original Message----- 
> From: Naren Koka [<mailto:NKoka@s...>] 
> Sent: Monday, July 15, 2002 1:30 PM 
> To: XML DEV 
> Subject:  Including Schema inside the XML 
> 
> 
> Hi, 
>    I want to know how to include the schema inside the .XML file.  We
could do this with DTDs and I now need to work with schemas.  Thanks for the
help!
> 
> Naren Koka 
> 
> ----------------------------------------------------------------- 
> The xml-dev list is sponsored by XML.org <<http://www.xml.org>>, an 
> initiative of OASIS <<http://www.oasis-open.org>> 
> 
> The list archives are at <http://lists.xml.org/archives/xml-dev/> 
> 
> To subscribe or unsubscribe from this list use the subscription 
> manager: <<http://lists.xml.org/ob/adm.pl>> 
> 

-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.