How do you rename a tag in SimpleXML through a DOM object?

后端 未结 4 512
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 00:51

The problem seems straightforward, but I\'m having trouble getting access to the tag name of a SimpleXMLElement.

Let\'s say I have the follow XML structure:

4条回答
  •  春和景丽
    2020-12-02 01:40

    Is this possible to do without doing a copy of the entire object?

    Nope, it's not.

    You could do it in XSLT via an "identity transform". If you search around for "rename tag" and "identity transform" you should find a few examples, assuming XSLT is an option.

提交回复
热议问题