[xsd-users] Sort of XML "reflection"
Bill Pringlemeir
bpringle at sympatico.ca
Wed Nov 18 15:57:41 EST 2009
On 18 Nov 2009, PaquetP at navcanada.ca wrote:
> I'm actually not trying to map types, I'm trying to map elements.
> Quoting myself: "a caller will be passing a string representing the name
> of one of these ELEMENTS of the complex type T. I'd like to determine
> if such an ELEMENT exists, and if it does, get a reference to all
> occurences of them to a sequence of B&".
> The sequence of B& is because I know all elements will be at least type
> B.
> My goal here is to reflect on the class generated by XSD to see if it
> contains a function to access an element whos name is a string that is
> provided as an argument, and if so, get a class of type at least B that
> references that element. I'm aware that C++ has a limited reflection
> capability, but I figured I can do this if I had access to the DOM
> association, but I do not because I created the instance of T without
> calling the parser (I called the default constructor to the generated
> class that binds to the complex type T).
Hmm. I think I see, but your question was somewhat wrong. The
'ELEMENT' you emphasized is really the 'elements XML name'. Each
element also has a class. I was assuming a complex element, not a
simple one; which they all must be as they are derived from a base
class?
> a string representing the name of one of these ELEMENTS of the
> complex type T
> a string representing the name of one of these elements IN the
> complex type T
I am sure you knew what you meant, but you might see why I had
trouble? ;-) This if the type of reflection you are after, to see if T
has a specific element?
I think that the IDREF mechanism of XSD might also be worth a look
although I don't know if it will map to your problem, it is similar.
And now I understand your question is XSD specific.
Thanks,
Bill Pringlemeir.
--
Remember, if you smoke after sex you're doing it too fast. - Woody Allen
More information about the xsd-users
mailing list