xmlns元素的顺序重要吗 [英] Does the order of xmlns elements matter

查看:53
本文介绍了xmlns元素的顺序重要吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定如何在Google中搜索此内容,但是xmlns元素的问题在XML文件中是否重要?我正在使用ASP.NET(VB)中的XMLWriter创建XML文件,并且试图匹配提供的示例.

I'm not sure how to search google for this but does the matter of the xmlns elements matter in an XML File? I'm creating a XML file using XMLWriter in ASP.NET(VB) and I'm trying to match an example I was provided.

<ns2:SubmitSMReq xmlns:ns4="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns3="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-4" xmlns:ns2="http://somesite/schema">

这是我的vb文件中的内容:

This is what I have in my vb file:

writer.WriteStartElement("ns2", "SubmitSMReq", "http://schemas.xmlsoap.org/soap/envelope/")
writer.WriteAttributeString("xmlns", "ns3", Nothing, "http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-4")
writer.WriteAttributeString("xmlns", "ns4", Nothing, "http://somesite/schema")

但是它生成XML的方式有所不同.

But it generates the XML differently.

<ns2:SubmitSMReq xmlns:ns3="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-4" xmlns:ns4="http://somesite/schema" xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/">

我意识到所提供示例中的xmlns具有不同的"ns"(命名空间?)数字.这两个问题都重要吗?我应该对我的文件好吗?

I realize the xmlns in the provided example has different "ns" (namespace?)" numbers. Does either of these things matter? Should I be alright with my file?

谢谢

推荐答案

根据 XML规范的当前版本

开始标签或空元素标签中属性说明的顺序不重要.

the order of attribute specifications in a start-tag or empty-element tag is not significant.

因此,没有关系,假设最终读取您的XML的系统符合要求.

So no, it shouldn't matter, assuming that the system which eventually reads your XML is compliant.

这篇关于xmlns元素的顺序重要吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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