Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XPath and XSD

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 4/4/2006 1:21:00 PM



Robert Stowsky wrote:

> If I have an 
> XSD and know only the root node of the XML document that the XSD specifies, 
> is it possible to generate a list of all valid XPaths for the XML doument 
> based on only the XSD?  Any sample code in either VB, or C#, would be 
> appreciated.

I am not sure what "all valid XPaths" exactly is (what you do if the 
schema has e.g.
   <xs:element name="element-name" type="xs:string" minOccurs="0" 
maxOccurs="unbounded">
then you would need infinite XPath expressions to precisely select any 
possible of the unbounded elements that schema allows).

However .NET implements a SOM (Schema Object Model) that helps exploring 
a schema and extracting/navigating the types/elements/attributes it defines:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxsdschemaobjectmodelsom.asp>

There is nothing in there (meaning there is no function defined in 
there) to simply generates XPath expressions but as you can walk the 
schema structure with that API you can on that way generate XPath 
expressions for the element or attribute declarations you find.



-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent