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

  • Home
  • SEARCH
  • 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 137727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:09:07+00:00 2026-05-11T07:09:07+00:00

I am struggling with a sensible logic loop for stripping out nodes from an

  • 0

I am struggling with a sensible logic loop for stripping out nodes from an XML file too large to use with XPath supporting .NET classes.

I am attempting to replace the single line of code I had (that called SelectNodes with an XPath query string) with code that does the same but uses an XmTextReader.

I have to go several levels down as illustraed by the previously used XPath query (which was for reference):

ConfigurationRelease/Profiles/Profile[Name='MyProfileName']/Screens/Screen[Id='MyScreenId']/Settings/Setting[Name='MySettingName'] 

I thought this would be annoying but simple. However, I just can’t seem to get the loop right.

I need to get a node, check a node under that to see if the value matches a target string and then walk down further if it does or skip that branch if it does’t.

In fact, I think my problem is that I don’t know how to ignore a branch if I’m not inetersted in it. I can’t allow it to walk irrelevant branches as the element names are not unique (as illustrated by the XPath query).

I thought I could maintain some booleans e.g. bool expectingProfileName that gets set to true when I hit a Profile node. However, if its not the particular profile node I want, I can’t get out of that branch.

So…hopefully this makes sense to someone…I’ve been staring at the problem for a couple hours and may just be missing something obvious…..

I’d like to post a portion of the file up but can’t figure out how so the structure is roughly:

ConfigRelease > Profiles > Profile > Name > Screens > Screen > Settings > Setting > Name 

I will know ProfileName, ScreenName and SettingName and I need the Setting node.

I am trying to avoid reading the whole file in one hit e.g. at app start-up because half the stuff in it won’t ever be used. I also have no control over what generates the xml file so cannot change it to say, produce multiple smaller files.

Any tips will be greatly appreciated.

UPDATE

I have re-opened this. A poster suggested XPathDocument which should have been perfect. Unfortunatley, I didn’t mention that this is a mobile app and XPathDocument is not supported.

The file isn’t large by most standards which is why the system was originally coded to use XmlDocument. It is currently 4MB which is apparently large enough to crash a Mobile App when it is loaded into an XmlDocument. It’s probably just as well it came up now as the file is epxected to get much bigger. Anyway, I am now trying the DataSet suggestion but am still open to other ideas.

UPDATE 2

I got suspiscious because quite a few people have said they would not expect a file this size to crash the system. Further experiments have shown that this is an intermittent crash. Yesterday it crashed everytime but this morning after I reset the device, I can’t reproduce it. I am now trying to figure out a reliable set of reproductive steps. And also decide the best way to handle the problem which I’m sure is still there. I can’t just leave it because if the app can’t access this file, it is useless and I don’t think can tell my users that they can’t run anything else on their devices when my app is running…….

  • 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. 2026-05-11T07:09:07+00:00Added an answer on May 11, 2026 at 7:09 am

    I’m adding this as the issue is now dead but the selected solution doesn’t match anything listed so far.

    Our technical architect took this issue over and decided that we should never have implemented Xml in the first place. This decision was partly due to this issue but also due to some complaints about the level of data transfer charges.

    His verdict is that we should have implemented a custom file format (with indexing) optimised for size and speed of query.

    So, the issue is on hold until that work is approved and properly specced.

    The end for now.

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

Sidebar

Ask A Question

Stats

  • Questions 130k
  • Answers 131k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer man nm Nm displays the name list (symbol table) of… May 12, 2026 at 6:10 am
  • Editorial Team
    Editorial Team added an answer The following blog post has a helper method that can… May 12, 2026 at 6:10 am
  • Editorial Team
    Editorial Team added an answer I’ve just spent several days procrastinating about exactly this question.… May 12, 2026 at 6:10 am

Related Questions

I am struggling with a creating a query. It is related to a large
I am struggling with a perceived conflict between tracking all my changes so I
I am struggling with the best way to handle a WPF application that has
I'm developing a sample application so that I can learn the ins and outs

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.