Title: Message
 
-----Original Message-----
From: Dan Blackman [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 9:52 AM
To: [EMAIL PROTECTED]
Subject: RE: Reading an XML file using microsoft's xmlsdk COM

Wouldn't it be objXMLDOM.SelectSingleNode("/X12_4010_830/BFR/BFR01").
 
Shot in the dark but it seems to me if you are calling a method within the object that you should specify the object first...
 
Dan
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Ron Mast
Sent: Thursday, March 06, 2003 9:44 AM
To: [EMAIL PROTECTED]
Subject: Reading an XML file using microsoft's xmlsdk COM

Hi All,
I was following the xml documentation from the CF Developer's Journal CD and ran into a problem.  Can someone tell me what I'm doing wrong?

I went on Microsoft's site and downloaded the latest xmlsdk.exe and installed it on the server.

The following is my code:
<!---
XMLDOM Object
Now we have an XML file, but how do we access it from ColdFusion? Fortunately, Microsoft has provided us with an
XML parser COM object that is both powerful and easy to use. The object is called XMLDOM. You can download this
component from the Microsoft site for free. Windows 2000 ships with this COM object, but it's an older version
and I suggest you download and use the latest version. You can find this component on the Microsoft site by searching
for the Microsoft XML SDK
Once you download and install the component you can instantiate it in ColdFusion with the following syntax:
 --->

<cfobject type="COM"
name="objXMLDOM"
class="Microsoft.XMLDOM"
action="">

<!---
Once the object is created we can use the LOAD method to retrieve an XML file. Before we do this we want to set
the async property. The async property stands for asynchronous and tells the component to wait until the XML file
is loaded to continue. This is an important property to set. The default is true, which means your code will continue
before the file is loaded and you won't be able to access any of the data. Note that you must provide the full path
along with the file name as shown below:
 --->
 
<cfset objXMLDOM.async = false>
<CFSET objXMLDOM.LOAD("e:\wwwroot\wddx\rmast\XML\goodinstance.xml")>

<!---
We can find data in our XML file using the SelectSingleNode method. This method uses the XPath language to find a node.

The XPath language is very powerful, full-featured, searching language. We will cover only some of the basic searching
syntax. The XPath syntax is similar to a directory path in the file system. The top node is like the top directory that

contains the other nodes as directories. The following syntax would select the title node for our book:

SelectSingleNode("/book/title")

Once we have the book node we access the TEXT property to get the data contained in the tag. If we wanted to print out
the title in ColdFusion it would look like this:
 --->
 
<CFSET BFR01_node= SelectSingleNode("/X12_4010_830/BFR/BFR01")>
<CFOUTPUT>#BFR01_node.text#</CFOUTPUT>

My XML file looks like this:
<?xml version="1.0" ?>
- <X12_4010_830>
<BFR BFR01="05" BFR02="281" BFR04="SH" BFR05="A" BFR06="2003-01-07" BFR07="2003-04-07" BFR08="2003-01-07" />
</X12_4010_830>

When I ran it I received this error:
Error Occurred While Processing Request
Error Diagnostic Information
An error occurred while evaluating the expression:
 BFR01_node= SelectSingleNode("/X12_4010_830/BFR/BFR01")
Error near line 39, column 7.

Error resolving parameter SELECTSINGLENODE
ColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either:

    You have misspelled the parameter name, or
    You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.

The error occurred while processing an element with a general identifier of (CFSET), occupying document position (39:1) to (39:63).

Date/Time: 03/06/03 09:37:36
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)
Remote Address: 89.0.30.48     
Can someone tell me why I'm getting this error?   Thanks in advance for your help.

Ron Mast
Truth Hardware
Webmaster
(507)444-4748

Reply via email to