Re: [ACFUG Discuss] Assistance parsing XML file?
Return Receipt Your Re: [ACFUG Discuss] Assistance parsing XML file? document: was[EMAIL PROTECTED] received by: at:07/15/2008 10:09:21 AM - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -
Re: [ACFUG Discuss] Assistance parsing XML file?
I don't get how aVal could output what you are saying it is outputting. To reference the No you would use the XMLText property of the node. Am I missing something here? On Tue, Jul 15, 2008 at 9:51 AM, Tepfer, Seth [EMAIL PROTECTED] wrote: I am having a little trouble parsing this XML file, and could use some help. Thanks for any assistance. When I say: cfset aVal = mydoc.events.event[i].custom_attribute[k].attribute_value #aVal# outputs as: No But if I use an if to check for No, I never find it, because in reality, xmp#aVal#/xmp outputs as: ?xml version=1.0 encoding=UTF-8? r25:attribute_value xmlns:r25=http://www.collegenet.com/r25 No/r25:attribute_value I've resorted to using string functions to parse out all that extra XML to get at my actual value. That feels klunky and like the hard way. What is the easy way to get to No ? Seth Tepfer 770-784-8487 [EMAIL PROTECTED] Director of Administrative Computing, Oxford College Proud Pappa (again): Zyle Caspian, born Thursday, April 17, 2:38 pm. 8 lbs, 19.5 inches. Baby Pix at: http://www.flickr.com/photos/[EMAIL PROTECTED]/ This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including any attachments) is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including attachments). - To unsubscribe from this list, manage your profile @ http://www.acfug.org?falogin.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com - -- Steve Ross web application interface developer http://blog.stevensross.com [mobile] 404-488-4364 [fax] (404) 592-6885 [ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ] - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -
Re: [ACFUG Discuss] Assistance parsing XML file?
If you want to get text NO as output, here is code that can do the trick. cfxml variable=MyXmlCode ?xml version=1.0 encoding=UTF-8? r25:attribute_value xmlns:r25=http://www.collegenet.com/r25;No/r25:attribute_value /cfxml !---1. Parse XML into an XML OBJECT --- CFSET MyXml = XmlParse(MyXmlCode) !---2. Get the Root of the XML DOCUMENT which will help to find other elements--- CFSET Node_Root = MyXml.XmlRoot !---3. How many elements are there in the root --- CFSET nNumElements = ArrayLen(Node_Root.XmlChildren) CFOUTPUT pThe total number of elements are : b#nNumElements#/b/p pThe text within the element is : b #Node_Root.xmltext#/b/p /CFOUTPUT If there were any attributes involved, I would have used XMlAttributes, similarly XmlChildren if there were any child elements. Sorry if you were looking for something else. HTH, Ajas. On Tue, Jul 15, 2008 at 10:11 AM, [EMAIL PROTECTED] wrote: Return Receipt Your Re: [ACFUG Discuss] Assistance parsing XML file? document: was[EMAIL PROTECTED] received by: at:07/15/2008 10:09:21 AM - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com - -- Ajas Mohammed / http://ajashadi.blogspot.com We cannot become what we need to be, remaining what we are. No matter what, find a way. Because thats what winners do. You can't improve what you don't measure. Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives. - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -
RE: [ACFUG Discuss] Assistance parsing XML file?
Whoops - yes. Earlier in the processing comes this... cffile action=read file=C:\temp\xmlTest.txt variable=myxml cfset mydoc = XmlParse(myxml) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Youngman can i assume you are placing your xml into a struct before parsing? I am having a little trouble parsing this XML file, and could use some help. Thanks for any assistance. When I say: cfset aVal = mydoc.events.event[i].custom_attribute[k].attribute_value #aVal# outputs as: No But if I use an if to check for No, I never find it, because in reality, xmp#aVal#/xmp outputs as: ?xml version=1.0 encoding=UTF-8? r25:attribute_value xmlns:r25=http://www.collegenet.com/r25;No/r25:attribute_value I've resorted to using string functions to parse out all that extra XML to get at my actual value. That feels klunky and like the hard way. What is the easy way to get to No ? Seth Tepfer 770-784-8487 [EMAIL PROTECTED] Director of Administrative Computing, Oxford College Proud Pappa (again): Zyle Caspian, born Thursday, April 17, 2:38 pm. 8 lbs, 19.5 inches. Baby Pix at: http://www.flickr.com/photos/[EMAIL PROTECTED]/ This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including any attachments) is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including attachments). - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -
Re: [ACFUG Discuss] Assistance parsing XML file?
ah, okay.. well when i process xml, i use this custom tag to convert the xml to a struct. This custom tag was just available...I assume that a programmer before me found it. I'm attaching the code for the custom tag, and how i use it below: because I dont know exactly how your xml is structured, i did the best with changing the example code... however, you can just do a cfdump on mystruct after populating, to better see where that NO lives. hope this helps.. (and remember...the custom tag code is attached - just rename it with a .cfm exention .. i renamed it with a .txt just incase your firewall prevents it) CFOBJECT NAME=objXMLHTTP CLASS=Microsoft.XMLHTTP ACTION=create TYPE=COM cfscript objXMLHTTP.open(POST,theurl,false); objXMLHTTP.send(); /cfscript cfset xmlresponce = #objXMLHTTP.responseText# cf_xmlchange input #xmlresponce# output=mystruct !--- trying to change code for your purposes --- cfif #isdefined(mystruct.events.events[i])# cfoutput cfset aVal = mystruct.events.events[i].attributes.attrributeNAMEHERE.value)# #aVal# /cfoutput br /cfif _ John Youngman [EMAIL PROTECTED] - Original Message - From: Tepfer, Seth [EMAIL PROTECTED] To: discussion@acfug.org Sent: Tuesday, July 15, 2008 9:25 AM Subject: RE: [ACFUG Discuss] Assistance parsing XML file? Whoops - yes. Earlier in the processing comes this... cffile action=read file=C:\temp\xmlTest.txt variable=myxml cfset mydoc = XmlParse(myxml) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Youngman can i assume you are placing your xml into a struct before parsing? I am having a little trouble parsing this XML file, and could use some help. Thanks for any assistance. When I say: cfset aVal = mydoc.events.event[i].custom_attribute[k].attribute_value #aVal# outputs as: No But if I use an if to check for No, I never find it, because in reality, xmp#aVal#/xmp outputs as: ?xml version=1.0 encoding=UTF-8? r25:attribute_value xmlns:r25=http://www.collegenet.com/r25;No/r25:attribute_value I've resorted to using string functions to parse out all that extra XML to get at my actual value. That feels klunky and like the hard way. What is the easy way to get to No ? Seth Tepfer 770-784-8487 [EMAIL PROTECTED] Director of Administrative Computing, Oxford College Proud Pappa (again): Zyle Caspian, born Thursday, April 17, 2:38 pm. 8 lbs, 19.5 inches. Baby Pix at: http://www.flickr.com/photos/[EMAIL PROTECTED]/ This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including any attachments) is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including attachments). - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=gin.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com - - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com - cfparam name=Attributes.Init default=1 cfif Attributes.Init!--- if it is the root node --- cfparam name=Attributes.Input cfparam name=Attributes.Output default=Struct cfparam name=Attributes.Type default=Variable cfobject action=CREATE class=Microsoft.XMLDom type=COM name=XMLDoc cfscript XMLDoc.async = 0; XMLDoc.loadXML(Attributes.Input); oParseError = XMLDoc.ParseError; /cfscript !--- if DOM error throw an exception --- cfif oParseError.ErrorCode cfthrow type=XMLchange.ParseError message=DOM Error detail=#oParseError.Reason# | Line:#oParseError.Line# /cfif cfscript Attributes.Node = XMLDoc; Attributes.Struct = StructNew(); /cfscript!--- create outputstructure --- /cfif cfloop collection=#Attributes.Node.childNodes# item=ThisNode cfswitch expression=#ThisNode.NodeType# cfcase value=1 cfset CurrentNode = StructNew() !--- initialize node structure --- !--- Write Attributes to Structure --- cfset CurrentNode[Attributes] = StructNew() cfloop collection=#ThisNode.Attributes# item=ThisAttribute cfset CurrentNode.Attributes[ThisAttribute.Name] = ThisAttribute.Value /cfloop cfif
Re: [ACFUG Discuss] Assistance parsing XML file?
Hi, Here is modified version, just the output part CFOUTPUT pThe name of root element is : b#Node_Root.XmlName#/b/p pThe total number of elements are : b#nNumElements#/b/p pThe text within the element is : b #Node_Root.xmltext#/b/p pThe text within the attribute is : b #Node_Root.XMLAttributes[xmlns:r25]#/b/p /CFOUTPUT You have to play with xml little bit then you get a feel of it. I always do it and forget it after few days. ;-) . Happens with me all the time with xml. :-) Ajas. On Tue, Jul 15, 2008 at 11:40 AM, Tepfer, Seth [EMAIL PROTECTED] wrote: Thanks Ajas, with your code and some study on my part, it makes sense. I'm not able to get XMLAttributes to work. Using your example below, would I reference: #Node_Root.XMLAttributes# or would I explicity note the attribute via: #Node_Root.xmln:r25# Thanks Seth Tepfer 770-784-8487 [EMAIL PROTECTED] Director of Administrative Computing, Oxford College Proud Pappa (again): Zyle Caspian, born Thursday, April 17, 2:38 pm. 8 lbs, 19.5 inches. Baby Pix at: http://www.flickr.com/photos/[EMAIL PROTECTED]/ *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Ajas Mohammed *Sent:* Tuesday, July 15, 2008 10:22 AM *To:* discussion@acfug.org *Subject:* Re: [ACFUG Discuss] Assistance parsing XML file? If you want to get text NO as output, here is code that can do the trick. cfxml variable=MyXmlCode ?xml version=1.0 encoding=UTF-8? r25:attribute_value xmlns:r25=http://www.collegenet.com/r25;No/r25:attribute_value /cfxml !---1. Parse XML into an XML OBJECT --- CFSET MyXml = XmlParse(MyXmlCode) !---2. Get the Root of the XML DOCUMENT which will help to find other elements--- CFSET Node_Root = MyXml.XmlRoot !---3. How many elements are there in the root --- CFSET nNumElements = ArrayLen(Node_Root.XmlChildren) CFOUTPUT pThe total number of elements are : b#nNumElements#/b/p pThe text within the element is : b #Node_Root.xmltext#/b/p /CFOUTPUT If there were any attributes involved, I would have used XMlAttributes, similarly XmlChildren if there were any child elements. Sorry if you were looking for something else. HTH, Ajas. On Tue, Jul 15, 2008 at 10:11 AM, [EMAIL PROTECTED] wrote: Return Receipt Your Re: [ACFUG Discuss] Assistance parsing XML file? document: was[EMAIL PROTECTED] received by: at:07/15/2008 10:09:21 AM - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com - -- Ajas Mohammed / http://ajashadi.blogspot.com We cannot become what we need to be, remaining what we are. No matter what, find a way. Because thats what winners do. You can't improve what you don't measure. Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives. - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink http://www.fusionlink.com - -- This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including any attachments) is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including attachments). - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink http://www.fusionlink.com - -- Ajas Mohammed / http://ajashadi.blogspot.com We cannot become what we need to be, remaining what we are. No matter what, find a way. Because thats what winners do. You can't improve what you don't measure. Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives
Re: [ACFUG Discuss] Assistance parsing XML file?
You can actually get the structure of the parsed XML visually using CFDUMP. This ALWAYS helps me visualize where in the object I am looking for something. IE: cffile action=read file=C:\temp\xmlTest.txt variable=myxml cfset mydoc = XmlParse(myxml) cfdump var=#mydoc#/ -Cameron On Tue, Jul 15, 2008 at 10:25 AM, Tepfer, Seth [EMAIL PROTECTED] wrote: Whoops - yes. Earlier in the processing comes this... cffile action=read file=C:\temp\xmlTest.txt variable=myxml cfset mydoc = XmlParse(myxml) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Youngman can i assume you are placing your xml into a struct before parsing? I am having a little trouble parsing this XML file, and could use some help. Thanks for any assistance. When I say: cfset aVal = mydoc.events.event[i].custom_attribute[k].attribute_value #aVal# outputs as: No But if I use an if to check for No, I never find it, because in reality, xmp#aVal#/xmp outputs as: ?xml version=1.0 encoding=UTF-8? r25:attribute_value xmlns:r25=http://www.collegenet.com/r25;No/r25:attribute_value I've resorted to using string functions to parse out all that extra XML to get at my actual value. That feels klunky and like the hard way. What is the easy way to get to No ? Seth Tepfer 770-784-8487 [EMAIL PROTECTED] Director of Administrative Computing, Oxford College Proud Pappa (again): Zyle Caspian, born Thursday, April 17, 2:38 pm. 8 lbs, 19.5 inches. Baby Pix at: http://www.flickr.com/photos/[EMAIL PROTECTED]/ This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including any attachments) is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including attachments). - To unsubscribe from this list, manage your profile @ http://www.acfug.org?falogin.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com - -- Cameron Childress Sumo Consulting Inc http://www.sumoc.com --- cell: 678.637.5072 aim: cameroncf email: [EMAIL PROTECTED] - To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -