You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Mark Brucks <br...@charter.net> on 2009/10/20 02:20:27 UTC
derived types
I'm having trouble understanding how information about derived types
is maintained. I have a schema with a derived type declared, and an
instance document which uses it (via xsi:type). I know that this type
information is maintained by the DOM, because if I parse a document
and then write it back out, the type information appears in the saved
document.
How do I access this information, and how do I create an element and
specify that it is of the derived type? I currently use
CoreDocImp.createElementNS to create elements, but I can find no other
method to set the elements type.
Thanks - Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: derived types
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Mark,
Mark Brucks <br...@charter.net> wrote on 10/19/2009 08:20:27 PM:
> I'm having trouble understanding how information about derived types
> is maintained. I have a schema with a derived type declared, and an
> instance document which uses it (via xsi:type). I know that this type
> information is maintained by the DOM, because if I parse a document
> and then write it back out, the type information appears in the saved
> document.
If you're referring to xsi:type it's an attribute like any other. If it was
in the document you loaded, it will be there when you serialize it. Nothing
special going on here.
> How do I access this information, and how do I create an element and
> specify that it is of the derived type?
Add an xsi:type attribute to the element.
> I currently use CoreDocImp.createElementNS to create elements, but I
> can find no other method to set the elements type.
Type information is available from the DOM if you've validated it. Take a
look at TypeInfo [1] and Xerces' PSVI DOM [2].
> Thanks - Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
Thanks.
[1]
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/TypeInfo.html
[2] http://xerces.apache.org/xerces2-j/faq-xs.html#faq-6
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org