Solved

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

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now