Solved

Any way to flatten a namespace or easily access attribute/lement type definitions

Posted on 2003-11-11
3
400 Views
Last Modified: 2013-11-19
What I want do do is to create a simple paramater maintenance interface, with input validation, based on type definitions held in XML Schemas.  The shemas themselves rely heavily on namespaces following the venetial blind model of structure.

I would like to be able to access type definitons of the namespaces in order drive the validation at the user interface.  I will overlay a parameter schema on the underlying types to drive generic validation or to invoke taglib style processes.

Problems:

  I don't want to have to parse the XML unless I have no choice.  Is there any kind of tool that will provide intorspection on a an XSD.

  If I do have to parse the XML, is there any tool that will flatten a namespace so that at least I don't have to deal with multiple namespaces, extension, redefinition, etc etc.

I dont't really see jaxb or xsd.exe as being much help unless I am missing something?

More points for good answers

Oops - just found apache xerces.  Has anyone used this to query a schema in order to validate input?
0
Comment
Question by:tonimargiotta
3 Comments
 
LVL 3

Expert Comment

by:savalou
ID: 9722348
Try JDom at JDom.org.  The Oracle articles posted on the documentation page provide a quick intro.

JDom lets you quickly build an XML document and query it using xpath.  It is a lot more Java-friendly than Xerces.

Of course, all this assuming you are programming in Java.
0
 
LVL 1

Author Comment

by:tonimargiotta
ID: 9722778
Thanks but the access I need is to the namespace rather than a document instance.

I don't see any access to grammar or the equivalent of the pvsi package in jdom
0
 
LVL 26

Accepted Solution

by:
rdcpro earned 125 total points
ID: 9723531
the Schema Object Model, or SOM is one way of providing introspection of the schema.  This is available in MSXML 4, but I'm not sure what other parsers support it.  But I believe it's used precisely for what you're wanting to do.  In your particular case, ISchemaElement is an interface of the SOM, which has a type property. That property corresponds to an XML Schema document simpleType or complexType element, and that type is represented in the SOM by the ISchemaType interface.

This article covers it (though shallowly, if that's a word) but you have to get to part 5 before it really starts addressing the subject:
http://www.informit.com/isapi/product_id~%7B1D7C86B4-63C6-4C49-9DDC-AC39FE809E17%7D/content/index.asp

And the Microsoft documentation for the SOM developer's guide:
http://msdn.microsoft.com/library/en-us/xmlsdk/htm/som_devguide_overview_73g7.asp
and the SOM Reference:
http://msdn.microsoft.com/library/en-us/xmlsdk/htm/som_reference_3ig5.asp
and Aaron Skonards'  introductory article (from the MSDN Magazine XML files column):
http://msdn.microsoft.com/msdnmag/issues/01/12/xml/default.aspx

Regards,
Mike Sharp
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Questions about this React unit test 4 70
XML response optional elements 12 55
PowerShell script to remove string in xml file 3 40
Grunt script for Build Process 1 60
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question