Skip to main content
Participant
September 19, 2008
Answered

XML not filtering

  • September 19, 2008
  • 2 replies
  • 511 views
Hello,

I've written code that loads in an XML file. Once loaded I can filter out a specific user by typing there name in and clicking a button. This works fine when the XML file only contains a few elements but when I load in a larger XML file the filter function doesn't work.

I know all the data is being loaded in, it just won't filter.

Any help would be greatly appreciated.

Thanks
Steve
This topic has been closed for replies.
Correct answer LAB618
Hello,

The double dot thing just threw up errors.

I fixed the problem, because you asked what the value of xmlListFiltered was I added a couple of trace statements to see how many elements were in xmlList and xmlListFiltered. The code was working and filtering properly but it showed that there were multiple elements with the same user name so xmlListFiltered was getting passed more than one element which caused the if statement not to run.

Thanks for your help.
Steve

2 replies

Participating Frequently
September 19, 2008
Did the xml schema change? If so, maybe you could use the double dot to access the node you want?

instead of this:
xmlListFiltered = xmlList.(User_Name == filter);

if(xmlListFiltered.User_Name == filter){


do this:

xmlListFiltered = xmlList..(User_Name == filter);

if(xmlListFiltered..User_Name == filter){


If that doesn't work, I need more info. Like, what's the xml schema? What's the value of xmlListFiltered when you load the large xml?
LAB618AuthorCorrect answer
Participant
September 20, 2008
Hello,

The double dot thing just threw up errors.

I fixed the problem, because you asked what the value of xmlListFiltered was I added a couple of trace statements to see how many elements were in xmlList and xmlListFiltered. The code was working and filtering properly but it showed that there were multiple elements with the same user name so xmlListFiltered was getting passed more than one element which caused the if statement not to run.

Thanks for your help.
Steve

Participating Frequently
September 19, 2008
Could you post a code sample?
LAB618Author
Participant
September 19, 2008
Here you go...