Free2Code
 
Time: 2008-12-04, 08:52pm
parsing mixed XML content
Subject: parsing mixed XML content  ·  Posted: 2005-11-11, 07:20am
Rank: ? (2)
Member #: 25742
Hello,

I have an XML file such as:

<users>
<name>Joe</name>
...
</users>
<users>
<name>Joe1</name>
...
</users>
<users>
<name>Joe2</name>
...
</users>

now how can i grab only the name portions of the XML file and put them into an array. I have been trying different modules, but cant seem tot get it to work.

Any help would be great.



 
  Reply to this ·  Post link ·  Top
Subject: Re: parsing mixed XML content  ·  Posted: 2005-11-11, 11:46am
Rank: ? (171)
Member #: 11947
To parse the XML completely you need to use dynamic regular expressions (a regular expression in which it references itself).

The following regular expression will help you out.

/<name>\s*(\w+?)\s*<\/name>/

 
  Reply to this ·  Post link ·  Top
Subject: Re: parsing mixed XML content  ·  Posted: 2005-11-16, 06:07am
Rank: ? (2)
Member #: 25742
i was looking around today, and you can do this with the XML::XPath module.

 
  Reply to this ·  Post link ·  Top
Subject: Re: parsing mixed XML content  ·  Posted: 2006-03-01, 03:20am
Rank: ? (171)
Member #: 11947
I thought you wanted to do it the hard way

 
  Reply to this ·  Post link ·  Top

Pages: 1

Please login or register to post a reply.

icons