[xsd-users] newly added node not in list?

Boris Kolpackov boris at codesynthesis.com
Tue Apr 11 07:36:38 EDT 2006


Hi Oliver,

Oliver.Kowalke at infineon.com <Oliver.Kowalke at infineon.com> writes:

> I would add some special functions (templated) which allow access to the
> content of an xsd:any node (already working -> c_type). Adding such a
> node to the statically typed tree (no matter if it was parsed from a
> file or created from classes of the tree) is the problem I want to
> solve.
> If I understand your last notice your solution would solve the problem
> (I hope).

Ok, I've added the ability to set DOM nodes for tree nodes. You will
need to replace your libxsd/xsd/cxx/tree/elements.hxx with this one:

http://codesynthesis.com/~boris/tmp/elements.hxx

For restrictions see comment before the _node(DOMNode*) function in the
file above. Using this function, you will be able to write something
like this:

b_type& b_n = ... // parsed with keep_dom

using namespace xercesc;

DOMDocument* doc = b_n._node ()->getOwnerDocument();

b_n.c ().push_back (c_type ()); // Create new tree node.
c_type& c_n = b_n.c ().back (); // Get ref to the new node.


DOMElement* c_dom_n = doc->createElement(
  xml::transcode< char >("c")); // Create a dom node for the new tree node.

b_n._node ()->appendChild (c_dom_n); // Add to our parent.
c_n._node (c_dom_n);                 // Establish association.


c_dom_n->appendChild(
  doc->createTextNode(xml::transcode< char >("XML Parsing Tools")));

hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20060411/c5c2f4d2/attachment.pgp


More information about the xsd-users mailing list