XML文档必须具有顶级元素 [英] XML document must have a top level element

查看:139
本文介绍了XML文档必须具有顶级元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我有一个程序,它总是正常工作,当它传递一个xml文件时,它突然给了我

以下的消息我们的服务器程序:

错误代码:-1072896680原因:XML文档必须有顶级元素。

line#:0

我不喜欢我不知道它是我的xml文件还是其他东西?


这是我的客户端程序:

<%@ Language = vbScript %>

<%

设置xmlDom = CreateObject(" Microsoft.XMLDOM")

XMLDom.async =错误

xmlDom.load Server.MapPath(" 05272008ACTest.xml")

DataToSend = xmlDom.xml


dim xmlhttp

set xmlhttp = server.Createobject(" MSXML2.ServerXMLHTTP")

xmlhttp.Open" POST"," https:// www。 mydomain.com/ac/xt_ac_B2B.asp",false


xmlhttp.setRequestHeader" Content-Type"," application / x-www-form-urlencoded&


xmlhttp.send DataToSend

if(Err< 0)then

Response.Write(" A error从外部

来源检索数据时发生。< br />")

Response.Write(Err.Description)

Response.End

结束如果

错误转到0

''如果请求不正常则显示有关请求的详细消息

问题

if(xmlHttp.status< 200)then

Response.Write("远程服务器返回无效的状态代码:#8221;" ;

& _

xmlHttp.status& " " &安培; xmlHttp.statusText)& "< br>"

Response.Write(来自远程服务器的响应文本& _

""& xmlHttp.responseText)

Response.End

结束如果


如果xmlHttp.responseXML什么都不是那么

Response.Write (远程服务器没有返回xml内容。)

Response.End

结束如果

Response.ContentType = " text / xml"

Response.Write xmlhttp.responsexml.xml

设置xmlhttp =无

%>


和05272008ACTest.xml文件是这样的:

- < enrollment orderID =" 200808251114527143" PONumber =" 50000"
marketingCode =" E" productName =" adventureCenter">

< test> Y< / test>

< residency> US< / residency>

- < coverageOption>

< partI totalPartIPayment =" 12.55"> Y< / partI>

< partII totalPartIPayment =""> N< ; / partII>

< / coverageOption>

< tripName> European Tour< / tripName>

< enrollmentFee> 5.00< / enrollmentFee>

< totalPayment> 765.00< / totalPayment>

< tripDates departureDate =" 5/14/2007" returnDate = << 5/17/2007年" tripDays = QUOT; 4英寸/>

< numofParticipant> 3< / numofParticipant>

- <参与者>

<参与者firstName =" Cindy" MINIT = QUOT; B" lastName =" Rose"
birthdate =" 4/26 / 1955" tripCost = QUOT; 2500" partIPremium =" 187.50"

partIIPremium =" 25.00" />

< participant firstName =" Kathy" MINIT = QUOT; C" lastName =" Barlow"

birthdate =" 6/28/1944" tripCost = QUOT; 2500" partIPremium =" 262.50"

partIIPremium =" 35.00" />

< participant firstName =" Matthrew" MINIT = QUOT; d" lastName =" Kaminski"

birthdate =" 4/27 / 1933" tripCost = QUOT; 2500" partIPremium =" 300.00"

partIIPremium =" 45.00" />

< / participant>

< mailingInfo name =" Betty Sun" address =" 4406 Larwin ct。" city =" Concord"

state =" CA"省= QUOT;"拉链= QUOT; 12345" country =" United States" />

< email> su ****** @ yahoo.com< / email>

- < phone>

< homePhone number =" 4057887933"> Y< / homePhone>

< bizPhone> N< / bizPhone>

< / phone>

< enrollAgreement> Y< / enrollAgreement>

- < payment>

< method> card< / method>

< billingAddress name =" Betty Sun" street =" 4406 larwin ct。" city =" Concord"

state =" CA"省= QUOT;" country =" United States" />

< creditCard type =" visa"数= QUOT; 4XXXXXXXXXXXXXX" EXPDATE = QUOT;二千零七分之七" />

< / payment>

< / enrollment>


和我的服务器程序是这样的:


Dim xmlDoc,InstreamXMLRoot,TestFlag

设置xmlDoc = Server.CreateObject(" Microsoft.XMLDOM")

xmlDoc.Load请求'' - 这是通过正文发送的xml

Response.ContentType =" text / xml" '' - 测试计划


''***************************** ******

''服务器程序在这里抱怨,但有趣的是

是我在服务器上保存流并且文件看起来一样

因为它被传递了,它在浏览器中显示得非常好,我没有得到它!!!!!

''********* **************************

如果xmlDoc.parseError.errorCode< 0那么

调用UpdateXMLResponse(orderID,False,XML,错误代码:"

& xmlDoc.parseError.errorCode&" reason:"& xmlDoc .parseError.reason&" line

#:"& xmlDoc.parseError.line,"")

结束如果


IF isNULL(xmlDoc)然后

设置InstreamXMLRoot = Nothing

调用UpdateXMLResponse(orderID,False,XML,The服务器没有收到

XML流,"


结束如果


设置InstreamXMLRoot = xmlDoc.documentElement

IF isNULL(InstreamXMLRoot)然后

设置InstreamXMLRoot = Nothing

调用UpdateXMLResponse(orderID,False,XML,服务器没有收到

XML流,")


END IF

''在任何交易之前保存所有信息

xmlDoc.Save(Server.MapPath(" B2BResponse /" &安培;小时(现在)& " _" &安培;分钟(现在)&

" _" &安培; RandomNumber(1000000)& " _" &安培;月(现在)& " _" &安培;一天(现在)& " _" &

year(now)&" _B2BResponse.xml"))


-

Betty

解决方案

" c676228" < be *** @ newsgroup.nospamwrote in message

news:40 *************************** ******* @ microsof t.com ...


大家好,


我有一个程序当它将xml文件传递给我们的服务器程序时,它总是正常工作并且突然它给了我

以下消息:

错误代码:-1072896680原因:XML文档必须有一个顶级



元素。


line#:0

我不知道这是不是我的xml文件还是其他东西?



嗯,我看不到会导致此错误的任何内容。如果我们稍微调整一下代码,它可能会有所帮助。内联...


这是我的客户端程序:

<%@ Language = vbScript%>

<%

设置xmlDom = CreateObject(" Microsoft.XMLDOM")



使用MSXML2.DOMDocument.3.0


XMLDom.async = False

xmlDom.load Server.MapPath(" 05272008ACTest.xml")

< blockquote class =post_quotes>
DataToSend = xmlDom.xml



不需要上面的行,删除它。


>

dim xmlhttp

set xmlhttp = server.Createobject(" MSXML2.ServerXMLHTTP")



腰带和大括号使用MSXML2.ServerXMLHTTP.3.0


xmlhttp.Open" POST"," https ://www.mydomain.com/ac/xt_ac_B2B.asp" ;, false


xmlhttp.setRequestHeader" C ontent-Type",



" application / x-www-form-urlencoded"


>



您没有发送HTML表单帖子。你不需要上面的行删除

it


xmlhttp.send DataToSend



xmlHttp对象知道如何发送XML DOM将行更改为: -


xmlhttp.send xmlDom


注意这将添加正确的内容类型标题。


if(Err< 0)then

Response.Write("发生错误)从外部

来源检索数据时。< br />")

Response.Write(Err.Description)

回复.End

结束如果

错误转到0

''如果请求不正确则显示有关请求的详细消息

问题

if(xmlHttp.status< 200)then

Response.Write("远程服务器返回无效的状态码:



#8221;"


& _

xmlHt tp.status& " " &安培; xmlHttp.statusText)& "< br>"

Response.Write(来自远程服务器的响应文本& _

""& xmlHttp.responseText)

Response.End

结束如果


如果xmlHttp.responseXML什么都不是那么

Response.Write (远程服务器没有返回xml内容。)

Response.End

结束如果

Response.ContentType = "文本/ XML"



你应该从服务器获得UTF-8,这就是你想要的东西

发送添加: -


Response.CharSet =" UTF-8"


Response.Write xmlhttp.responsexml.xml



这实际上可能会破坏字符编码的使用: -


xmlhttp.responseXML.save响应


设置xmlhttp =没有

%>


和05272008ACTest.xml文件是这样的:


如果您在IE浏览器中发布了实际文件内容而不是看到的内容,那将会有所帮助。特别重要的是文件的开头。确保

文件一开始没有空格。也可以在记事本中打开文件然后

使用另存为来检查它的编码。


- < enrollment orderID =" 200808251114527143" PONumber =" 50000"
marketingCode =" E" productName =" adventureCenter">

< test> Y< / test>

< residency> US< / residency>

- < coverageOption>

< partI totalPartIPayment =" 12.55"> Y< / partI>

< partII totalPartIPayment =""> N< ; / partII>

< / coverageOption>

< tripName> European Tour< / tripName>

< enrollmentFee> 5.00< / enrollmentFee>

< totalPayment> 765.00< / totalPayment>

< tripDates departureDate =" 5/14/2007" returnDate = << 5/17/2007年" tripDays = QUOT; 4英寸



/>


< numofParticipant> 3< / numofParticipant>

- <参与者>

<参与者firstName = QUOT;辛迪" MINIT = QUOT; B" lastName =" Rose"
birthdate =" 4/26 / 1955" tripCost = QUOT; 2500" partIPremium =" 187.50"

partIIPremium =" 25.00" />

< participant firstName =" Kathy" MINIT = QUOT; C" lastName =" Barlow"

birthdate =" 6/28/1944" tripCost = QUOT; 2500" partIPremium =" 262.50"

partIIPremium =" 35.00" />

< participant firstName =" Matthrew" MINIT = QUOT; d" lastName =" Kaminski"

birthdate =" 4/27 / 1933" tripCost = QUOT; 2500" partIPremium =" 300.00"

partIIPremium =" 45.00" />

< / participant>

< mailingInfo name =" Betty Sun" address =" 4406 Larwin ct。" city =" Concord"

state =" CA"省= QUOT;"拉链= QUOT; 12345" country =" United States" />

< email> su ****** @ yahoo.com< / email>

- < phone>

< homePhone number =" 4057887933"> Y< / homePhone>

< bizPhone> N< / bizPhone>

< / phone>

< enrollAgreement> Y< / enrollAgreement>

- < payment>

< method> card< / method>

< billingAddress name =" Betty Sun" street =" 4406 larwin ct。" city =" Concord"

state =" CA"省= QUOT;" country =" United States" />

< creditCard type =" visa"数= QUOT; 4XXXXXXXXXXXXXX" EXPDATE = QUOT;二千零七分之七" />

< / payment>

< / enrollment>


和我的服务器程序是这样的:


Dim xmlDoc,InstreamXMLRoot,TestFlag

设置xmlDoc = Server.CreateObject(" Microsoft.XMLDOM")


再次使用MSXML2.DOMDocument.3.0


xmlDoc.Load Request'' - 这是通过xml发送的身体


Response.ContentType =" text / xml" '' - 测试计划


''***************************** ******

''服务器程序在这里抱怨,但有趣的是

是我在服务器上保存流并且文件看起来一样

因为它被传递并且它在浏览器中显示得非常好,我没有得到



它!!!!!


''******************************** ***

如果xmlDoc.parseError.errorCode< 0则

调用UpdateXMLResponse(orderID," False"," XML",错误代码: ;

& xmlDoc.parseError.errorCode&" reason:"& xmlDoc.parseError.reason&"



line


#:"& xmlDoc.parseError.line,"")

结束如果


IF isNULL(xmlDoc)然后

设置InstreamXMLRoot = Nothing

调用UpdateXMLResponse(orderID," False"," XML","服务器没有收到

的XML流,"


结束如果


设置InstreamXMLRoot = xmlDoc.documentElement

IF isNULL(InstreamXMLRoot)然后

设置InstreamXMLRoot = Nothing

调用UpdateXMLResponse(orderID," False" ,XML&q uot;,服务器没有收到

XML流,"


END IF

''在任何交易之前保存所有信息

xmlDoc.Save(Server.MapPath(" B2BResponse /" &安培;小时(现在)& " _" &安培;分钟(现在)



&


" _" &安培; RandomNumber(1000000)& " _" &安培;月(现在)& " _" &安培;一天(现在)& " _" &

year(now)&" _B2BResponse.xml"))



看不到你发送的是哪里XML响应。但是你可能想要在XML DOM中构建响应并使用: -


Response.ContentType =" text / xml" ''是的,将此行移至您发送的地址

响应

Response.CharSet =" UTF-8"

dom.Save Response

你也通过Http而不是https测试了你得到的结果是否相同。


进行一系列更改,看看它是否修复了问题(或者最少的休息时间)以一种不同的方式,我们可以帮助你;)

-

安东尼琼斯 - MVP ASP / ASP.NET




" c676228"写道:


和05272008ACTest.xml文件是这样的:

- < enrollment orderID =" 200808251114527143" PONumber =" 50000"
marketingCode =" E" productName =" adventureCenter">

< test> Y< / test>

< residency> US< / residency>



....


没有

<? xml ....?>

行。如果你只是通过MSIE查看XML文件,那行

*应该*出现。


有效标题行的一个例子是

<? xml version =" 1.0"编码= QUOT;窗口1252" ?>


(编码也可能是utf-8。许多网站也使用iso-8859-1但是

'几乎总是一个错误。)


" Old Pedant" < Ol ******* @ discuss.microsoft.com写信息

news:7B ********************* ************* @ microsof t.com ...


>

" c676228" ;写道:


和05272008ACTest.xml文件是这样的:

- < enrollment orderID =" 200808251114527143" PONumber =" 50000"
marketingCode =" E" productName =" adventureCenter">

< test> Y< / test>

< residency> US< / residency>



...


没有

<? xml ....?>

行。如果你只是通过MSIE查看XML文件,那行

*应该*出现。


有效标题行的一个例子是

<? xml version =" 1.0"编码= QUOT;窗口1252" ?>


(编码也可能是utf-8。许多网站也使用iso-8859-1但是

'几乎总是一个错误。)



XML声明不是强制性的;如果没有它,MSXML将很乐意加载XML

。然而,它可能更好,它存在。


-

安东尼琼斯 - MVP ASP / ASP.NET


Hi all,

I had a program and it always works fine and suddenly it gives me the
following message when a pass a xml file to our server program:
error code: -1072896680 reason: XML document must have a top level element.
line #: 0
I don''t know if it is my xml file or it is something else?

Here is my client side program:
<%@ Language=vbScript%>
<%
Set xmlDom=CreateObject("Microsoft.XMLDOM")

XMLDom.async =False
xmlDom.load Server.MapPath("05272008ACTest.xml")
DataToSend = xmlDom.xml

dim xmlhttp
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")

xmlhttp.Open "POST","https://www.mydomain.com/ac/xt_ac_B2B.asp",false

xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

xmlhttp.send DataToSend
if(Err <0) then
Response.Write("An error occured when retrieving data from an external
source.<br />")
Response.Write(Err.Description)
Response.End
end if
On error goto 0
''if request is not Ok then display detailed message about the request
problem
if(xmlHttp.status <200) then
Response.Write("The remote server returned an invalid statuscode: #8221;"
& _
xmlHttp.status & " " & xmlHttp.statusText) & "<br>"
Response.Write("response text from remote server" & _
" " & xmlHttp.responseText)
Response.End
end if

if xmlHttp.responseXML is nothing then
Response.Write("The remote server didna??t return xml content.")
Response.End
end if
Response.ContentType = "text/xml"
Response.Write xmlhttp.responsexml.xml
Set xmlhttp = nothing
%>

and 05272008ACTest.xml file is like this:
- <enrollment orderID="200808251114527143" PONumber="50000"
marketingCode="E" productName="adventureCenter">
<test>Y</test>
<residency>US</residency>
- <coverageOption>
<partI totalPartIPayment="12.55">Y</partI>
<partII totalPartIPayment="">N</partII>
</coverageOption>
<tripName>European Tour</tripName>
<enrollmentFee>5.00</enrollmentFee>
<totalPayment>765.00</totalPayment>
<tripDates departureDate="5/14/2007" returnDate="5/17/2007" tripDays="4" />
<numofParticipant>3</numofParticipant>
- <participants>
<participant firstName="Cindy" mInit="b" lastName="Rose"
birthdate="4/26/1955" tripCost="2500" partIPremium="187.50"
partIIPremium="25.00" />
<participant firstName="Kathy" mInit="c" lastName="Barlow"
birthdate="6/28/1944" tripCost="2500" partIPremium="262.50"
partIIPremium="35.00" />
<participant firstName="Matthrew" mInit="d" lastName="Kaminski"
birthdate="4/27/1933" tripCost="2500" partIPremium="300.00"
partIIPremium="45.00" />
</participants>
<mailingInfo name="Betty Sun" address="4406 Larwin ct." city="Concord"
state="CA" province="" zip="12345" country="United States" />
<email>su******@yahoo.com</email>
- <phone>
<homePhone number="4057887933">Y</homePhone>
<bizPhone>N</bizPhone>
</phone>
<enrollAgreement>Y</enrollAgreement>
- <payment>
<method>card</method>
<billingAddress name="Betty Sun" street="4406 larwin ct." city="Concord"
state="CA" province="" country="United States" />
<creditCard type="visa" number="4XXXXXXXXXXXXXX" expDate="7/2007" />
</payment>
</enrollment>

and My server program is like this:

Dim xmlDoc, InstreamXMLRoot, TestFlag

Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.Load Request ''--this is for xml sent via body

Response.ContentType = "text/xml" ''--for testing program

''***********************************
''the server program complains here, but the funny thing
is I save the stream on the server and the file looks the same
as it is passed and it displays in the browser very well, I don''t get it!!!!!
''***********************************
If xmlDoc.parseError.errorCode <0 Then
Call UpdateXMLResponse(orderID, "False", "XML", "error code: "
&xmlDoc.parseError.errorCode & " reason: " &xmlDoc.parseError.reason &" line
#: " &xmlDoc.parseError.line , "")
End If

IF isNULL(xmlDoc) Then
Set InstreamXMLRoot=Nothing
Call UpdateXMLResponse(orderID, "False", "XML", "The server didn''t receive
the XML stream", "")

END IF

Set InstreamXMLRoot=xmlDoc.documentElement
IF isNULL(InstreamXMLRoot) Then
Set InstreamXMLRoot=Nothing
Call UpdateXMLResponse(orderID, "False", "XML", "The server didn''t receive
the XML stream", "")

END IF
''Save all info before any transaction
xmlDoc.Save(Server.MapPath("B2BResponse/" & hour(now) & "_" & minute(now) &
"_" & RandomNumber(1000000) & "_" & month(now) & "_" & day(now) & "_" &
year(now) &"_B2BResponse.xml"))

--
Betty

解决方案

"c676228" <be***@newsgroup.nospamwrote in message
news:40**********************************@microsof t.com...

Hi all,

I had a program and it always works fine and suddenly it gives me the
following message when a pass a xml file to our server program:
error code: -1072896680 reason: XML document must have a top level

element.

line #: 0
I don''t know if it is my xml file or it is something else?

Hmm, I can''t see anything that would cause this error. It might help if we
tweak the code a bit. Inline ...

Here is my client side program:
<%@ Language=vbScript%>
<%
Set xmlDom=CreateObject("Microsoft.XMLDOM")

Use MSXML2.DOMDocument.3.0

XMLDom.async =False
xmlDom.load Server.MapPath("05272008ACTest.xml")

DataToSend = xmlDom.xml

Don''t need the above line, delete it.

>
dim xmlhttp
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")

Belts and braces use MSXML2.ServerXMLHTTP.3.0

xmlhttp.Open "POST","https://www.mydomain.com/ac/xt_ac_B2B.asp",false

xmlhttp.setRequestHeader "Content-Type",

"application/x-www-form-urlencoded"

>

You''re not sending a HTML form post. You don''t need the above line delete
it

xmlhttp.send DataToSend

The xmlHttp object knows how to send an XML DOM change the line to:-

xmlhttp.send xmlDom

Note this will add the correct content type header.

if(Err <0) then
Response.Write("An error occured when retrieving data from an external
source.<br />")
Response.Write(Err.Description)
Response.End
end if
On error goto 0
''if request is not Ok then display detailed message about the request
problem
if(xmlHttp.status <200) then
Response.Write("The remote server returned an invalid statuscode:

#8221;"

& _
xmlHttp.status & " " & xmlHttp.statusText) & "<br>"
Response.Write("response text from remote server" & _
" " & xmlHttp.responseText)
Response.End
end if

if xmlHttp.responseXML is nothing then
Response.Write("The remote server didn''t return xml content.")
Response.End
end if
Response.ContentType = "text/xml"

You should be getting UTF-8 from the server and that is what you want be
sending add:-

Response.CharSet = "UTF-8"

Response.Write xmlhttp.responsexml.xml

This can really mess up the character encoding use instead:-

xmlhttp.responseXML.save Response

Set xmlhttp = nothing
%>

and 05272008ACTest.xml file is like this:

It would help if you posted the actual file content rather than what is seen
in IE browser. Especially important is the start of the file. Make sure
the file has no whitespace at the start. Also open the file in notepad then
use Save As to check what encoding it is in.

- <enrollment orderID="200808251114527143" PONumber="50000"
marketingCode="E" productName="adventureCenter">
<test>Y</test>
<residency>US</residency>
- <coverageOption>
<partI totalPartIPayment="12.55">Y</partI>
<partII totalPartIPayment="">N</partII>
</coverageOption>
<tripName>European Tour</tripName>
<enrollmentFee>5.00</enrollmentFee>
<totalPayment>765.00</totalPayment>
<tripDates departureDate="5/14/2007" returnDate="5/17/2007" tripDays="4"

/>

<numofParticipant>3</numofParticipant>
- <participants>
<participant firstName="Cindy" mInit="b" lastName="Rose"
birthdate="4/26/1955" tripCost="2500" partIPremium="187.50"
partIIPremium="25.00" />
<participant firstName="Kathy" mInit="c" lastName="Barlow"
birthdate="6/28/1944" tripCost="2500" partIPremium="262.50"
partIIPremium="35.00" />
<participant firstName="Matthrew" mInit="d" lastName="Kaminski"
birthdate="4/27/1933" tripCost="2500" partIPremium="300.00"
partIIPremium="45.00" />
</participants>
<mailingInfo name="Betty Sun" address="4406 Larwin ct." city="Concord"
state="CA" province="" zip="12345" country="United States" />
<email>su******@yahoo.com</email>
- <phone>
<homePhone number="4057887933">Y</homePhone>
<bizPhone>N</bizPhone>
</phone>
<enrollAgreement>Y</enrollAgreement>
- <payment>
<method>card</method>
<billingAddress name="Betty Sun" street="4406 larwin ct." city="Concord"
state="CA" province="" country="United States" />
<creditCard type="visa" number="4XXXXXXXXXXXXXX" expDate="7/2007" />
</payment>
</enrollment>

and My server program is like this:

Dim xmlDoc, InstreamXMLRoot, TestFlag

Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")

Again use MSXML2.DOMDocument.3.0

xmlDoc.Load Request ''--this is for xml sent via body

Response.ContentType = "text/xml" ''--for testing program

''***********************************
''the server program complains here, but the funny thing
is I save the stream on the server and the file looks the same
as it is passed and it displays in the browser very well, I don''t get

it!!!!!

''***********************************
If xmlDoc.parseError.errorCode <0 Then
Call UpdateXMLResponse(orderID, "False", "XML", "error code: "
&xmlDoc.parseError.errorCode & " reason: " &xmlDoc.parseError.reason &"

line

#: " &xmlDoc.parseError.line , "")
End If

IF isNULL(xmlDoc) Then
Set InstreamXMLRoot=Nothing
Call UpdateXMLResponse(orderID, "False", "XML", "The server didn''t receive
the XML stream", "")

END IF

Set InstreamXMLRoot=xmlDoc.documentElement
IF isNULL(InstreamXMLRoot) Then
Set InstreamXMLRoot=Nothing
Call UpdateXMLResponse(orderID, "False", "XML", "The server didn''t receive
the XML stream", "")

END IF
''Save all info before any transaction
xmlDoc.Save(Server.MapPath("B2BResponse/" & hour(now) & "_" & minute(now)

&

"_" & RandomNumber(1000000) & "_" & month(now) & "_" & day(now) & "_" &
year(now) &"_B2BResponse.xml"))

Can''t see where you are sending the XML response. However you would
probably want to build the response in an XML DOM and use:-

Response.ContentType = "text/xml" '' Yes move this line to where you send the
response
Response.CharSet = "UTF-8"
dom.Save Response
Also have you tested via Http instead of https do you get the same result.

Make this bunch of changes see if it fixes things (or least breaks in a
different way that we can help you with ;)
--
Anthony Jones - MVP ASP/ASP.NET



"c676228" wrote:

and 05272008ACTest.xml file is like this:
- <enrollment orderID="200808251114527143" PONumber="50000"
marketingCode="E" productName="adventureCenter">
<test>Y</test>
<residency>US</residency>

....

There is no
<? xml .... ?>
line there. If you are simply viewing the XML file via MSIE, that line
*should* be showing up.

An example of a valid header line would be
<? xml version="1.0" encoding="windows-1252" ?>

(Encoding could also be "utf-8". Many sites also use "iso-8859-1" but
that''s almost always a mistake.)


"Old Pedant" <Ol*******@discussions.microsoft.comwrote in message
news:7B**********************************@microsof t.com...

>
"c676228" wrote:

and 05272008ACTest.xml file is like this:
- <enrollment orderID="200808251114527143" PONumber="50000"
marketingCode="E" productName="adventureCenter">
<test>Y</test>
<residency>US</residency>

...

There is no
<? xml .... ?>
line there. If you are simply viewing the XML file via MSIE, that line
*should* be showing up.

An example of a valid header line would be
<? xml version="1.0" encoding="windows-1252" ?>

(Encoding could also be "utf-8". Many sites also use "iso-8859-1" but
that''s almost always a mistake.)

An XML declaration is not mandatory; MSXML will quite happily load XML
without it. However it is probably bettter that it be present.

--
Anthony Jones - MVP ASP/ASP.NET


这篇关于XML文档必须具有顶级元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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