XML Schemas

F

Fernando Silva

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
 
M

Martin Honnen

Fernando Silva wrote:

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?

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top