xm2array function

E

~ el commandante ~

hi

i am looking for a xml2array or xml2list code.
I am searching for something in PHP but send me any code in any language
you have. I need first to understand the trick.
 
J

Joe Kesselman

i am looking for a xml2array or xml2list code.

Your question can't be answered as you've posed it.

XML is tree-structured data. How you convert that to an array or list is
going to depend on what kind of document you're working with, what
information you want to extract out of it, and how you want to organize
that information.

What are you actually trying to do? Specify exactly what kinds of input
you want to process, and exactly what output you want to produce, and an
answer becomes possible.


--
Joe Kesselman,
http://www.love-song-productions.com/people/keshlam/index.html

{} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
/\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
 
P

Peter Flynn

Your question can't be answered as you've posed it.

XML is tree-structured data. How you convert that to an array or list is
going to depend on what kind of document you're working with, what
information you want to extract out of it, and how you want to organize
that information.

What are you actually trying to do? Specify exactly what kinds of input
you want to process, and exactly what output you want to produce, and an
answer becomes possible.

You could start with the little demo I wrote many years ago which
converts an XML document to a CSV file. This is only meaningful for
"data" XML (I shudder to think what you would get if you tried it on a
TEI or DocBook document :)

The code is at
http://www.silmaril.ie/downloads/software/xml2csv/xml2csv.zip and I
assume it still works, but it comes with no guarantees whatsoever :)

(Incidentally, when I demo'd this at a course I taught at an early
SGML/XML conference, I was approached by an irate gentleman afterwards
who had just spent $30,000 on a consultant to write a C program to do
the same thing. He wanted to know what the hell I thought I was doing
making public a few lines of awk script...:)

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top