Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5843651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:11:02+00:00 2026-05-22T12:11:02+00:00

Given the following XML document for example: <?xml version=1.0?> <UrdaObject> <Date> <Year>2011</Year> <Month>5</Month> <Day>18</Day>

  • 0

Given the following XML document for example:

<?xml version="1.0"?>
<UrdaObject>
  <Date>
    <Year>2011</Year>
    <Month>5</Month>
    <Day>18</Day>
    <Hours>8</Hours>
    <Minutes>47</Minutes>
    <Seconds>36</Seconds>
  </Date>
  <random_value>24</random_value>
</UrdaObject>

And the understanding the child::node() - Selects all child nodes of the current node how would I create an XPath (starting from the root) that would select all child nodes EXCEPT text, comments, and other things that are NOT elements. For example, when using this code to create a tree view in WPF:

// x is some XmlDocument, xmlTree is my WPF TreeView
XmlDataProvider provider = new XmlDataProvider();
provider.Document = x;
Binding binding = new Binding();
binding.Source = provider;
binding.XPath = "child::node()";
xmlTree.SetBinding(TreeView.ItemsSourceProperty, binding);

How would I go about creating my XPath statement so I build a treeview with nodes going all the way down and stopping before the raw text? For example it would generate a view of:

UrdaObject
  Date
    Year
...

Instead of…

UrdaObject
  Date
    Year
      2011 (Don't want this!)
...

The sample XML files is just for me to explain my situation. The expression should be able to navigate any valid XML file and pull the elements, but not the individual text.


How did we fix this? I had switched all references of child::node() to child::*. However, I had NOT corrected one line in my XAML, which was pulling child::node(). Correcting this line made the application behave correctly… and made me feel silly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:11:03+00:00Added an answer on May 22, 2026 at 12:11 pm

    child::node() finds all child nodes. child::* finds all element nodes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following XML file: <?xml version=1.0 encoding=UTF-8?> <process name=TestSVG2 xmlns=http://www.example.org targetNamespace=http://www.example.org xmlns:xsd=http://www.w3.org/2001/XMLSchema> <sequence>
Given the following xml document (assuming more books then actually listed) and using the
Given the following XML document: <Include> <Feature Title=A> <Feature Title=1 /> <Feature Title=2 />
Given the following partial XML document: <section> <entry typeCode=DRIV> <act classCode=AT moodCode=DEF> <statusCode code=completed/>
Given the following xml document <root> <childnode0/> <childnode2/> <!--Comment1--> <childnode3/> <childnode4/> <!--Comment2--> </root> I
Given the following xml: <Document xmlns=urn:company.com:catalog.01 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance> <book> <author>Wells</author> </book> </Document> With Xerces the
Given the following XML <?xml version=1.0?> <Message> <ArrayOfStock xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema> <Stock> <StockID>9cddb639-25ee-4415-be07-3109e5ae9883</StockID> <Description>Stock Item
Given this xml document: <?xml version=1.0 encoding=UTF-8?> <mydoc> <foo f=fooattr> <bar r=barattr1> <baz z=bazattr1>this
Given the following XML: <current> <login_name>jd</login_name> </current> <people> <person> <first>John</first> <last>Doe</last> <login_name>jd</login_name> </preson> <person>
Given the following XML structure <html> <body> <div> <span>Test: Text2</span> </div> <div> <span>Test: Text3</span>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.