Question about XPATH ...help

hi!
so here is the story , i am having a directory structure of my C drive inside an XML file which look something like below..

</ROOT>
<Directory DirName="Recycled">

<LogicalSize> 0</LogicalSize>

<LogAllocatedSize> 0</LogAllocatedSize>

<PhysicalSize> 0</PhysicalSize>

<LogicalLocation> 327687</LogicalLocation>

<CreateDate> 2005/01/07 20:35:43</CreateDate>

<AccessDate> 2005/01/07 00:00:00</AccessDate>

<ModifyDate> 2005/01/07 20:35:44</ModifyDate>

<Attributes> SH D</Attributes>

<File FileName="Cppt">

<LogicalSize> 10240</LogicalSize>

<LogAllocatedSize> 0</LogAllocatedSize>

<PhysicalSize> 10240</PhysicalSize>

<LogicalLocation> 262146</LogicalLocation>

<CreateDate> 2005/02/14 10:11:53</CreateDate>

<AccessDate> 2005/02/14 00:00:00</AccessDate>

<ModifyDate> 2005/02/14 10:11:54</ModifyDate>

<Attributes> A </Attributes>

<ChangeFlag> TRUE</ChangeFlag>

</File>
<File FileName="CDrivetxt">

<LogicalSize> 18</LogicalSize>

<LogAllocatedSize> 0</LogAllocatedSize>

<PhysicalSize> 18</PhysicalSize>

<LogicalLocation> 262149</LogicalLocation>

<CreateDate> 2005/02/14 10:12:00</CreateDate>

<AccessDate> 2005/02/14 00:00:00</AccessDate>

<ModifyDate> 2005/02/14 10:12:22</ModifyDate>

<Attributes> A </Attributes>

<ChangeFlag> TRUE</ChangeFlag>

</File>

</Directory>
<Directory DirName="unzipped">

<LogicalSize> 0</LogicalSize>

<LogAllocatedSize> 0</LogAllocatedSize>

<PhysicalSize> 0</PhysicalSize>

<LogicalLocation> 163794</LogicalLocation>

<CreateDate> 2005/01/12 17:37:35</CreateDate>

<AccessDate> 2005/01/26 00:00:00</AccessDate>

<ModifyDate> 2005/01/12 17:37:36</ModifyDate>

<Attributes> D</Attributes>

</Directory>

<File FileName="Cppt">

<LogicalSize> 10240</LogicalSize>

<LogAllocatedSize> 0</LogAllocatedSize>

<PhysicalSize> 10240</PhysicalSize>

<LogicalLocation> 262146</LogicalLocation>

<CreateDate> 2005/02/14 10:11:53</CreateDate>

<AccessDate> 2005/02/14 00:00:00</AccessDate>

<ModifyDate> 2005/02/14 10:11:54</ModifyDate>

<Attributes> A </Attributes>

<ChangeFlag> TRUE</ChangeFlag>

</File>
<File FileName="CDrivetxt">

<LogicalSize> 18</LogicalSize>

<LogAllocatedSize> 0</LogAllocatedSize>

<PhysicalSize> 18</PhysicalSize>

<LogicalLocation> 262149</LogicalLocation>

<CreateDate> 2005/02/14 10:12:00</CreateDate>

<AccessDate> 2005/02/14 00:00:00</AccessDate>

<ModifyDate> 2005/02/14 10:12:22</ModifyDate>

<Attributes> A </Attributes>

<ChangeFlag> TRUE</ChangeFlag>

</File>
</ROOT>

Or for more good view please check my attachment zip file it has proper XML file of directory structure.

Problem is , i want to write a XPATH which something like select all directories and files in proper way but files should be those who has Changflag=True ....
These files can be inside any hirarical structure of directroies or at the root of drive so i need all of them in their proper directories...hope i cleared what i am asking..:)

thanks in advance
helpppppppppp
[4261 byte] By [Wolvorine] at [2007-11-19 8:04:05]
# 1 Re: Question about XPATH ...help
Something like
//File[ChangeFlag/text()='TRUE']
Should get you the files.
While
//Directory[File/ChangeFlag/text()='TRUE']
Will give you the directories containing files with ChangeFlag True.
khp at 2007-11-10 3:27:38 >
# 2 Re: Question about XPATH ...help
thanks for the reply
//File[ChangeFlag/text()='TRUE'] is working fine but not showing all the directory hirarchies but when i use //Directory[File/ChangeFlag/text()='TRUE'] then it shows all the directories also including files which has Chang flag as FALSE...i need all directories and only those files which has TRUE changeflag.
The root node name is <ROOT> then it has all files and directories...

please help
Wolvorine at 2007-11-10 3:28:38 >
# 3 Re: Question about XPATH ...help
thanks for the reply
//File[ChangeFlag/text()='TRUE'] is working fine but not showing all the directory hirarchies but when i use //Directory[File/ChangeFlag/text()='TRUE'] then it shows all the directories also including files which has Chang flag as FALSE...i need all directories and only those files which has TRUE changeflag.
The root node name is <ROOT> then it has all files and directories...

please help

I'am not sure you are quite understanding what xpath is. Xpath can select single nodes or sets's of single nodes, in a document, it doesn't display any trees. And it doesn't remove or add nodes. The nodes it selects still live in the context of the original document.
To get the file directory path from a file you could recursivly run through it's parent nodes.

But if I'am understanding you correctly what you essentially want to do is take your XML file and remove all the filenodes that hasn't changed (and perhaps remove any empty directory nodes). For this you will need something more powerfull like XSLT.
khp at 2007-11-10 3:29:37 >
# 4 Re: Question about XPATH ...help
Could you give an example of XPATH selecting mutliple single nodes? For instance, a node is <P_Onset>, that has 12 child nodes called <sifor-array-element>1</sifor-array-element>...<sifor-array-element>12</sifor-array-element></P_Onset>

Thanks in advance
HackersInc at 2007-11-10 3:30:36 >
# 5 Re: Question about XPATH ...help
Could you give an example of XPATH selecting mutliple single nodes? For instance, a node is <P_Onset>, that has 12 child nodes called <sifor-array-element>1</sifor-array-element>...<sifor-array-element>12</sifor-array-element></P_Onset>

Thanks in advance

Then

//sifor-array-element would return all the sifor-array-elements in the document. Maybe multiple single nodes not the best term, the XPath specifications states that it returns a nodeset (a set of nodes). Exactly how it's returned is of course somewhat language dependent, I would think that the most commen way, would be to get an array of references to elements in the document.
khp at 2007-11-10 3:31:35 >