问题描述
我不确定如何在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规范的当前版本,
因此,没有关系,假设最终读取您的XML的系统符合要求.
So no, it shouldn't matter, assuming that the system which eventually reads your XML is compliant.
这篇关于xmlns元素的顺序重要吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!