Solved

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

Posted on 2003-11-11
3
389 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
XSLT: how to increment number value if attribute present 4 43
Element alignment and word wrapping 9 70
Adding a hidden div to each row in a table 6 71
XSLT XML 4 21
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

821 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