Nate,

The reading (parsing) of XML files is not a function of CF (5!) - with the
notable exception of WDDX (which requires that your xml conform to the wddx
schema in order for the parser to work).  Instead you may use one of the
many parsers with cfobject to do it - COM and JAVAX come to mind.  As far as
the "file" part of it, you can usally pass a variable to a parser that is a
file mapping or a URL or a string you create from whole cloth - or you can
create an XML "object" or "document" and serialize it (turn it into a
string) after adding the appropriate nodes and members. XML documentation
lingo often refers to "xml documents" - which makes people think of files on
a disk. That's misleading and it not the case as often as you might think.
We do a lot of XML (web services, distributed computing, data feeds etc.)
and virtually none of it is "stored" in an XML format - XML is just the
transport we are using because it provides a convieniently understood format
for data and components.

I might add that XMLDOM 3 comes with IE 5.5 and greater - which means the
this com object is probably already installed and usuable on your system.
While version 3 isn't reputed to be terribly scalable (ver. 4 is supposed to
be up to server standards), figuring out this object and it's methods is a
great way to introduce yourself to working with XML at a programatic level.
XMLDOM is fully documented on msdn.  Here's code snippet you could even try.
sorry if this message is a bit overkill <ha>.

Mark


***********************************

<cfsavecontent variable="strSoapRequest"><?xml version='1.0'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
        <SOAP-ENV:Body>
                <ContentRequest xmlns='www.mydomain.com'>
                        <REQUEST xsi:type="xsd:string">ImtheRequest</REQUEST>
                        <USERNAME xsi:type="xsd:string">ImtheUsername</USERNAME>
                        <PASSWORD xsi:type="xsd:string">blah</PASSWORD>
                        <ID xsi:type="xsd:string">ImTheID</ID>
                        <SYMBOLS xsi:type="xsd:string">ImTheSymbols</SYMBOLS>
                        <SEARCHSTRING 
xsi:type="xsd:string">ImtheSearchSTring</SEARCHSTRING>
                        <STORYNUMBER 
xsi:type="xsd:string">Imthestorynumbers</STORYNUMBER>
                </ContentRequest>
        </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</cfsavecontent>


<cfscript>
        // create a com object
        objSOAPDOM                      =       CreateObject("COM", 
"Microsoft.XMLDom");
        // Load the string as XML into the object
        objSOAPDOM.loadXML(trim(strSoapRequest));
        // writeout the XML - it is now a property of the object (not just a
string)
        writeoutput("<h4>XML from the object</h4>");
        writeoutput('<pre>' & htmleditformat(objSOAPDOM.xml) & '<pre>');
        writeoutput('<br><br>');
</cfscript>

<!--- Loop through the object and set each of the child nodes of "content
request" to be a
                key of a local variable called reqParams --->
<cfloop collection="#objSOAPDOM.selectNodes("//ContentRequest")#"
item="QuoteRequest">
          <cfscript>
                        ReqParams               =       StructNew();
                        objElements             =       
objSOAPDOM.getElementsByTagName("ContentRequest");
                        thisChild               =       QuoteRequest.firstChild;
                        WHILE(IsDefined('thisChild.NodeName'))
                        {
                                
StructInsert(ReqParams,thisChild.nodeName,thisChild.text);
                                thisChild       =       thisChild.nextSibling;
                        }
                        // Check out the key list for ReqParams
                        writeoutput('<b>ReqParams Keys are:  ' & 
StructKeyList(ReqParams) &
'</b><br>');
                </cfscript>
         <cfbreak>

</cfloop>

<cfabort>



-----Original Message-----
From: Nathan Chen [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 11, 2002 5:43 PM
To: CF-Talk
Subject: basics about how CF works with XML


Hi,
Can anyone give me an idea or a site that describes how CF server reads XML
files that contain data and how CF updates the data in those XML files?

Nathan



______________________________________________________________________
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to