By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,650 Members | 1,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,650 IT Pros & Developers. It's quick & easy.

question about asp& xml application

P: n/a

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("C1"
&")"
set rs = server.CreateObject("ADODB.Recordset")

rs.CursorType = 3
rs.Open SQL, ConnDB

do while not rs.eof

set xml=server.createobject("MSXML2.DOMDocument.3.0")

set raiz=xml.createElement("clickAPI")
xml.appendchild(raiz)

set head=xml.createprocessinginstruction("xml","versio n='1.0
encoding='ISO-8859-1'")

xml.insertbefore head,raiz

set sendMsg=xml.createelement("sendMsg")
raiz.appendchild(sendMsg)

set api_id=xml.createelement("api_id")
api_id.Text = rs("id")
sendMsg.appendchild(api_id)

set user=xml.createelement("user")
user.Text = rs("user")
sendMsg.appendchild(user)

set password=xml.createelement("password")
password.Text = rs("password")
sendMsg.appendchild(password)

set to_ =xml.createelement("to")
to_.Text = rs("PhoneMobile")
sendMsg.appendchild(to_)

set text=xml.createelement("text")
text.Text = request.form("sms_message")
sendMsg.appendchild(text)

set from=xml.createelement("from")
from.Text = rs("from")
sendMsg.appendchild(from)

RS.MoveNext

xml.save (server.Mappath("clickatell.xml"))
Loop 'Volta ao Do while
'--------------------------------------------------------------------------------------------------------------

''' sending to Clicktell's system '''

set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")

objXMLHTTP.open "post", "http://api.clickatell.com/xml/xml", False

objXMLHTTP.send xml

'response.write "<xmp>" & objXMLHTTP.responseXML.xml & "</xmp>"

Dim RespText

Set xml = Server.CreateObject("Microsoft.XMLDOM")
Set root = xml.documentElement

' Allow the document to complete loading
xml.async = False
success = xml.loadXML(objXMLHTTP.responseText)
response.write objXMLHTTP.responseText

%>

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>pass</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.createprocessinginstruction("xml","versio n='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
-----------------------------------------------------------------------

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> - <clickAPI>
- <sendMsg>
is there really a dash before the root document node?

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"felipe_azv" <fe***************@mail.codecomments.com> wrote in message
news:fe***************@mail.codecomments.com...
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("C1")
&")"
set rs = server.CreateObject("ADODB.Recordset")

rs.CursorType = 3
rs.Open SQL, ConnDB

do while not rs.eof

set xml=server.createobject("MSXML2.DOMDocument.3.0")

set raiz=xml.createElement("clickAPI")
xml.appendchild(raiz)

set head=xml.createprocessinginstruction("xml","versio n='1.0'
encoding='ISO-8859-1'")

xml.insertbefore head,raiz

set sendMsg=xml.createelement("sendMsg")
raiz.appendchild(sendMsg)

set api_id=xml.createelement("api_id")
api_id.Text = rs("id")
sendMsg.appendchild(api_id)

set user=xml.createelement("user")
user.Text = rs("user")
sendMsg.appendchild(user)

set password=xml.createelement("password")
password.Text = rs("password")
sendMsg.appendchild(password)

set to_ =xml.createelement("to")
to_.Text = rs("PhoneMobile")
sendMsg.appendchild(to_)

set text=xml.createelement("text")
text.Text = request.form("sms_message")
sendMsg.appendchild(text)

set from=xml.createelement("from")
from.Text = rs("from")
sendMsg.appendchild(from)

RS.MoveNext

xml.save (server.Mappath("clickatell.xml"))
Loop 'Volta ao Do while
'---------------------------------------------------------------------------
-----------------------------------
''' sending to Clicktell's system '''

set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")

objXMLHTTP.open "post", "http://api.clickatell.com/xml/xml", False

objXMLHTTP.send xml

'response.write "<xmp>" & objXMLHTTP.responseXML.xml & "</xmp>"

Dim RespText

Set xml = Server.CreateObject("Microsoft.XMLDOM")
Set root = xml.documentElement

' Allow the document to complete loading
xml.async = False
success = xml.loadXML(objXMLHTTP.responseText)
response.write objXMLHTTP.responseText

%>

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>pass</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.createprocessinginstruction("xml","versio n='1.0'
encoding='ISO-8859-1'"),but i dont know what to do about it..
i hope someone can help about this error

--
felipe_azv
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.