Re: Upgrade guidance



I suppose from your question that use use the DOM parser. The parser creates a xmlpp::Document, and that Document with all its nodes exists as long as the DomParser object exists. Both documents and nodes are non-copyable, but you can copy a pointer to a node, and access the node later through that pointer. Of course you must be sure not to dereference the pointer after the parser object has been deleted. And I'm uncertain how safe this strategy is, if you make changes to the parsed document (adding or deleting nodes, for example).

Saving the node's XPath and later retrieving the node with rootNode->find(xpath) should also work. I don't think the node's children would be included in the NodeSet that find() returns. You can easily test, I guess. XPath is very flexible. Depending on the exact contents of the XPath string, the result of the search can be quite different.

Kjell

Den 2015-09-21 kl. 21:42, skrev Park, Joseph:
Update: the port is essentially complete...

One issue is the ability to store a reference to a node for processing later/elsewhere in the code.  To clarify:

When processing a parsed document, there are instances when a node cannot be processed (the required objects created based on the xml node information) until later when some other needed objects have been instantiated.

In the ancient code we would just allocate a copy of the node on the heap and process it later as needed. 

I apologize for the nubile question! 

Would saving the Xpath from node->get_path(), and then later accessing via rootNode->find( Xpath ) be a reasonable solution?

Although i see that find() returns a NodeSet vector... which would presumably include the node referred to by Xpath and any children?

Thanks!

JP


On Tue, Jun 16, 2015 at 12:06 PM, Park, Joseph <joseph_park nps gov> wrote:
Ladies and Gents...

I am faced with the task of upgrading a hydrological simulation model [1] from an early libxml++ (libxml++-0.15.0) to a contemporary one (target libxml++-2.38.1).  The code is quite complex and XML parsing is replete.

It appears, as one would expect, that over the years libxml++ has fundamentally changed it's class structure, i.e. XMLNode in 0.15.0 is no longer defined.

So, I'm looking for guidance and suggestions on how to approach such an endeavor, in the hopes that someone has tread this path.



_______________________________________________
libxmlplusplus-list mailing list
libxmlplusplus-list gnome org
https://mail.gnome.org/mailman/listinfo/libxmlplusplus-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]