tags:

views:

28

answers:

2

< os owner="microsoft" version="windows xp" link="microsft.com/windows98" information="microsoft.com/windows98/more_info" / >
< os owner="microsoft" version="windows 2000" link="microsft.com/windows2000" information="microsoft.com/windows2000/more_info" / >
< os owner="microsoft" version="windows windows 7" link="microsft.com/windows7" information="microsoft.com/windows7/more_info" / >
< os owner="Fedora" version="Fedora core 4" link="fedora.com/4" information="fedora.com/4/more_info" / >
< os owner="Fedora" version="Fedora core 5" link="fedora.com/5" information="fedora.com/6/more_info" / >
< os owner="Fedora" version="Fedora core 6" link="fedora.com/6" information="fedora.com/6/more_info" / >
< os owner="Fedora" version="Fedora core 7" link="fedora.com/7" information="fedora.com/7/more_info" / >
< os owner="Fedora" version="Fedora core 8" link="fedora.com/8" information="fedora.com/8/more_info" / >
< os owner="Fedora" version="Fedora core 9" link="fedora.com/9" information="fedora.com/9/more_info" / >
< os owner="Fedora" version="Fedora core 10" link="fedora.com/10" information="fedora.com/10/more_info" / >
< os owner="Redhat" version="Redhat 4" link="redhat.com/4" information="redhat.com/4/more_info" / >
< os owner="Redhat" version="Redhat 5" link="redhat.com/5" information="redhat.com/5/more_info" / >
< os owner="Redhat" version="Redhat 6" link="redhat.com/6" information="redhat.com/6/more_info" / >
< os owner="Redhat" version="Redhat 7" link="redhat.com/7" information="redhat.com/7/more_info" / >
< os owner="Redhat" version="Redhat 8" link="redhat.com/8" information="redhat.com/8/more_info" / >
< os owner="Redhat" version="Redhat 9" link="redhat.com/9" information="redhat.com/9/more_info" / >
< os owner="Redhat" version="Redhat 2010" link="redhat.com/2010" information="redhat.com/2010/more_info" / >

I m already getting owner name as microsoft, now I want to show the versions,link and infomramtion of the particular owner

How can I pass the "microsoft" and show only the results of microsoft

How this can be done in Javascript
Please help

Thanks in advance
Dave

A: 

if your information is in XML i guess you could use xpath with something like

//os[@owner="microsoft"]/

the problem is that you would have to use a library or something to execute xpath queries in JS (http://www.w3schools.com/Xml/xml_parser.asp)... i think that MooTools can load an xml to the DOM and then use selectors like

$$('os[owner="microsoft"]')

I am not really sure about that one... and my last guess is that you could use regular expresions to do extract the lines

pleasedontbelong
yes you are correct. all information is coming from xml only. and if possible I m ready to go ahead with jquery :)Thanks
dave
A: 

You can try for example to convert your xml data to DOM for example with respect of http://outwestmedia.com/jquery-plugins/xmldom/ jQuery plugin and use different jQuery selectors (see http://api.jquery.com/category/selectors/) to choose or find only the elements of XML which you need.

Another way could be converting your XML data to the JSON data with respect of a solution which you could find in the internet (see http://www.thomasfrank.se/xml_to_json.html for example). The JSON data can be convertet to JavaScript objects with JSON.parse. Then you can easy iterate through the javascript object without or with jQuery.

Oleg
Thanks Oleg, I m able to load the xml. And Even I m able to load the owners in one dropdown by grouping their name. so after the owner name is selected other results are suppose to be shown. Thanks
dave
You can consider to load xml directly with respect of `jQuery.ajax` (see http://api.jquery.com/jQuery.ajax/) or `jQuery.get` (see http://api.jquery.com/jQuery.get/). Then you can easy to analyze the loaded xml data. In general I recommend you to use jQuery if you not yet do this already.
Oleg
Thanks to all of you. The solution is I need to run a for loop (i=0;i<xyz.length;i++)and inside loop, i'll be checking for the values of i with if statement. and that'll filter the results.This Idea was suggested by one of the subscriber at stackoverflow Thanks all of you again
dave