473,574 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: How to use MSXML2.DOMDocum ent in ASP?

hb
Hi,

I need to use MSXML2.DOMDocum ent in my ASP page. The following is my code:

xml.asp:
=====
<%
dim sx
sx="<root><a>te xt1</a><b>text2</b></root>"
dim xd
set xd=Server.Creat eObject("MSXML2 .DOMDocument")
xd.loadXML(sx)
Response.write xd.hasChildNode s
%>

Somehow, xd.hasChildNode s return False, i.e. there is nothing in the xd. I
guess the
error was caused by missing the path of the MSXML2 library file. It seems
like the
code doesn't know where the MSXML2.DOMDocum ent is. But the code didn't
generate any error.

Would you please tell me what I did wrong here? What should I do to let the
code
know where the MSXML2 library file is?

Thank you

hb
Jul 19 '05 #1
3 29283
hb wrote:
Hi,

I need to use MSXML2.DOMDocum ent in my ASP page. The following is my
code:

xml.asp:
=====
<%
dim sx
sx="<root><a>te xt1</a><b>text2</b></root>"
dim xd
set xd=Server.Creat eObject("MSXML2 .DOMDocument")
xd.loadXML(sx)
Response.write xd.hasChildNode s
%>
What do you get when you do:
Response.Write xd.xml
?

Somehow, xd.hasChildNode s return False, i.e. there is nothing in the
xd. I guess the
error was caused by missing the path of the MSXML2 library file.


No, that's not the issue. First of all, CreatObject is not using the name of
a file: it is looking up the GUID for the class specified in the argument in
the Registry. If it can't find it, you will get a "cannot create object"
error. Since you are not getting that error, and since the loadXML method is
not generating an error, I think you can rule that out as the cause of your
problem.

I tried your code and it returned True for me, so I suspect there is a
version issue. Verify that you have MSXML 3.0 or higher installed on the web
server. You can get the latest version of the MSXML Parser at the Microsoft
website.

HTH,
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2
hb
Thank you

hb
"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> wrote in message
news:ux******** ******@TK2MSFTN GP15.phx.gbl...
hb wrote:
Hi,

I need to use MSXML2.DOMDocum ent in my ASP page. The following is my
code:

xml.asp:
=====
<%
dim sx
sx="<root><a>te xt1</a><b>text2</b></root>"
dim xd
set xd=Server.Creat eObject("MSXML2 .DOMDocument")
xd.loadXML(sx)
Response.write xd.hasChildNode s
%>
What do you get when you do:
Response.Write xd.xml
?

Somehow, xd.hasChildNode s return False, i.e. there is nothing in the
xd. I guess the
error was caused by missing the path of the MSXML2 library file.


No, that's not the issue. First of all, CreatObject is not using the name

of a file: it is looking up the GUID for the class specified in the argument in the Registry. If it can't find it, you will get a "cannot create object"
error. Since you are not getting that error, and since the loadXML method is not generating an error, I think you can rule that out as the cause of your problem.

I tried your code and it returned True for me, so I suspect there is a
version issue. Verify that you have MSXML 3.0 or higher installed on the web server. You can get the latest version of the MSXML Parser at the Microsoft website.

HTH,
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 19 '05 #3
You're welcome. I hope that means your problem is solved.

Bob Barrows

hb wrote:
Thank you

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2792
by: JP SIngh | last post by:
Hi All I am trying to write a recursive function to list the managers and his employees in a tree like sctructure Manager 1 Emp1 Emp1.1 Emp 1.2 Emp 2
12
2126
by: Amanda | last post by:
I have tried everything with this! I get an error stating "Index was outside the bounds of the array" My code looks like this.... xmlDoc = New XmlDocument() xmlDoc.Load("xml.doc") xslDoc = New XslTransform()
1
1328
by: Kapil Shah | last post by:
Hello everybody, I am trying to develop code to use the correct version of XMLHTTP before using it to send SOAP envelope to WebService . The code I have written is as follows, function getWebServiceResultsAfterInit() { // Must be using IE for this to work if(window.ActiveXObject){ // Create the XML Document object
2
10497
by: Adrian | last post by:
hi I had the following code (fragment) in a VB6 app, what should the XML bits look like in VB.Net? Thanks Public Sub XML_list(ByVal xml As String) Dim xmldom As MSXML2.DOMDocument
4
7672
by: s_m_b | last post by:
Using w2k advanced server (test system is standard server) "Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocument") objXML.async = False objXML.setProperty "ServerHTTPRequest", True objXML.Load ("http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml") If objXML.parseError.errorCode <> 0 Then 'Response.Write...
4
6227
by: DaytonGary | last post by:
Please Help: I have this wonderful function that takes as input an XML as a string and an XSLT as a string and using the XSLT, transforms the XML returning the result... Public Function Trans(ByVal XMLStr As String, ByVal XSLTStr As String) As String Dim TransObj As New MSXML2.DOMDocument Dim OutputXML As New...
3
2344
by: mandanarchi | last post by:
Sub test() Dim myHTTP As MSXML2.xmlhttp Dim myDom As MSXML2.DOMDocument Dim orderno, errormsg, lineerr, lineerrmsg As MSXML2.IXMLDOMNode Dim myxml As String boundary = "-----------------------------29772313742745" myxml = "--" & boundary & vbCrLf & _
0
7805
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7726
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8237
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7817
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8098
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6454
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5301
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3741
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.