XML Schemas

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fernando Silva

    #1

    XML Schemas

    Hello!

    I have a doubt in how to define a schema for the following XML:

    <X_0>
    <A>1</A>
    <B>2</B>
    </X_0>
    <X_1>
    <A>1</A>
    <B>2</B>
    </X_1>
    <X_2>
    <A>1</A>
    <B>2</B>
    </X_2>
    <X>
    <N>3</N>
    </X>

    The problem is that I don't know who many elements X_y (y is the
    number) are going to appear. They are variable.
    Is this possible to define in a Schema? Or I just have to insert as
    many X_y as the possible maximum?

    Thanks in advance.

    Regards,
    Fernando Silva
  • Martin Honnen

    #2
    Re: XML Schemas



    Fernando Silva wrote:

    [color=blue]
    > I have a doubt in how to define a schema for the following XML:
    >
    > <X_0>
    > <A>1</A>
    > <B>2</B>
    > </X_0>
    > <X_1>
    > <A>1</A>
    > <B>2</B>
    > </X_1>
    > <X_2>
    > <A>1</A>
    > <B>2</B>
    > </X_2>
    > <X>
    > <N>3</N>
    > </X>
    >
    > The problem is that I don't know who many elements X_y (y is the
    > number) are going to appear. They are variable.
    > Is this possible to define in a Schema? Or I just have to insert as
    > many X_y as the possible maximum?[/color]

    I would consider changing the structure to
    <x-list>
    <x x="1">...</x>
    <x y="2">...</x>
    ...
    <x y="n">...</x>
    </x-list>
    as you can't have a schema where element names have a variable part
    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    Working...