2013-08-05 18 views
5

Googleの検索方法はわかりませんが、xmlns要素の問題はXMLファイルで問題になりますか? 私はASP.NET(VB)でXMLWriterを使用してXMLファイルを作成していますが、私が提供した例と一致させようとしています。xmlns要素の順序は関係しますか

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を生成します。

<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ファイル内に持っているものです。

<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/"> 

私が提供した例がある別の「NS」(名前空間?)」の番号でのxmlnsを実現しています。これらの事のどちらかが、私は私のファイルで大丈夫でしょうか?重要ですか?

おかげ

+0

私は問題を理解していません - 生成されたXMLは、プログラムが生成するように指定したものです(ns3とns4を使用します)。例と一致させたい場合は、ns3とns4行の順序を入れ替えてください。 – Tim

+1

これまで月曜日のうちの1つだけ持っていますか?私は writer.WriteStartElement( "ns2"、 "SubmitSMReq"、 "http:// somesite/schema") writer.WriteAttributeString( "xmlns"、 "ns4"、Nothing、 "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 ") それは完全に見える – gm77

+0

ええ - 私は今日自分でそれらの1つを持っています(コードではありません:) – Tim

答えて

6
the current version of the XML specificationによると

開始タグまたは空要素タグの属性指定の順序は重要ではありません。

だから、最終的にあなたのXMLを読むシステムが準拠していると仮定して、それは重要ではありません。

+0

ありがとう、私はできるだけ早く私の質問に答えるよ。 – gm77

関連する問題