This topic has
8
replies
on
1
page.
Adam_M.
Posts:5
Registered: 6/16/08
Hi,
I've been given the task of developing a new website for a charitable organisation. It is to be implemented on a Sun ASP based box where-as the development box is Microsoft ASP.
So far so good!
I'm now trying to process an XML file and failing miserably. My XML is thus:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<a>
<b c="C1">
<d e="E1" f="F1" />
</b>
<b c="C2">
<d e="E2" f="F2" />
</b>
<b c="C3">
<d e="E3" f="F3" />
</b>
</a>
And my ASP file is thus:
<%
With Response
.Buffer = True
.AddHeader "Pragma", "no-cache"
.CacheControl = "no-cache"
.Expires = -1
If Instr(Request.ServerVariables("HTTP_ACCEPT"), "application/xhtml+xml") > 0 Then
.ContentType = "application/xhtml+xml"
Else
.ContentType = "text/html"
End If
.Charset = "UTF-8"
End With
Dim objXML, objGroup, objItem
data = Replace(Split(Request.ServerVariables("SCRIPT_NAME"), "/")(UBound(Split(Request.ServerVariables("SCRIPT_NAME"), "/"))), ".asp", ".xml")
Set objXML = Server.CreateObject("MSXML2.DOMDocument")
Response.Write Server.MapPath(data) & "<br />"
With objXML
.load Server.MapPath(data)
Set objGroup = .getElementsByTagName("b")
Response.Write IsObject(objGroup) & "<br />"
Response.Write objGroup & "<br />"
Response.Write objGroup.length & "<br />"
'For Each objItem In objGroup.getElementsByTagName("b")
' Response.Write objItem & "<br />"
'Next
Set objGroup = Nothing
End With
Set objXML = Nothing
%>
No matter what I try I can't seem to get objGroup.length to return anything other than 0 and thus can't process any of the elements.
Can anyone please advise?
Cheers,
Adam M.
What version of asp are you running?
Adam_M.
Posts:5
Registered: 6/16/08
Not sure - how can I find out using ASP (not my server).
Cheers
I'm not aware of any way other than from the command line or the admin control panel.
If you are using anything other than 4.0.2 (preferably 4.0.3) you are probably wasting your time.
I'd ask your supplier what the version is. Bear in mind even 4.0.2 is a number of years old.
Duncan
Adam_M.
Posts:5
Registered: 6/16/08
Hi,
Thanks for the responses so far.
I can now confirm the version is 4.0.2.
King regards.
you might want to upgrade to 4.0.3 because of potential security vulnerabilities in 4.0.2
Con you create an object like msxml?? I doubt if that is available on a non microsft server (that is likely to be the hosted server)...
Yes you can check out the docs. You may need to do some port specific coding but that should be fairly easy to do.
That said Sun One ASP is way out of date and appears to have been shelved so I wouldn't bother using it for any new development.
Duncan
i know thisthread is old but:
i think the problem is your code not ASP...
try
Set objGroup = objXML.getElementsByTagName("b")
I don't thnk you can mix the "with" statement with the "se"t statement
This topic has
8
replies
on
1
page.
Back to Forum
Read the Developer Forums Code of Conduct
Email this Topic
Edit this Topic
Site Upgrade
Forums 7.1.8 was deployed Oct 26th. The release consists of minor fixes & a few enhancements.
Forums Statistics
Users Online : 54 Guests : 135
About Sun forums
Sun Forums is a large collection of user generated
discussions. It is here to help you ask questions, find answers, and
participate in discussions.
Check out our guide on Getting
started with Sun Forums for a full walkthrough of how to best
leverage the benefits of this community.