HighTechTalks DotNet Forums  

Xpath syntax to get to element

Dotnet XML microsoft.public.dotnet.xml


Discuss Xpath syntax to get to element in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
sippyuconn
 
Posts: n/a

Default Xpath syntax to get to element - 11-17-2007 , 11:33 AM






Hi

I am trying to figure out the xpath syntax to get to all the element of name
<property name="Text">
ie
<property name="Text">Patient Name</property>

Any help is appreciated
Thanks

<XtraSerializer version="1.0" application="LayoutControl">
<property name="Items" iskey="true" value="33">
<property name="Item1" isnull="true" iskey="true">
<property name="ExpandButtonVisible">false</property>
<property name="ParentName" />
<property name="TextVisible">false</property>
<property name="GroupBordersVisible">true</property>
<property name="TypeName">LayoutGroup</property>
<property name="Size">@3,Height=136@4,Width=1020</property>
<property name="Name">Root</property>
<property name="OptionsItemText" isnull="true" iskey="true">
<property name="TextToControlDistance">0</property>
<property name="TextAlignMode">AlignLocal</property>
</property>
<property name="TextToControlDistance">0</property>
<property name="TextLocation">Top</property>
<property name="Padding">0, 0, 0, 0</property>
<property name="CaptionImageVisible">true</property>
<property name="TabbedGroupParentName" />
<property name="CaptionImageIndex">-1</property>
<property name="ExpandButtonLocation">Default</property>
<property name="Location">@1,X=0@1,Y=0</property>
<property name="Expanded">true</property>
<property name="ShowInCustomizationForm">true</property>
<property name="DefaultLayoutType">Vertical</property>
<property name="Spacing">0, 0, 0, 0</property>
<property name="CaptionImageLocation">Default</property>
<property name="Text">Root</property>
</property>
<property name="Item2" isnull="true" iskey="true">
<property name="MaxSize">@2,Height=46@1,Width=0</property>
<property name="Padding">5, 5, 0, 5</property>
<property name="TextSize">@2,Height=20@2,Width=81</property>
<property name="TypeName">LayoutControlItem</property>
<property name="MinSize">@2,Height=46@2,Width=61</property>
<property name="TextLocation">Top</property>
<property name="TextToControlDistance">0</property>
<property name="Location">@1,X=0@1,Y=0</property>
<property name="TextAlignMode">UseParentOptions</property>
<property name="TextVisible">true</property>
<property name="Text">Patient Name</property>
<property name="Size">@2,Height=46@3,Width=279</property>
<property name="Name">loPatientName</property>
<property name="ControlName">PatientName</property>
<property name="Spacing">0, 0, 0, 0</property>
<property name="ShowInCustomizationForm">true</property>
<property name="ParentName">Root</property>
<property name="SizeConstraintsType">Default</property>
</property>
</property>
</XtraSerializer>

Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: Xpath syntax to get to element - 11-17-2007 , 11:45 AM






sippyuconn wrote:

Quote:
I am trying to figure out the xpath syntax to get to all the element of name
property name="Text"
ie
property name="Text">Patient Name</property
At all levels:
//property[@name = 'Text']
At a certain level
/XtraSerializer/property/property/property[@name = 'Text']


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
  #3  
Old   
WenYuan Wang [MSFT]
 
Posts: n/a

Default RE: Xpath syntax to get to element - 11-19-2007 , 02:46 AM



Hello sippyuconn

It sounds you need xpath to select all the element by specific name,
correct? Please correct me if I misunderstood anything here. Thanks.

If this is the case, you may try (//property[@name='Text'])

For example:
foreach (XmlNode xn in curdoc.SelectNodes("//property[@name='Text']"))
{
Console.WriteLine(xn.InnerXml);
}

Hope this helps, please feel free to update here, if you have any more
concern. We are glad to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.