[
Lists Home |
Date Index |
Thread Index
]
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@sfamipec.com]
Sent: Monday, July 15, 2002 1:47 PM
To: CHIUSANO, Joseph; XML DEV
Subject: RE: [xml-dev] 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@lmi.org]
> Sent: Monday, July 15, 2002 10:37 AM
> To: Naren Koka; XML DEV
> Subject: RE: [xml-dev] 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@lmi.org
> > Tel: 571.633.7722
> >
**************************************************************************
> >
>
>
> -----Original Message-----
> From: Naren Koka [<mailto:NKoka@sfamipec.com>]
> Sent: Monday, July 15, 2002 1:30 PM
> To: XML DEV
> Subject: [xml-dev] 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>
|