A
Alexander Mueller
Hi
i have an xml-doc in memory.
All nodes have a name-Attribute.
Some nodes have a name-attribute whose value is "Bill".
Bill-named nodes can be located at any
branching depth and index. Bills can contain other Bills.
Now i want to select all nodes named Bill.
Easy, SelectNodes.
The special thing is, that i don't want a flat list
of nodes to be returned.
I rather want the "partial tree".
That is: the parts of the original tree, that contain
a node named Bill down their branches shall be included.
All nodes below a Bill that don't contain another Bill indirectly
shall be stripped.
All nodes below root that don't contain any Bill directly or
indirectly shall be stripped, as well.
So I need something like a filter or a view on a tree.
It there a library, query-language, API or whatever
that has *built*-*in* support for returning tree-structures
a result of a query? (Doesn't need to be XML-orientated)
All help & hints very much appreciated,
Alex
Example:
*OriginalTree*:
0/Root
|--22/John
| |--16/Hilary
| |--19/Sue
|
|--98/Bill
|
|--23/Monica
| |--13/Bill
| |--199/Mabel
|
|
|--78/Ginger
| |--99/Fred
|
|--55/Harry
|--80/Sue
|--45/Bill
The desired result should look like:
*FilteredTree*:
0/Root
|
|--98/Bill
|
|--23/Monica
| |--13/Bill
|
|--55/Harry
|--80/Sue
|--45/Bill
All APIs I know (e.g. SelectNodes(xpathExpression),
return *flat* list/collections/arrays, like:
|--98/Bill
|--13/Bill
|--45/Bill
i have an xml-doc in memory.
All nodes have a name-Attribute.
Some nodes have a name-attribute whose value is "Bill".
Bill-named nodes can be located at any
branching depth and index. Bills can contain other Bills.
Now i want to select all nodes named Bill.
Easy, SelectNodes.
The special thing is, that i don't want a flat list
of nodes to be returned.
I rather want the "partial tree".
That is: the parts of the original tree, that contain
a node named Bill down their branches shall be included.
All nodes below a Bill that don't contain another Bill indirectly
shall be stripped.
All nodes below root that don't contain any Bill directly or
indirectly shall be stripped, as well.
So I need something like a filter or a view on a tree.
It there a library, query-language, API or whatever
that has *built*-*in* support for returning tree-structures
a result of a query? (Doesn't need to be XML-orientated)
All help & hints very much appreciated,
Alex
Example:
*OriginalTree*:
0/Root
|--22/John
| |--16/Hilary
| |--19/Sue
|
|--98/Bill
|
|--23/Monica
| |--13/Bill
| |--199/Mabel
|
|
|--78/Ginger
| |--99/Fred
|
|--55/Harry
|--80/Sue
|--45/Bill
The desired result should look like:
*FilteredTree*:
0/Root
|
|--98/Bill
|
|--23/Monica
| |--13/Bill
|
|--55/Harry
|--80/Sue
|--45/Bill
All APIs I know (e.g. SelectNodes(xpathExpression),
return *flat* list/collections/arrays, like:
|--98/Bill
|--13/Bill
|--45/Bill