在samplexml.svg中有一个节点
我需要将“image1.png”替换为“image2.png”之类的其他值.请指导我如何使用示例代码.
我可以得到属性值“image1.png”.这是代码:
$xdoc = new DomDocument;
$xdoc->Load('samplexml.svg');
$tagName = $xdoc->getElementsByTagName('image')->item(0);
$attribNode = $tagName->getAttributeNode('xlink:href');
echo "Attribute Name : " . $attribNode->name . "
";
echo "Attribute Value : " . $attribNode->value;
这是samplexml.svg:
Test title如何以编程方式更改xlink:href值?