以数字开头的 XML 标记名不起作用 [英] XML tagname starting with number is not working
问题描述
我想使用 Jenkins 构建更新组件 870Jars 的属性值.当我在 IE 中打开 xml 文件时,出现以下错误
I want to update the component 870Jars atrribute values using Jenkins build. When i open the xml file in IE, I am getting the below error
错误:-无法显示 XML 页面
Error:- The XML page cannot be displayed
名称以无效字符开头.处理资源 'https://svn.retailerinfo.com/svn/Stores/Po 时出错...
A name was started with an invalid character. Error processing resource 'https://svn.retailerinfo.com/svn/Stores/Po...
<870罐>---^
XML 文件:-
<?xml version="1.0" encoding="UTF-8"?><Application>
<app-name>Regist</app-name>
<baseline-version>Regist_R11.6.0.51</baseline-version>
<app-version>v11.6.0.51</app-version>
<defversion>1.0.0</defversion>
<component>
<870Jars>
<filename>v10.3.0-870Jars.zip</filename>
<targetfilename/>
<version>v10.3.0</version>
</870Jars>
</component>
</Application>
有什么办法可以让我的标签名称以数字开头吗?
Is there any way where i can start a tag name with a number ?
我用 </870Jars>
代替了 <870Jars> 但它只是打印值而不是作为标签工作
I used </870Jars>
in place of <870Jars> but it is just printing the value rather than working as tag
推荐答案
名称以数字开头的 XML 元素是非法 XML.你不应该从数字开始.
An XML element whose name starts with a number is illegal XML. You should not start with numbers.
XML 元素必须遵循以下命名规则:
XML elements must follow these naming rules:
- 名称可以包含字母、数字和其他字符
- 名称不能以数字或标点符号开头
- 名称不能以字母 xml(或 XML、Xml 等)开头
- 名称不能包含空格
可以使用任何名称,不保留任何字词.
Any name can be used, no words are reserved.
http://www.w3schools.com/xml/xml_elements.asp
这篇关于以数字开头的 XML 标记名不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!