ozwolverine Posted September 28, 2006 Share Posted September 28, 2006 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:[code]$vendor = $xml-> mobil[0] -> addChild('vendor', 'Johnny');[/code]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:[code]$style = $xml-> office:automatic-styles[0] -> addChild('style:style', '');[/code]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 Link to comment https://forums.phpfreaks.com/topic/22424-urgent-help-accesing-tags-in-simplexmlelement/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.