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 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

Related Questions

Really struggling to figure this out. Just trying to take in data from php
Struggling to understand why the foreach loop in the function doesn't print out all
Really struggling to work this out... I have a text file with data like
Struggling in vain to extract the value of the Status descendant from an XML
Im struggling here for a lot, Im trying to upload an image from iphone
Struggling with command line again, I have figure out that I can store the
Struggling to parse this JSON response from http://api.twitter.com/1/trends/current.json using foreach ($json_output->trends[0] as $trend )
I´m struggling to understand this concept: I have a fixed size definition: (from http://msdn.microsoft.com/pt-br/library/aa931918.aspx
Really struggling with this one: I have an existing foreach, containing an if loop
Im struggling to find an answer for this one. I've found out how to

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.