I want to get the full parent node on a result of a search.
XML example:
<ItemNodeCollection>
<MaxProf>1</MaxProf>
<ItemNodes>
<ItemNode>
<Prop>
<Id>1</Id>
<Prof>0</Prof>
</Prop>
<MetaDatas>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
</MetaDatas>
</ItemNode>
<ItemNode>
<Prop>
<Id>2</Id>
<Prof>0</Prof>
</Prop>
<MetaDatas>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
</MetaDatas>
</ItemNode>
<ItemNode>
<Prop>
<Id>3</Id>
<Prof>1</Prof>
</Prop>
<MetaDatas>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
</MetaDatas>
</ItemNode>
</ItemNodes>
</ItemNodeCollection>
function searchXML():void
{
for each (var nodeXML:XML in xml..Prop.(Prof == 0))
{
trace("nodeXML = " + nodeXML);
}
}
Trace result:
<Prop>
<Id>1</Id>
<Prof>0</Prof>
</Prop>
<Prop>
<Id>1</Id>
<Prof>0</Prof>
</Prop>
Expected trace result
<ItemNode>
<Prop>
<Id>1</Id>
<Prof>0</Prof>
</Prop>
<MetaDatas>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
</MetaDatas>
</ItemNode>
<ItemNode>
<Prop>
<Id>2</Id>
<Prof>0</Prof>
</Prop>
<MetaDatas>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
<MetaData>
<Id>88</Id>
<Desc>code</Desc>
</MetaData>
</MetaDatas>
</ItemNode>
How can I achieve this expected XML result?
Thank you!