对于下面给出的XML,
val doc =
<library>
<videos>
<vid>Head</vid>
<video type="dvd">Seven</video>
<video type="blue-ray">The fifth element</video>
<video type="hardcover">Gardens of the moon</video>
</videos>
<books>
<book type="softcover">Memories of Ice</book>
</books>
</library>
需要更改XPATH中的内容:doc\("videos")\("vid")
作为<video type="usb">one</video>
因此,期望的输出是,
<library>
<videos>
<video type="usb">one</video>
<video type="dvd">Seven</video>
<video type="blue-ray">The fifth element</video>
<video type="hardcover">Gardens of the moon</video>
</videos>
<books>
<book type="softcover">Memories of Ice</book>
</books>
</library>
欢迎使用XPATH修改XML内容的任何想法!