Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - XPath and XSD [Thread Next] Re: XPath and XSDTo: 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/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
