使用xmllint添加属性 [英] Add an attribute using xmllint

查看:99
本文介绍了使用xmllint添加属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 xmllint 向标签添加属性. 我可以通过xmllint做到吗?

I want to add an attribute to the tag, using xmllint. Can I do this is through xmllint?

推荐答案

Xmllint不能编辑XML,所以我认为答案是不,你不能".

Xmllint in not made to edit XML, so I think the answer is "no, you can't".

要编辑XML,可以使用XMLStarlet,将属性添加到现有XML文档中的语法是:

To edit XML, you can use XMLStarlet, the syntax to add an attribute into existing XML document is:

xmlstarlet ed -L -i xpath -t attr -n name -v value file

xmlstarlet ed -L -i xpath -t attr -n name -v value file

这篇关于使用xmllint添加属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆