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

Oliver.Kowalke at infineon.com Oliver.Kowalke at infineon.com
Tue Apr 11 04:52:59 EDT 2006


Hi Boris,

>> if ( b_n)
>> {
>> 	xercesc::DOMElement * c_n = b_n->_node()
>> 						->getOwnerDocument()
>> 							->createElement(
>>
>> xml::transcode< char >("c") );
>
>b_n->c_n ().push_back (c_type ());
>c_type& new_c = b_n->c_n ().back ();
>
>>
>> c_n->appendChild(
>> 		c_n->getOwnerDocument()
>> 			->createTextNode(
>> 				xml::transcode< char >("XML Parsing
>> Tools") ) );
>
>The problems start here: new_c does not have a DOM node associated
>with it. I suppose I could extend the API to allow manually assigning
>DOM nodes to newly created tree nodes. My only concern is how useful
>would that be? In other words, once you added the text node to the
>new_c's underlying DOM node, what are you going to do with it?

The problems are caused by following:
Reading an xml document conforming to hello.xsd is working (I can
extract text and embedded xml document -> 'text', '<embed
xmlns="xyz"><t>some text</t></embed>' from the example).
Now I've problems to build an xml document with xsd generated classes
(especially the c-node which can contain text or xml document).

Question: How to build up xml document which contains nodes of type
xsd:any?

I tried to embed another xml document but failed by accessing the
DOMNode of the new c-node. 

xyz::embed_type e_n("test text");

abc::c_type c_n;
c_n.embed( e_n);
b_n->c().push_back( c_n);

abc::b_type::c::container::iterator i = b_n->c().begin();
abc::b_type::c::container::iterator e = b_n->c().end();
				
while ( i != e)
{
	abc::c_type & c_n( * i);

	for (
		xercesc::DOMNode * child = c_n._node()->getFirstChild();
		child != 0;
		child = child->getNextSibling() )
		{...}
	++i;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello.xsd
Type: application/octet-stream
Size: 900 bytes
Desc: hello.xsd
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20060411/ea8e6695/hello.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello.xml
Type: text/xml
Size: 248 bytes
Desc: hello.xml
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20060411/ea8e6695/hello.bin


More information about the xsd-users mailing list