Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Determining appropriate values from a schema


Message #1 by "Jason Pluis" <jason.pluis@a...> on Mon, 17 Feb 2003 03:22:55
Gday all,

I have an application that required some metadata of an XML document to be 
edited.
Within the metadata of the document, one of the elements is <template>. 
The template element refers to another XML document that points to a 
schema that defines the metadata for this particular type of document. 

What I would like to do is:
- for each of the children of the <meta> element, find out what its 
allowable values are, 
- and create the appropriate type of form element for this entry. 

For the example XML and schema below I would fill a html <select> element 
with three options - the three values shown in the <xs:enumeration> 
elements. Similarly, I would expect to find that the <lastedited> element 
was of type <xs:date> (not shown in sample schema), and simply display a 
text <input> box that I could validate as a date...

__XML DOCUMENT__
<meta><state>edit</state><lastedited>2003-02-17</lastedited></meta>
__SCHEMA__
<xs:element name="state" type="x:stateType" />
<xs:simpleType name="stateType">
	<xs:union memberTypes="x:hintType">
		<xs:simpleType>
			<xs:restriction base="xs:string">
				<xs:enumeration value="Dev" />
				<xs:enumeration value="Test" />
				<xs:enumeration value="Prod" />
			</xs:restriction>
		</xs:simpleType>
	</xs:union>
</xs:simpleType>

Does anyone now if this is possible? The problem is that I have mixtures 
of simple and complex types, unions, restrictions, etc, that make this 
quite complicated to write out specific rules to trace the schema elements 
around until I find the values or types. For example, the easiest thing 
would be to find a simple element that is an <xs:string> with no other 
restrictions. Anything else and it starts to get really complicated.

Is there anything available within the asp.net framework that can handle 
this kind of situation? Or does it sound like I am in for the long haul of 
creating my own way out of this mess?

Reagrds,
Jason Pluis
Canberra, Australia
Message #2 by "Rohit Arora" <rohit_arora@i...> on Mon, 17 Feb 2003 09:37:06 +0530
use system.xml.schema class..
hope this link would be of help..

http://www.tomorrowslearning.com/codebank/util/srcview.aspx?path=../../CodeB
ank/System.Xml.Schema/ParseSchema/ParseXMLSchema.src&file=ParseXMLSchema.asp
x.cs&font=3

Regards
Rohit Arora
Intersolutions (P) Ltd
B - 21, Sector 58,
Noida - 201301
Tel : 91-2585703/04/05 Extn: 229


-----Original Message-----
From: Jason Pluis [mailto:jason.pluis@a...]
Sent: Monday, February 17, 2003 3:23 AM
To: aspx_beginners
Subject: [aspx_beginners] Determining appropriate values from a schema


Gday all,

I have an application that required some metadata of an XML document to be
edited.
Within the metadata of the document, one of the elements is <template>.
The template element refers to another XML document that points to a
schema that defines the metadata for this particular type of document.

What I would like to do is:
- for each of the children of the <meta> element, find out what its
allowable values are,
- and create the appropriate type of form element for this entry.

For the example XML and schema below I would fill a html <select> element
with three options - the three values shown in the <xs:enumeration>
elements. Similarly, I would expect to find that the <lastedited> element
was of type <xs:date> (not shown in sample schema), and simply display a
text <input> box that I could validate as a date...

__XML DOCUMENT__
<meta><state>edit</state><lastedited>2003-02-17</lastedited></meta>
__SCHEMA__
<xs:element name="state" type="x:stateType" />
<xs:simpleType name="stateType">
	<xs:union memberTypes="x:hintType">
		<xs:simpleType>
			<xs:restriction base="xs:string">
				<xs:enumeration value="Dev" />
				<xs:enumeration value="Test" />
				<xs:enumeration value="Prod" />
			</xs:restriction>
		</xs:simpleType>
	</xs:union>
</xs:simpleType>

Does anyone now if this is possible? The problem is that I have mixtures
of simple and complex types, unions, restrictions, etc, that make this
quite complicated to write out specific rules to trace the schema elements
around until I find the values or types. For example, the easiest thing
would be to find a simple element that is an <xs:string> with no other
restrictions. Anything else and it starts to get really complicated.

Is there anything available within the asp.net framework that can handle
this kind of situation? Or does it sound like I am in for the long haul of
creating my own way out of this mess?

Reagrds,
Jason Pluis
Canberra, Australia

Message #3 by "Jason Pluis" <jason.pluis@a...> on Mon, 17 Feb 2003 06:01:17
Rohit,
Thanks heaps. I knew that class existed but didn't think that it had the 
kind of functionality available that I needed. The link you provided was 
exactly what I needed to get me started. I was totally on the wrong track 
until you pointed that link out.
Cheers,
Jason Pluis

> use system.xml.schema class..
hope this link would be of help..

http://www.tomorrowslearning.com/codebank/util/srcview.aspx?
path=../../CodeB
ank/System.Xml.Schema/ParseSchema/ParseXMLSchema.src&file=ParseXMLSchema.as
p
x.cs&font=3

Regards
Rohit Arora
Intersolutions (P) Ltd
B - 21, Sector 58,
Noida - 201301
Tel : 91-2585703/04/05 Extn: 229
Message #4 by "Rohit Arora" <rohit_arora@i...> on Mon, 17 Feb 2003 11:24:35 +0530
yups..I am just about to finish wht u were trying to do..n had a lot of
resarch ..thats gr8..to explore a thing which took me like 2 days..helped
somebody in two hours..

look for site xmlforasp.net

Regards
Rohit Arora
Intersolutions (P) Ltd
B - 21, Sector 58,
Noida - 201301
Tel : 91-2585703/04/05 Extn: 229


-----Original Message-----
From: Jason Pluis [mailto:jason.pluis@a...]
Sent: Monday, February 17, 2003 6:01 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Determining appropriate values from a
schema


Rohit,
Thanks heaps. I knew that class existed but didn't think that it had the
kind of functionality available that I needed. The link you provided was
exactly what I needed to get me started. I was totally on the wrong track
until you pointed that link out.
Cheers,
Jason Pluis

> use system.xml.schema class..
hope this link would be of help..

http://www.tomorrowslearning.com/codebank/util/srcview.aspx?
path=../../CodeB
ank/System.Xml.Schema/ParseSchema/ParseXMLSchema.src&file=ParseXMLSchema.as
p
x.cs&font=3

Regards
Rohit Arora
Intersolutions (P) Ltd
B - 21, Sector 58,
Noida - 201301
Tel : 91-2585703/04/05 Extn: 229


  Return to Index