Hi Guys,

I am developing an application in which i have xml file in which i want to search and display selected records from XML on web page.

In that application i will have A-z links when i link on A i should get all books starting with A from that XML. Is that possible if yes how , any idea of reference you can give me.

    Assuming you've loaded the XML into an XML structure of some sort ([man]DOM[/man] or [man]simplexml[/man]) then an XPath query could be used to search it for elements matching whatever criteria you're after.

      My XML file is very huge of about more then 5lac rows will that be fine to use it?

        In that case, you could either split the XML file into multiple files (one for each letter of the alphabet) and thus effectively do all your searching once and for all; or since (depending on how much consistency there is between the format of each record - which fields they have and so on) it sounds like you're talking about a table of data, store it as a table in a database. Getting it into the database would be best done by a stream-based XML parser ([man]xml_parse[/man]), which could, I guess, be used to search the XML for what you're after in the first place, but remember you'll be reading the entire file for every query.

          Write a Reply...