Closed GoogleCodeExporter closed 9 years ago
xml_node is a handle class; you can have many xml_node instances for the same
tree node. If you want to associate additional data with a tree node, it has to
go to xml_node_struct.
What are 'left' and 'right' supposed to mean? For compatibility reasons you're
discouraged to modify pugixml sources; it's likely that there is an alternative
way to solve your problem.
Original comment by arseny.k...@gmail.com
on 23 Jun 2011 at 12:06
I am trying to implement Nested
Set(http://en.wikipedia.org/wiki/Nested_set_model), for my XML data to be
stored in MySQL. For that I would need a left and right value associated with
every xml_node. Please suggest if you can think of any alternative to achieve
this.
Original comment by devesh...@gmail.com
on 23 Jun 2011 at 12:34
Well, you can always store left/right indices externally, via something like
struct sql_binding_data { int left; int right; int depth; };
std::map<pugi::xml_node, sql_binding_data> sqlbd;
Since the tree in the DB is pretty much static anyway (changing the tree
structure will require updating 50% of DB on average, AFAICS), you don't even
need to keep this map up-to-date on node insertions/deletions because you don't
want to be doing the DB update for them except in huge batches anyway. And that
way the data that's rarely updated (left/right indices) & can become stale is
separated from the actual document structure.
Original comment by arseny.k...@gmail.com
on 23 Jun 2011 at 6:07
Thanks for the help moderator.
I was using the xml_tree_walker, trying to parse and extract the data from
multiple XMLs. Is there a way I could implement a different walker function for
every different xml file in my system?
Say XML file1 uses walker1 function and file2 uses walker2 function?
Original comment by devesh...@gmail.com
on 24 Jun 2011 at 9:07
You'll have to implement separate classes; of course, you can call
walker1/walker2 functions from tree_walker1::for_each & tree_walker2::for_each.
Alternatively, you can manually traverse the tree with a recursive function.
Original comment by arseny.k...@gmail.com
on 26 Jun 2011 at 1:41
Closing the issue; if there's anything else, feel free to update it and I'll
reopen it.
Original comment by arseny.k...@gmail.com
on 9 Jul 2011 at 1:05
Original issue reported on code.google.com by
devesh...@gmail.com
on 22 Jun 2011 at 11:47