Dear Xerces users/devs,

first of all: thanks for the great library and any help that you can
provide with my current predicament.

I'm trying to extract the substitution group from my schema for a
given element in my xml document.  I understand there might be a way
to do this by implementing a custom PSVIHandler, however I've taken a
slightly different route.  I instantiate a default GrammarPool and
pass it to my DOMParser which I then use to load my schema.  I then
parse my xml document and whenever I encounter an element that I need
the substitution group for I do something along the following lines:

GrammarPool->getXSModel()->getElementDeclaration(...)->getSubstitutionGroupAffiliation()->getName()

So question 1) Is this a reasonable way to accomplish this or should I
be using a different approach?

Question 2)

Currently, the way I match the element to the element declaration is
along the following lines:

XSModel->getElementDeclaration(element->getLocalName(),
element->getNamespaceURI())

this feels like it may not work in all cases.  How does Xerces match
each element to an element declaration when it is doing validation?  I
had a good look through the source but I couldn't see how this is
done.

Many thanks,
-Martin

Reply via email to