using in xml namespace defined in schema

Discussion in 'XML' started by Dominique, Jun 30, 2004.

  1. Dominique

    Dominique Guest

    I want to use a namespace in an XML file, that I have created in the
    schema for this xml file. do i have to redefine this namespace in the
    xml file? or is there a way to re-use the definition from the schema?

    here is the example I found on the net, that I am trying to validate,
    and it doesn't work...

    link:
    http://www.laltruiste.com/document.php?compteur=2&rep=4&evolution=8

    code example:
    http://www.laltruiste.com/coursschema/exemples/xsd_import.zip

    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Dominique, Jun 30, 2004
    #1
    1. Advertising

  2. Dominique wrote:

    > I want to use a namespace in an XML file, that I have created in the
    > schema for this xml file. do i have to redefine this namespace in the
    > xml file? or is there a way to re-use the definition from the schema?


    If your schema declares that an element has to be in a certain namespace
    e.g. if you use
    <xs:schema
    targetNamespace="http://example.com/2004/07/kibology"
    elementFormDefault="qualified"
    ...>
    then of course your instance XML document needs to use that namespace by
    declaring a prefix for it e.g.
    <ki:root
    xmlns:ki="http://example.com/2004/07/kibology">...</ki:root>
    or use the namespace as the default namespace e.g.
    <root xmlns="http://example.com/2004/07/kibology">...</root>

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jul 1, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page