Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Some help with limiting records from XML

Status
Not open for further replies.

Kaanha

Programmer
Jul 27, 2005
2
US
Ok..I'm new to XML, but I've worked alot with mySQL and PHP so I understand the concepts that XML is using, I just don't know all the key terms and syntax and what not.

First, if I have an XML file with say 20 records and I only want to retrive the first 10, how can that be done, instead of returning all 20.

Second, with the same XML file if I want to move my pointer to Record 10 and retrive the next 5...how can that be done? (Basically I want to start my record pointer on record 10 instead of record 1 and grab the next 5).

I've done searchs but without knowing what things are called and having any idea of key words for XML or anything like that I'm at a bit of a lost on how to search for this.

All help is welcomed and I thnka everyone who helps me!
 
XML is not a database. It is structured data in the form of a string that uses tags to denote nodes.


The usual way to select node(s) from an XML file is using XPath:


XPath is used in within XSL stylesheets, or as part of DOM processing within a host programming language, such as PHP (which itself uses the sablotron XSLT extension functions to deal with XML).

The XPath to find the first 10 nodes and nodes 11-15 is simple:
Code:
mynode[position() < 11]

and

mynode[position() > 10 and position() < 16]
But to answer your question fully, we need to know what technologies you'll be using to process the XML.

Jon

"I don't regret this, but I both rue and lament it.
 
I will be using PHP to process all my XML. Can you provide an example using PHP or a website that can provide an example? Thanks for all your help, I'm currently looking up the XPath and reading up on that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top