Re: [xml] Two semantically identical files are being treated differently



using libxml2 2.6.26

David Grohmann wrote:
These 2 files have an element "PruningSection" which contain en element "Channels" that contains some text. These 2 files are extremely similar and I dont think they should be creating a node Tree any different than each other.

1) Why are these coming out different?

2) Is there a method (or group of methods put together) that will take a "PruningSection" node and return the "Channels" node no matter which of these 2 trees are passed in? (other than trying to fallow one pointer path vs trying to fallow the other path) something like give_me_the_node_below( parent_node, name_of_child_node) so more concretely

using the node variable from below
xmlNodePtr channel_node = give_me_the_node_below( node, "Channels")

Thank you - David

Trees described below:
first.xml:
(gdb) p *node
$40 = {
 _private = 0x0,
 type = XML_ELEMENT_NODE,
 name = 0x18489a3 "PruningSection",
 children = 0x1849c00,
 last = 0x1849da0,
 parent = 0x1849180,
 next = 0x1849e20,
 prev = 0x18493f0,
 doc = 0x1848d20,
 ns = 0x1848f90,
 content = 0x0,
 properties = 0x1849510,
 nsDef = 0x0,
 psvi = 0x0,
 line = 11,
 extra = 0
}
(gdb) p *node->children
$45 = {
 _private = 0x0,
 type = XML_TEXT_NODE,
 name = 0x2a9bb827c6 "text",
 children = 0x0,
 last = 0x0,
 parent = 0x1849490,
 next = 0x1849c80,
 prev = 0x0,
 doc = 0x1848d20,
 ns = 0x0,
 content = 0x1848a55 "\n    ",
 properties = 0x0,
 nsDef = 0x0,
 psvi = 0x0,
 line = 0,
 extra = 0
}
(gdb) p *node->children->next
$46 = {
 _private = 0x0,
 type = XML_ELEMENT_NODE,
 name = 0x1848a5b "Channels",
 children = 0x1849d00,
 last = 0x1849d00,
 parent = 0x1849490,
 next = 0x1849da0,
 prev = 0x1849c00,
 doc = 0x1848d20,
 ns = 0x1848f90,
 content = 0x0,
 properties = 0x0,
 nsDef = 0x0,
 psvi = 0x0,
 line = 12,
 extra = 0
}
(gdb) p *node->children->next->children
$47 = {
 _private = 0x0,
 type = XML_TEXT_NODE,
 name = 0x2a9bb827c6 "text",
 children = 0x0,
 last = 0x0,
 parent = 0x1849c80,
 next = 0x0,
 prev = 0x0,
 doc = 0x1848d20,
 ns = 0x0,
 content = 0x1849d80 "1:3,10:15,20",
 properties = 0x0,
 nsDef = 0x0,
 psvi = 0x0,
 line = 0,
 extra = 0
}
-----------------------------------------------------------------------------
second.xml:
(gdb) p *node
$48 = {
 _private = 0x0,
 type = XML_ELEMENT_NODE,
 name = 0x18a6b7f "PruningSection",
 children = 0x1864ff0,
 last = 0x1864ff0,
 parent = 0x18645e0,
 next = 0x0,
 prev = 0x0,
 doc = 0x18a6f00,
 ns = 0x18a7170,
 content = 0x0,
 properties = 0x1864940,
 nsDef = 0x0,
 psvi = 0x0,
 line = 3,
 extra = 0
}
(gdb) p *node->children
$49 = {
 _private = 0x0,
 type = XML_ELEMENT_NODE,
 name = 0x18a6c31 "Channels",
 children = 0x1865070,
 last = 0x1865070,
 parent = 0x18648c0,
 next = 0x0,
 prev = 0x0,
 doc = 0x18a6f00,
 ns = 0x18a7170,
 content = 0x0,
 properties = 0x0,
 nsDef = 0x0,
 psvi = 0x0,
 line = 4,
 extra = 0
}
(gdb) p *node->children->children
$50 = {
 _private = 0x0,
 type = XML_TEXT_NODE,
 name = 0x2a9bb827c6 "text",
 children = 0x0,
 last = 0x0,
 parent = 0x1864ff0,
 next = 0x0,
 prev = 0x0,
 doc = 0x18a6f00,
 ns = 0x0,
 content = 0x18650f0 "1:3,10:15,20",
 properties = 0x0,
 nsDef = 0x0,
 psvi = 0x0,
 line = 0,
 extra = 0
}


<?xml version="1.0" encoding="UTF-8"?> <NominalPruning xmlns="http://www.arlut.utexas.edu/esl/SPEAR/library/xml/NominalPruning-v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.arlut.utexas.edu/esl/SPEAR/library/xml/NominalPruning-v1 /opt/spear-dev/share/schemas/parameters-nominal-pruning-v1.xsd"> <PruningSection index="0" frequency_start_in_hertz="0" frequency_stop_in_hertz="10" azimuth_start_in_degrees="5" azimuth_stop_in_degrees="15" range_start_in_meters="1" range_stop_in_meters="INF"> <Channels>1:3,10:15,20</Channels> </PruningSection> </NominalPruning>

<?xml version="1.0" encoding="UTF-8"?> <NominalPruning xmlns="http://www.arlut.utexas.edu/esl/SPEAR/library/xml/NominalPruning-v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.arlut.utexas.edu/esl/SPEAR/library/xml/NominalPruning-v1 /opt/spear-dev/share/schemas/parameters-nominal-pruning-v1.xsd"> <PruningSection index="0" frequency_start_in_hertz="0.0E1" frequency_stop_in_hertz="10" range_start_in_meters="1" range_stop_in_meters="INF" azimuth_start_in_degrees="5" azimuth_stop_in_degrees="15"> <Channels>1:3,10:15,20</Channels> </PruningSection> </NominalPruning>

_______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml gnome org http://mail.gnome.org/mailman/listinfo/xml


-- 
David Grohmann
Senior Student Associate
Applied Research Lab : UT Austin : ESL - S206
Office: 512-835-3237



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