parsing tags

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
   I have some custom tags I'm parsing, they look like this:

<edit name="some_value" name2="some_value" name3="value with spaces">

I had just been splitting on whitespace, until I though of the value
with  whitespace already in it:


   Is there a lightweight easy way to do this in PHP? In perl this is
neither easy and lightweight.


Re: parsing tags

Quoted text here. Click to load it

How about removing the tag title and the trailing > and splitting on
'/" /'?

Re: parsing tags

Captain Paralytic wrote:
Quoted text here. Click to load it

   Genius. I like that a lot.

  I think I'll split on '/"\s+/'

   What happens if this should occur?:

$key = '';
$key2 = ' A';

$ARRAY[$key] = 'some_val';
$ARRAY[$key2] = 'some_val';

 From my code with $key2 it looks like the leading space is ignored as I
can retrieve this with: $ARRAY['A']. I'll run some more tests shortly as
I may be confused as that doesn't seem right.


Site Timeline