a got this code in asp to construct a xml , to export it to a url
this is de asp code:
<%
SQL = "Select * from User where CodeUser in ("& request.form("C 1"
&")"
set rs = server.CreateOb ject("ADODB.Rec ordset")
rs.CursorType = 3
rs.Open SQL, ConnDB
do while not rs.eof
set xml=server.crea teobject("MSXML 2.DOMDocument.3 .0")
set raiz=xml.create Element("clickA PI")
xml.appendchild (raiz)
set head=xml.create processinginstr uction("xml","v ersion='1.0
encoding='ISO-8859-1'")
xml.insertbefor e head,raiz
set sendMsg=xml.cre ateelement("sen dMsg")
raiz.appendchil d(sendMsg)
set api_id=xml.crea teelement("api_ id")
api_id.Text = rs("id")
sendMsg.appendc hild(api_id)
set user=xml.create element("user")
user.Text = rs("user")
sendMsg.appendc hild(user)
set password=xml.cr eateelement("pa ssword")
password.Text = rs("password")
sendMsg.appendc hild(password)
set to_ =xml.createelem ent("to")
to_.Text = rs("PhoneMobile ")
sendMsg.appendc hild(to_)
set text=xml.create element("text")
text.Text = request.form("s ms_message")
sendMsg.appendc hild(text)
set from=xml.create element("from")
from.Text = rs("from")
sendMsg.appendc hild(from)
RS.MoveNext
xml.save (server.Mappath ("clickatell.xm l"))
Loop 'Volta ao Do while
'--------------------------------------------------------------------------------------------------------------
''' sending to Clicktell's system '''
set objXMLHTTP = CreateObject("M icrosoft.XMLHTT P")
objXMLHTTP.open "post", "http://api.clickatell. com/xml/xml", False
objXMLHTTP.send xml
'response.write "<xmp>" & objXMLHTTP.resp onseXML.xml & "</xmp>"
Dim RespText
Set xml = Server.CreateOb ject("Microsoft .XMLDOM")
Set root = xml.documentEle ment
' Allow the document to complete loading
xml.async = False
success = xml.loadXML(obj XMLHTTP.respons eText)
response.write objXMLHTTP.resp onseText
%>
the contructed xml is like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <clickAPI>
- <sendMsg>
<api_id>id</api_id>
<user>user</user>
<password>pas s</password>
<to>phone</to>
<text>message </text>
<from>from</from>
</sendMsg>
</clickAPI>
when i send this to the url, the xml returns with this message:
<?xml version="1.0" ?>
- <clickAPI>
- <xmlErrorResp >
<fault>XML error: no element found at line 1</fault>
</xmlErrorResp>
</clickAPI>
does someone know what is happening in this code??
someone said to me that could be de the line:
set head=xml.create processinginstr uction("xml","v ersion='1.0
encoding='ISO-8859-1'"),but i dont know what to do about it..
i hope someone can help about this erro
-
felipe_az
-----------------------------------------------------------------------
Posted via
http://www.codecomments.co
-----------------------------------------------------------------------