0

Possible Duplicate:
A simple program to CRUD node and node values of xml file

I have searched the net, without luck, allthough it might be out there.....Somewhere.

The company i work for, has a BIG xml file, with description and details of all our products. All products are made as a record with a lot of Props - in the xml file.

<RECORD>
<PROP NAME="Name">
<PVAL>Product 1</PVAL>
<PROP NAME="Value">
<PVAL>10</PVAL>
</PROP>
<RECORD>
<PROP NAME="Name">
<PVAL>Product 2</PVAL>
<PROP NAME="Value">
<PVAL>20</PVAL>
</PROP>

I'm not very familiar with xml files. So my first questions is: Is this a common known struckture, and why make it like this - whats the idea?

Second Question : In PHP, if I where to list all Props of a record (Searching for Name=?) what would my approach be ? Loading everthing into an array ?

Community
  • 1
  • 1
  • Well, if you google for https://www.google.de/search?q=record+prop+pval you will find that there is apparently other people using the same notation, so it seems to be some sort of standard XML format. As for how to list all props, you'd use an XML Parser for that. There is plenty of examples on how to do that on StackOverflow, so give it a search. – Gordon Oct 04 '12 at 10:31
  • Thanks Gordon. I will read up on the parser. The example is not very usefull in my case. I have many records with props, All named "RECORD" – Ulrik Vadstrup Oct 04 '12 at 10:37
  • Also see http://php.net/manual/en/simplexml.examples-basic.php and http://schlitt.info/opensource/blog/0704_xpath.html – Gordon Oct 04 '12 at 10:43

0 Answers0