[xml] libxml acts weird with nested single child



Hi there. I hope this is an appropriate forum for this question...

I am not on the list, so please cc me.

I have written a function that gets child structures from an xml doc. For
example, calling this function on this structure

<node>
  <sub-node1>content</sub-node1>
  <sub-node2>content</sub-node2>
</node>

would return a list containing each of the sub-nodes in a linked list.

My function works perfectly when there are multiple child nodes, however,
when there is only one child, the return value is:

<node>
  <sub-node>content</sub-node>
</node>

instead of just 

<sub-node>content</sub-node>

as I would expect.

I have attached a file with the function in question and more specific
output.

Thanks in advance,

-- Karim Nassar

Attachment: libxml-problem.txt
Description: Text document



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