OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Including Schema inside the XML

[ Lists Home | Date Index | Thread Index ]

Title: 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>





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS