Ask a Question related to Macromedia ColdFusion, Design and Development.
-
DuLaus #1
Check for missing xml nodes or empty nodes
Hi,
Is it possible to check for missing or empty xml nodes "before" putting them
into a table or doing a XMLSearch . Sometimes the xml will come back with just
the root node present but everything else missing due to improper search
parameters. Other times some values are not present. (empty <nodes></nodes).
I would like to test if the xml root is valid or not broken eg:
<HotelRoomAvailabilityResults size='3'>
, then check for empy values in any particular node. eg:
<displayRoomRate>88.20</displayRoomRate>
Thanks
<HotelRoomAvailabilityResults size='1'>
<HotelRoomAvailabilityResult>
<hotelId>117086</hotelId>
<cancellationPolicy>Cancel by 4PM the day of arrival</cancellationPolicy>
<policy/>
<rateCode>RAC</rateCode>
<roomTypeCode>C1D</roomTypeCode>
<hrnQuoteKey/>
<rateDescription>Standard Rate</rateDescription>
<roomTypeDescription>STUDIO </roomTypeDescription>
<supplierType>S</supplierType>
<propertyType>H</propertyType>
<taxRate>12 PCT 3 PCT</taxRate>
<otherInformation/>
<rateChange>true</rateChange>
<guaranteeRequired>true</guaranteeRequired>
<depositRequired>false</depositRequired>
<immediateChargeRequired>false</immediateChargeRequired>
<currentAllotment>-1</currentAllotment>
<propertyId>014674</propertyId>
<promoDescription/>
<promoType/>
<promoDetailText/>
<bedTypes/>
<RateInfo>
<displayCurrencyCode>USD</displayCurrencyCode>
<displayRoomRate>94.81</displayRoomRate>
<nativeCurrencyCode>CAD</nativeCurrencyCode>
<nativeRoomRate>120.0</nativeRoomRate>
<rateFrequency>D</rateFrequency>
</RateInfo>
</HotelRoomAvailabilityResult>
--------------------------------------------------------------
<CFTRY>
<cfset room =QueryNew("hotelID, cancellationPolicy, roomTypedescription,
roomTypeCode, rateDescription,
RateInfo")>
<cfset temp = QueryAddRow(room, #size#)>
<cfloop index="i" from ="1" to =#size#>
<cfset temp = QuerySetCell(room, "hotelID", #hotelRoomAvailabilityResult[i
].hotelId.XmlText#, #i#)>
<cfset temp = QuerySetCell(room, "cancellationPolicy",
#hotelRoomAvailabilityResult[i ].cancellationPolicy.XmlText#, #i#)>
<cfset temp = QuerySetCell(room, "roomTypeDescription",
#hotelRoomAvailabilityResult[i ].roomTypeDescription.XmlText#, #i#)>
<cfset temp = QuerySetCell(room, "rateDescription",
#hotelRoomAvailabilityResult[i ].rateDescription.XmlText#, #i#)>
<cfset temp = QuerySetCell(room, "roomTypeCode",
#hotelRoomAvailabilityResult[i ].roomTypeCode.XmlText#, #i#)>
<cfset temp = QuerySetCell(room, "rateInfo", #hotelRoomAvailabilityResult[i
].RateInfo.displayRoomRate.XmlText#, #i#)>
</cfloop>
<CFCATCH>
</CFCATCH>
</CFTRY>
DuLaus Guest
-
Accessing XML nodes
Suppose this your XML: <content> <author> <book> <title>this is the title</title> <description>book description</description> <book>... -
Inserting XML nodes
I want to insert a new XML node in my XML object, but not at the end as ..appendchild() method does, but in the node position of my choice... for... -
Interactive nodes.
Hey, ive been to bit-101.com, and i really like the nodes and things it has on there. I got the tutorial on how i make a simple on of his type, but... -
Creating nodes with ASP
I have a page that lists categories on the left, and I'd like to be able to click on one, and have a node pop out, revealing subcategories so users... -
referencing XML nodes by name
I would like to access the info in an XML file by name but Macromedias XML-Xtra instructions only explain how to access data via child-number eg...



Reply With Quote

