| ||||||||
GetElemPath MethodMCD_STR CMarkup::GetElemPath() const;
The In the following example XML document there are six elements: <config>
<diagnostics d="3">
<file>C:\temp\a.txt</file>
</diagnostics>
<diagnostics d="7">
<file>D:\temp\a.txt</file>
<proxy usedefault="true"/>
</diagnostics>
</config>
This code prints the paths for those six elements. xml.ResetPos();
while ( xml.FindElem("//*") )
printf( xml.GetElemPath() );
Every path is unique and provides a way of returning to the element (with the FindElem method) after navigating away from it. /config /config/diagnostics /config/diagnostics/file /config/diagnostics[2] /config/diagnostics[2]/file /config/diagnostics[2]/proxy However, if the first diagnostics element were removed, the second one would have the path originally associated with the first one. In other words, the path of an element can change when the document changes. See also GetChildElemPath and GetParentElemPath. |
|
Posted July 12, 2005 updated May 14, 2007. Question or comment about this article? ©Copyright 2008 First Objective Software, Inc. All rights reserved. |