schema with russian doll design structure

Hello,

I have XML documents with multiple levels of element hierarchy and tags with attributes and I need to create a schema with Russian Doll design structure for it. How do I do that? Do you know any tutorials on how to create a schema with russian doll design structure?

Thanks!
bluepaintAsked:
Who is Participating?
 
Geert BormansInformation ArchitectCommented:
Here is a brief mentioning of Russian Doll design.
http://www.xml.com/lpt/a/691

I have a WROX book on XML schema, that is not good but covers Russian doll extensively.

But basically all you need to know can be sumarised in the two lines referenced above and the example

Now, do you have a compelling reason for using russian doll?
The problem with rusian doll is that all element declarations are local.
This could have namespace implications, but that is likely not an issue here
But this also means that you can't reference element declarations,
forcing you to guess before hand how deep you want to nest

    <xs:element name="sect">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="sect" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="sect" minOccurs="0">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="sect" minOccurs="0">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="sect" minOccurs="0">
                                                        ...
                                                    </xs:element>
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

the schema going four levels deep.
Note that technically the four levels are different element types
and you need to repeat all definitions thta you have inside them

Here is the variant for another schema style

<xs:element name="section">
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="section" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

If you have an unknown nesting in your XML,
you can't use Russion doll
(I strongly recommend that you don't)

And I am very curious what reason you could possibly have to decide on russian doll with these requirements
0
 
bluepaintAuthor Commented:
I need to use Russian doll because that is what's required of us. lol! Actually, I also need to use flat catalog using the same xml document. To compare which one's better I guess.
0
 
Geert BormansInformation ArchitectCommented:
Is this homework?
Sounds like homework almost.
From the design point of view, I see no compelling reason to force a suboptimal design methodology for a task.
This is either a crazy architect involved, or a teacher that wants you to find out that RD is no good for infinite nesting :-)
0
 
bluepaintAuthor Commented:
Yes, it is homework/proj. Thanks for your inputs!
0
 
Geert BormansInformation ArchitectCommented:
welcome
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.