Hi guys. Got an XML import issue. I am trying to import an XML file but I'm having issues with some nodes not being defined in the XML. For example the node 'duration' may not be define for every record in the XML file. So I need to check to see if the node exists before I reference it, if it does not exist then I want to set it as null. I have tried isdefined and few other but can't seem to get the correct terminology. Code sample below
<cffile action="read" file="d:\Data\wwwroot\misd\XML\modelbuildparms.xml" variable="xmlfile"> <cfscript> xmlfile = trim(xmlfile); xmlfile = xmlparse(xmlfile); xmlsize = xmlfile.body.GetListItemsResponse.GetListItemsResult.listitems.data.XmlAttributes.ItemCount; xmlqry = QueryNew("Title, ModelPath, ModelEmailString, CubePublishPath, PPESPublishPath, ModelUserSecurity, ModelBuildExtraCommandsPre, ModelBuildExtraCommandsPost, BuildLevel, BusinessName, Duration, Keywords, NotifyStatus, MajorGrouping, MinorGrouping, ModelLabel, Frequency, Status, PrimaryMDC, ItemType, Path, UpdateTimeStamp, CreatedBy, ModifiedBy, Created, Modified, ID"); QueryAddRow(xmlqry,100); for (a=1; a LTE 1; a=a+1) { QuerySetCell(xmlqry,"title", xmlfile.body.GetListItemsResponse.GetListItemsResult.listitems.data.row[a].XmlAttributes.ows_Buildlevel,a); QuerySetCell(xmlqry,"ModelPath", xmlfile.body.GetListItemsResponse.GetListItemsResult.listitems.data.row[a].XmlAttributes.ows_ModelPath,a); ) </cfscript> In this example I need to check to see if the 'xmlfile.body.GetListItemsResponse.GetListItemsResult.listitems.data.row[a].XmlAttributes.ows_Buildlevel' node exists before I reference it. Thanks Brian Knott Software Engineer (COGNOS Developer) | MIS Front End | Banking & Life MIS ext 31221 ph 07 3333 1221 ________________________________ This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its related entities "Suncorp". Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 13 11 55 or at suncorp.com.au. The content of this e-mail is the view of the sender or stated author and does not necessarily reflect the view of Suncorp. The content, including attachments, is a confidential communication between Suncorp and the intended recipient. If you are not the intended recipient, any use, interference with, disclosure or copying of this e-mail, including attachments, is unauthorised and expressly prohibited. If you have received this e-mail in error please contact the sender immediately and delete the e-mail and any attachments from your system. If this e-mail constitutes a commercial message of a type that you no longer wish to receive please reply to this e-mail by typing Unsubscribe in the subject line. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---