Hi,
How do I output attributes from an XML document? I have tried using the
following example on Microsofts website.

MS EXAMPLE:
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
var nodeBook, sIdValue;
xmlDoc.async = false;
xmlDoc.load("books.xml");
nodeBook = xmlDoc.selectSingleNode("//book");
sIdValue = nodeBook.getAttribute("id")
alert(sIdValue);

Thanks!!
Carl


 MY CF CODE

<!--- MSXML Parser Object --->
<cfobject action="create" type="COM" class="Microsoft.XMLDOM" name="Parser">
<cfset Parser.Async = false>
<cfset Parser.Load("prequal_response.xml")>
<cfif not parser.hasChildNodes()>
       <cfthrow message="Empty XML Tree:  This application is unavailable at
this time.">
</cfif>

<cfset root = Parser.documentElement>  <!--- Get Root of XML --->

<cfset records = Parser.selectNodes("//Service_Availability")>  <!--- get at
the nodes --->

<cfscript>i=0;</cfscript> <!--- query result counter --->

<cfloop collection="#records#" item="service">  <!--- Loop thru, get child
nodes and set vars --->
     <cfscript>
     i=i+1;
     nodeOffer_Id = service.selectSingleNode("//Offer_Id");
     Offer_Id = nodeOffer_Id.text;
     Offer_Code = nodeOffer_Id.getAttribute("Offer_Code");
     </cfscript>

     <cfoutput>
      #i#. #Offer_Code#<br>
     </cfoutput>
</cfloop>


********  XML DOC   ******************

<?xml version='1.0' standalone='no'?>
<!DOCTYPE Action_Response SYSTEM
"http://server/dir/Non_State_Action_Response.dtd";>
<!--  CC_ID_PREQUAL_RESPONSE_TMPL[] =
"@(#)/dir/PreQual_Response.tmpl@@/main/5"  -->
<Action_Response>
<Transaction_Id>061901-1</Transaction_Id>
<Return_Code Return_Code = '00'/>
<DSL_Id Master_Id='' Correlation_Id='' IA_Login=''>111</DSL_Id>

<Service_Availability>
<Offer_Id Offer_Code='ASOM1'></Offer_Id>
<Offer_Name Name='144-144Kbps'></Offer_Name>
</Service_Availability>

<Service_Availability>
<Offer_Id Offer_Code='ASOM2'></Offer_Id>
<Offer_Name Name='192-192Kbps'></Offer_Name>
</Service_Availability>

<Service_Availability>
<Offer_Id Offer_Code='ASOM3'></Offer_Id>
<Offer_Name Name='384-384Kbps'></Offer_Name>
</Service_Availability>

<Service_Availability>
<Offer_Id Offer_Code='ASOM4'></Offer_Id>
<Offer_Name Name='768-768Kbps'></Offer_Name>
</Service_Availability>

<Service_Availability>
<Offer_Id Offer_Code='ASOM5'></Offer_Id>
<Offer_Name Name='1.1-1.1Mbps'></Offer_Name>
</Service_Availability>

<Service_Availability>
<Offer_Id Offer_Code='ASOS5'></Offer_Id>
<Offer_Name Name='144Kbps-IDSL'></Offer_Name>
</Service_Availability>

<Service_Availability>
<Offer_Id Offer_Code='ASOS3'></Offer_Id>
<Offer_Name Name='608-128Kbps'></Offer_Name>
</Service_Availability>

<Service_Availability>
<Offer_Id Offer_Code='ASOS4'></Offer_Id>
<Offer_Name Name='1.5Mbps-384Kbps'></Offer_Name>
</Service_Availability>


<Error_Info>
<Error_Code></Error_Code>
<Error_Message></Error_Message>
</Error_Info>

</Action_Response>


*****  ERROR MESSAGE I GET   *************
Error on Invoke for:

COM error 0x80020003. Member not found.

The error occurred while processing an element with a general identifier of
(CFSCRIPT), occupying document position (73:2) to (73:11) in the template
file C:\dsl_prequal.cfm.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to