Create a specific tag with SimpleXMLElement

Discussion in 'PHP' started by 50inches, Jan 31, 2012.

  1. #1
    Hello, I am trying to create a sitemap.

    I need to create a specific tag with SimpleXMLElement. It needs to look like this:

    < mobile:mobile />

    So what I have tried is this:

    $url->addChild('mobile:mobile');

    But when it prints it out in the xml document, it looks like this:

    <mobile></mobile>

    Is that the same thing? If so, then I don't need any help, but if it's not, then please tell me how I can make that like the one at the top.

    Thanks in advance
     
    50inches, Jan 31, 2012 IP
  2. aidanriley

    aidanriley Banned

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    51
    #2
    Could you post the code for the url class and the addChild method please?
     
    aidanriley, Jan 31, 2012 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    Are you trying to create a SOAP request via simplexml? It's probably possible to hack something in there, but simplexml can't parse or create elements with a colon in them, with the exception of proper namespaces.
     
    jestep, Feb 1, 2012 IP