opensubscriber
   Find in this group all groups
 
Unknown more information…

j : j-users@xerces.apache.org 22 June 2009 • 9:03AM -0400

If an element is a simple or array element
by David Cao

REPLY TO AUTHOR
 
REPLY TO GROUP




Hi there,
I need to be able to parse (either via DOM or SAX) an XML with namespace
spread out in several schema; this means the final type could reside in an
embedded schema a couple level deeper. I need to tell if an element is
defined as a simple type or as an array type.

I took the sample jaxp.TypeInfoWriter (because I also need access
to org.w3c.dom.TypeInfo); then to add a org.apache.xerces.xs.PSVIProvider to
the handler,

   private PSVIProvider fPSVIProvider;

and set it this way,

   org.apache.xerces.parsers.SAXParser saxParser = new
org.apache.xerces.parsers.SAXParser();
   fPSVIProvider = (PSVIProvider)saxParser;

However, in the startElement( ... ) method, I did this,

   ElementPSVI elemPSVI = fPSVIProvider.getElementPSVI();

unfortunately, elemPSVI is always null no matter how I configure the schema
validation options.

So, is my approach workable? if yes, what I did wrong. Or is there better
approach?

------------------------------

Also, I tried out-of-box simpletype.DatatypeInterfaceUsage sample on the
provided personal.xsd and personal-schema.xml; I found the same result. But
I found the underlying parsers are different between the two samples. One
uses,
   org.apache.xerces.jaxp.SAXParserImpl, which inherits
javax.xml.parsers.SAXParser
the other uses,
   org.apache.xerces.parsers.SAXParser

I found although they have the same simple name, they don't overlap at all.
So how to choose which to use one or the other?

Much appreciated,
David

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.