sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
kosaraju.puneeth@gmail.com's Avatar

recursive relationships in xml


Question posted by: kosaraju.puneeth@gmail.com (Guest) on October 25th, 2005 02:25 AM
hello,

I need to represent recursive relationship in xml which will be
validated by defined xml schema.

example: check.xml

<a>
<testgroup name="first" result ="pass">
<testgroup name="second">
<test name="OPEN" spec = "0"/>
</testgroup>

<test name="SHORT" spec ="1"/>
</testgroup>

<test name="CLOSE" spec ="1"/>

<testgroup name="third" result ="fail">
<test name="OPEN" spec = "1"/>
</testgroup>

</a>

so i have to write a xml schema which can validate "check.xml"

Thanks in advance.

2 Answers Posted
Stan Kitsis [MSFT]'s Avatar
Stan Kitsis [MSFT] October 25th, 2005 08:15 PM
Guest - n/a Posts
#2: Re: recursive relationships in xml

See below. You'll need to change attribute types to reflect the values they
can take.

<xs:complexType name="testType">
<xs:attribute name="name" use="required" type="xs:string"/>
<xs:attribute name="spec" use="required" type="xs:string"/>
</xs:complexType>

<xs:complexType name="testGroupType">
<xs:sequence>
<xs:element name="testgroup" type="testGroupType" minOccurs="0"/>
<xs:element name="test" type="testType" minOccurs="0" />
</xs:sequence>
<xs:attribute name ="name" type="xs:string"/>
<xs:attribute name ="result" type="xs:string"/>
</xs:complexType>

<xs:complexType name="aType">
<xs:choice maxOccurs="unbounded">
<xs:element name="testgroup" type="testGroupType"/>
<xs:element name="test" type="testType"/>
</xs:choice>
</xs:complexType>

<xs:element name="a" type="aType"/>

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

<kosaraju.puneeth@gmail.com> wrote in message
news:1130203078.483098.296820@g14g2000cwa.googlegr oups.com...[color=blue]
> hello,
>
> I need to represent recursive relationship in xml which will be
> validated by defined xml schema.
>
> example: check.xml
>
> <a>
> <testgroup name="first" result ="pass">
> <testgroup name="second">
> <test name="OPEN" spec = "0"/>
> </testgroup>
>
> <test name="SHORT" spec ="1"/>
> </testgroup>
>
> <test name="CLOSE" spec ="1"/>
>
> <testgroup name="third" result ="fail">
> <test name="OPEN" spec = "1"/>
> </testgroup>
>
> </a>
>
> so i have to write a xml schema which can validate "check.xml"
>
> Thanks in advance.
>[/color]


kosaraju.puneeth@gmail.com's Avatar
kosaraju.puneeth@gmail.com October 26th, 2005 08:05 AM
Guest - n/a Posts
#3: Re: recursive relationships in xml

Thank you very much Mr.Stan kitsis

 
Not the answer you were looking for? Post your question . . .
196,794 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,794 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors