Multiple Definition for the Same Element


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Multiple Definition for the Same Element

  1. #1
    Murali Kannan Guest

    Multiple Definition for the Same Element


    Hi,

    How can I give multiple definition for a Same Element i.e

    <ElementType name="DATA" dt:type="i2"/>
    and
    <ElementType name="DATA" dt:type="string"/>

    in the same schema file. And how can use it in the xml? can U explain with
    examples? Can it be done using namespace?

    Now I explain what for this. Previously in my application I used DATA as
    a string now I want to use it as a integer But I don't want to break my Previous
    Application (Same Like COM provides backward compatibility)

    Any Suggestions please tell me.

    -Thanks In Advance
    Murali Kannan

  2. #2
    Zack Guest

    Re: Multiple Definition for the Same Element


    Define a name space for each use.
    use1ata
    use2ata

    Thank
    Zack

  3. #3
    Murali Kannan Guest

    Re:Re: Multiple Definition for the Same Element


    "Zack" <zack_attack190@yahoo.com> wrote:
    >
    >Define a name space for each use.
    > use1ata
    > use2ata
    >
    >Thank
    >Zack


    Even though I use the namespace in schema how can i define the namespace
    in the xml.

    My Schema is

    <?xml version="1.0" encoding="UTF-8"?>
    <Schema name="Temp"
    xmlns="urn:schemas-microsoft-com:xml-data"
    xmlns:dt="urn:schemas-microsoft-com:datatypes">

    <ElementType name="DATA" content="textOnly" dt:type="string" xmlns="version1"/>

    <ElementType name="DATA" content="textOnly" dt:type="i4" xmlns="version2"/>

    </Schema>

    in xml how can I refer the namespace version1 or version2

    - Thanks
    Murali Kannan

  4. #4
    ZacK Guest

    Re:Re: Multiple Definition for the Same Element


    Murali

    I just made them up, just find a simple name space example and
    modify it.

    Zack

  5. #5
    Murali Kannan Guest

    Re: Multiple Definition for the Same Element


    "ZacK" <zack_attack190@yahoo.com> wrote:
    >
    >Murali
    >
    >I just made them up, just find a simple name space example and
    >modify it.
    >
    >Zack


    Hi Zack,

    Here I explain my problem fully.

    I have a scenario where I have a Schema file with two Elements of the same
    name but referring to different namespaces. When I create an XML referring
    to either one of the namespaces, the datatype doesnt get checked by the XML
    Processor. Why is that? Are there any limitations of using two or more
    namespaces in the same Schema file or am I missing something?


    This is the schema file :
    ---------------------------------------------------------------------------
    <Schema id="Temp"
    xmlns="urn:schemas-microsoft-com:xml-data"
    xmlns:dt="urn:schemas-microsoft-com:datatypes"
    xmlns:v1="urn:version1"
    xmlns:v2="urn:version2">

    <ElementType name="CHILD" content="textOnly" dt:type="i2" xmlns="urn:version1"/>
    <ElementType name="CHILD" content="textOnly" dt:type="i4" xmlns="urn:version2"/>

    <ElementType name="ROOT" content="eltOnly" model="closed" order="seq">
    <element type="v1:CHILD" minOccurs="1" maxOccurs="*"/>
    </ElementType>
    </Schema>
    ---------------------------------------------------------------------------

    This is the XML file:
    ---------------------------------------------------------------------------
    <?xml version="1.0"?>
    <ROOT xmlns="x-schema:Temp.xsd">
    <CHILD xmlns="urn:version1"> abcd </CHILD>
    </ROOT>



    ---------------------------------------------------------------------------

    If you see the XML file, there is a element called "CHILD" which is referring
    to the urn:version1 namespace.. the datatype has to be an integer but it
    is a string.. apparently, MSXML3 doesnt scream..


    Thanks in Advance,
    Murali Kannan


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center