Another XML question

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

Another XML question

Post by phpwalker »

I've finally create a small piece of code that will check the pattern of the raw data(plain text), and convert it into XML file type if there's no error.

However, when I wanted to convert the XML file back to the plain text, I have no clue on how to do it.

I've read some SimlpeXML and find some tutorials, there's no tutorial for a beginner like me.

Thanks if someone can guide me throughout this.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

Post by phpwalker »

Ehm, but I wanted to know how to make this

Code: Select all

...
<name> phpwalker </name>
..
into this

Code: Select all

name: phpwalker
What function is suitable for this?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

If you knew regex reall well, you could maybe do something like that

Although, I would personally use a DOM which is easy to traverse and reformat your code as required...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'd suggest DOM over regex as well.
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

Post by phpwalker »

Do you guys mean XML DOM?

What requirement do I need to use XML DOM?

Before that, I also wanted to learn regex, please give me some guidance on that to solve the above problems.

Thanks for the helps.
Post Reply