Jump to content


Photo

Urgent Help: Accesing tags in SimpleXMLElement


  • Please log in to reply
No replies to this topic

#1 ozwolverine

ozwolverine
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 28 September 2006 - 09:43 PM

Hello everybody,

I'm working with SimpleXMLElement to generate an xml file, but I'm having a problem, because all my tag names (odt xml files) have colons and dashes on it, for example: office:automatic-styles or style:style. the problem is because I use the following 'convention' to create child tags:

$vendor = $xml-> mobil[0] -> addChild('vendor', 'Johnny');

where mobil[0] is the first tag named mobil on the root tag.

so If I want to add a new tag that has the name: office:automatic-styles, how could I scape the colon and the dash? if I write this:

$style = $xml-> office:automatic-styles[0] -> addChild('style:style', '');

I get a bunch of errors.

I tried to scape them using a \ before each of these characters, but this didn't help.

Does anyone know what should I do?
I tryed putting the name of the tag in a string, but this does nothing, doesn't create the tag y the xml, nor throws any error message.

Help would be very appreciated.
Thanks





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users