Re: [ACFUG Discuss] Need example - XML Import/parse help - 3 questions about sample data

2008-06-11 Thread Steven Ross
just curious... what is the error?

On Wed, Jun 11, 2008 at 5:42 PM, Steven Ross <[EMAIL PROTECTED]> wrote:

> Have you tried this?arrayImport[i][4] =
> selectedElements[i]["rm:image"][i].XmlText;
>
>
> On Wed, Jun 11, 2008 at 4:10 PM, Derrick Peavy <
> [EMAIL PROTECTED]> wrote:
>
>> Steven, thank you. I did go through the W3School article after you sent it
>> as well as skimming the doc that Charlie sent. I actually use that site a
>> lot.  With your help, I solved the two small problems, but the problem with
>> duplicate children still plagues me.
>>
>> At this point, i am back to my original question with perhaps a more
>> direct approach--- Can someone provide an example of accessing the data
>> within an XML file wherein a parent element has several exactly named
>> children. I still have not found the answer within the documents or on
>> line.
>>
>> I appreciate the documentation that folks are sending - but I also learn
>> about, oh I don't know, maybe 1000X faster by seeing actual code. But,
>> that's just me.
>>
>>
>> *Example code, demonstrating my problem*
>>
>> 
>> 
>> A sample XML Child of "entry element"
>>  http://www.someplace.com";>
>> Looks like greek to me. Looks like greek to me. Looks like greek
>> to me. Looks like greek to me. Looks like greek to me. Looks like greek to
>> me. Looks like greek to me. 
>>  852
>> http://www.someplace.com/img/user/442/852/4551594.jpg
>> 
>>  http://www.someplace.com/img/user/442/852/4551594a.jpg
>> 
>>  http://www.someplace.com/img/user/442/852/4551594b.jpg
>> 
>>  http://www.someplace.com/img/user/442/852/4551594c.jpg
>> 
>>  http://www.someplace.com/img/user/442/852/4551594d.jpg
>> 
>>  
>> 
>>
>>
>> *And parsing that type of structure into an array is no problem EXPECT
>> where the image is concerned. The following example works except for the
>> last array element [4]. If it worked, it would at least insert the first
>> instance of the rm:image child element. But nothing seems to work.*
>>
>> 
>> selectedElements = XmlSearch(XmlParse(trim(cfhttp.fileContent)),
>> "/feed/entry/");
>> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
>>  arrayImport[i][1] = selectedElements[i].summary.XmlText;
>> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
>> arrayImport[i][2] = selectedElements[i].link.XmlAttributes.href;
>>  for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
>> arrayImport[i][3] = selectedElements[i]["rm:id"].XmlText;
>>  for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
>> arrayImport[i][4] = selectedElements[i]["rm:image"].XmlText;
>> 
>>
>>
>> *So, documents and tutorials are always useful and appreciated, but after
>> 6 hours on this today, I think I would understand the problem and solution
>> much, much faster if someone out there had an actual example to point to.
>> Thanks!*
>>
>> _
>> Derrick Peavy
>> 404-786-5036
>> Sales and Web Services
>> CollegeClassifieds.com
>> http://www.collegeclassifieds.com
>> A Service of Universal Advertising, inc.
>> ___
>>
>>
>> On Jun 11, 2008, at 1:32 PM, Steven Ross wrote:
>>
>> I also recommend using the w3c xpath tutorial
>> when i forget syntax I always look there first...
>>
>> http://www.w3schools.com/XPath/default.asp
>>
>> On Wed, Jun 11, 2008 at 11:53 AM, Charlie Arehart <[EMAIL PROTECTED]>
>> wrote:
>>
>>>  Derrick, besides Steven's useful replies to you so far, since you said
>>> you were green with CF/XML processing, I can't recommend highly enough that
>>> you spend 30 minutes reading this wonderful guide:
>>>
>>>
>>> Utilizing XML and XSLT in ColdFusion MX
>>>
>>> http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf
>>>
>>>
>>> Sure, it's 6 years old, and written for CF 6, but it's a classic and all
>>> the info still applies. Just the best intro to the whole subject I ever saw.
>>> Lots of examples, no presumption of your knowing anything about XML, XSLT,
>>> XPATH, yet by the end of it's 30 pages you'll understand it all well enough
>>> to do nearly anything you'd need. And, yes, it explains all those CFML
>>> variables, structures, and functions you need to understand in order to
>>> process XML with CFML.
>>>
>>>
>>> I honestly wouldn't propose to try to help someone with a question on the
>>> subject without strongly urging them to read it first. It's that good, and
>>> thorough, and does a better job explaining things than I ever could. :-)
>>>
>>>
>>> /charlie
>>>
>>>
>>> *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Derrick
>>> Peavy
>>> *Sent:* Tuesday, June 10, 2008 11:31 PM
>>> *To:* discussion@acfug.org
>>> *Subject:* [ACFUG Discuss] XML Import/parse help - 3 questions about
>>> sample data
>>>
>>>
>>> I've been working with various XML documents, importing them and then
>>> putting select data into a database. I am having problems with new types of
>>> files and cannot seem to find an answer (Google). Maybe I am not using the
>>> right terms when searching. But I hope someone 

Re: [ACFUG Discuss] Need example - XML Import/parse help - 3 questions about sample data

2008-06-11 Thread Steven Ross
Have you tried this?arrayImport[i][4] =
selectedElements[i]["rm:image"][i].XmlText;

On Wed, Jun 11, 2008 at 4:10 PM, Derrick Peavy <
[EMAIL PROTECTED]> wrote:

> Steven, thank you. I did go through the W3School article after you sent it
> as well as skimming the doc that Charlie sent. I actually use that site a
> lot.  With your help, I solved the two small problems, but the problem with
> duplicate children still plagues me.
>
> At this point, i am back to my original question with perhaps a more direct
> approach--- Can someone provide an example of accessing the data within an
> XML file wherein a parent element has several exactly named children. I
> still have not found the answer within the documents or on line.
>
> I appreciate the documentation that folks are sending - but I also learn
> about, oh I don't know, maybe 1000X faster by seeing actual code. But,
> that's just me.
>
>
> *Example code, demonstrating my problem*
>
> 
> 
> A sample XML Child of "entry element"
> http://www.someplace.com";>
> Looks like greek to me. Looks like greek to me. Looks like greek
> to me. Looks like greek to me. Looks like greek to me. Looks like greek to
> me. Looks like greek to me. 
> 852
> http://www.someplace.com/img/user/442/852/4551594.jpg
> http://www.someplace.com/img/user/442/852/4551594a.jpg
> 
> http://www.someplace.com/img/user/442/852/4551594b.jpg
> 
> http://www.someplace.com/img/user/442/852/4551594c.jpg
> 
> http://www.someplace.com/img/user/442/852/4551594d.jpg
> 
> 
> 
>
>
> *And parsing that type of structure into an array is no problem EXPECT
> where the image is concerned. The following example works except for the
> last array element [4]. If it worked, it would at least insert the first
> instance of the rm:image child element. But nothing seems to work.*
>
> 
> selectedElements = XmlSearch(XmlParse(trim(cfhttp.fileContent)),
> "/feed/entry/");
> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
> arrayImport[i][1] = selectedElements[i].summary.XmlText;
> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
> arrayImport[i][2] = selectedElements[i].link.XmlAttributes.href;
> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
> arrayImport[i][3] = selectedElements[i]["rm:id"].XmlText;
> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
> arrayImport[i][4] = selectedElements[i]["rm:image"].XmlText;
> 
>
>
> *So, documents and tutorials are always useful and appreciated, but after
> 6 hours on this today, I think I would understand the problem and solution
> much, much faster if someone out there had an actual example to point to.
> Thanks!*
>
> _
> Derrick Peavy
> 404-786-5036
> Sales and Web Services
> CollegeClassifieds.com
> http://www.collegeclassifieds.com
> A Service of Universal Advertising, inc.
> ___
>
>
> On Jun 11, 2008, at 1:32 PM, Steven Ross wrote:
>
> I also recommend using the w3c xpath tutorial
> when i forget syntax I always look there first...
>
> http://www.w3schools.com/XPath/default.asp
>
> On Wed, Jun 11, 2008 at 11:53 AM, Charlie Arehart <[EMAIL PROTECTED]>
> wrote:
>
>>  Derrick, besides Steven's useful replies to you so far, since you said
>> you were green with CF/XML processing, I can't recommend highly enough that
>> you spend 30 minutes reading this wonderful guide:
>>
>>
>> Utilizing XML and XSLT in ColdFusion MX
>>
>> http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf
>>
>>
>> Sure, it's 6 years old, and written for CF 6, but it's a classic and all
>> the info still applies. Just the best intro to the whole subject I ever saw.
>> Lots of examples, no presumption of your knowing anything about XML, XSLT,
>> XPATH, yet by the end of it's 30 pages you'll understand it all well enough
>> to do nearly anything you'd need. And, yes, it explains all those CFML
>> variables, structures, and functions you need to understand in order to
>> process XML with CFML.
>>
>>
>> I honestly wouldn't propose to try to help someone with a question on the
>> subject without strongly urging them to read it first. It's that good, and
>> thorough, and does a better job explaining things than I ever could. :-)
>>
>>
>> /charlie
>>
>>
>> *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Derrick
>> Peavy
>> *Sent:* Tuesday, June 10, 2008 11:31 PM
>> *To:* discussion@acfug.org
>> *Subject:* [ACFUG Discuss] XML Import/parse help - 3 questions about
>> sample data
>>
>>
>> I've been working with various XML documents, importing them and then
>> putting select data into a database. I am having problems with new types of
>> files and cannot seem to find an answer (Google). Maybe I am not using the
>> right terms when searching. But I hope someone here can help.
>>
>>
>> For the most part, it's all straight forward. I have been using this kind
>> of code
>>
>>
>>
>> 
>>
>> selectedElements =
>> XmlSearch(XmlParse(trim(cfhttp.fileContent)), "/feed/feed_item/");
>>
>> for (i =

RE: [ACFUG Discuss] Need example - XML Import/parse help - 3 questions about sample data

2008-06-11 Thread Fennell, Mark P.
I couldn't agree with you more. I can't tell you the number of vendors
who fail to grasp the concepts and importance of primary and foreign
keys in databases. I think the right way is often detoured by someone
doing it the wrong way upstream... Hence the old addage, if you want
something done right, do it yourself. :)
Try this "example." It's not perfect, but it should get you started. I
think. Dump it in a file and run it. 
mf
 





A sample XML Child of "entry element"
http://www.someplace.com"; />
Looks like greek to me. Looks like greek to me. Looks like
greek to me. Looks like greek to me. Looks like greek to me. Looks like
greek to me. Looks like greek to me. 
852
http://www.someplace.com/img/user/442/852/4551594.jpg
http://www.someplace.com/img/user/442/852/4551594a.jpg
http://www.someplace.com/img/user/442/852/4551594b.jpg
http://www.someplace.com/img/user/442/852/4551594c.jpg
http://www.someplace.com/img/user/442/852/4551594d.jpg




http://iandev/ian/mf/xml_test.cfm?xml";
method="GET">


selectedElements = XmlSearch(XmlParse(trim(xm)), "/feed/entry/"); 
txt1 = selectedElements[1]["rmimage"][1].XmlText; 
txt2 = selectedElements[1]["rmimage"][2].XmlText; 


First Child = #txt1#
Second Child = #txt2#






From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derrick
Peavy
Sent: Wednesday, June 11, 2008 4:39 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] Need example - XML Import/parse help - 3
questions about sample data


Mark: 

Thank you! Yes, to all of that, I can do that, have done it. May resort
to that. But it's not the "right" way and I am trying hard to learn the
finer points of this. The problem is simply that I can't find an example
and even thinking outside the box seems to be of no use in solving the
problem. 

It makes me wonder, either the developers who do this in any language
keep the finer points to themselves, or there is a whole lot of
unnecessary re-writing and parsing of XML files going on across the web
- which defeats the whole point.  Just my thoughts. 


_ 
Derrick Peavy 
404-786-5036 
Sales and Web Services 
CollegeClassifieds.com 
http://www.collegeclassifieds.com 
A Service of Universal Advertising, inc. 
___ 


On Jun 11, 2008, at 4:21 PM, Fennell, Mark P. wrote:


Is there no way to "normalize" (if that's the right term) the
XML? Granted, you'd have to be the one generating the XML, but it would
sure be nice to have rm:image1, rm:image2, etc. That would also give you
the ability to have descriptions for each of the images. 
Barring that, and this isn't what you asked for, but I wonder if
you could read the file and write a new file and for each rm:image
change the name to rm:image#x# where x is some loop index value?
Just random thoughts. I'll see if I can spawn an example for
you. :)
mf



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Derrick Peavy
    Sent: Wednesday, June 11, 2008 4:11 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] Need example - XML Import/parse
help - 3 questions about sample data


Steven, thank you. I did go through the W3School article after
you sent it as well as skimming the doc that Charlie sent. I actually
use that site a lot.  With your help, I solved the two small problems,
but the problem with duplicate children still plagues me. 


At this point, i am back to my original question with perhaps a
more direct approach--- Can someone provide an example of accessing the
data within an XML file wherein a parent element has several exactly
named children. I still have not found the answer within the documents
or on line. 


I appreciate the documentation that folks are sending - but I
also learn about, oh I don't know, maybe 1000X faster by seeing actual
code. But, that's just me.


Example code, demonstrating my problem



A sample XML Child of "entry element"
http://www.someplace.com";>
Looks like greek to me. Looks like greek to me. Looks
like greek to me. Looks like greek to me. Looks like greek to me. Looks
like greek to me. Looks like greek to me. 
852

http://www.someplace.com/img/user/442/852/4551594.jpg

http://www.someplace.com/img/user/442/852/4551594a.jpg

http://www.someplace.com/img/user/442/852/4551594b.jpg

http://www.someplace.com/img/user/442/852/4551594c.jpg

http://www.someplace.com/img/user/442/852/4551594d.jpg




And parsing that type of structure into an array is no problem
EXPECT where the image is concerned. The following example works except
for the last 

Re: [ACFUG Discuss] Need example - XML Import/parse help - 3 questions about sample data

2008-06-11 Thread Derrick Peavy

Mark:

Thank you! Yes, to all of that, I can do that, have done it. May  
resort to that. But it's not the "right" way and I am trying hard to  
learn the finer points of this. The problem is simply that I can't  
find an example and even thinking outside the box seems to be of no  
use in solving the problem.


It makes me wonder, either the developers who do this in any language  
keep the finer points to themselves, or there is a whole lot of  
unnecessary re-writing and parsing of XML files going on across the  
web - which defeats the whole point.  Just my thoughts.


_
Derrick Peavy
404-786-5036
Sales and Web Services
CollegeClassifieds.com
http://www.collegeclassifieds.com
A Service of Universal Advertising, inc.
___


On Jun 11, 2008, at 4:21 PM, Fennell, Mark P. wrote:

Is there no way to "normalize" (if that's the right term) the XML?  
Granted, you'd have to be the one generating the XML, but it would  
sure be nice to have rm:image1, rm:image2, etc. That would also  
give you the ability to have descriptions for each of the images.
Barring that, and this isn't what you asked for, but I wonder if  
you could read the file and write a new file and for each rm:image  
change the name to rm:image#x# where x is some loop index value?

Just random thoughts. I'll see if I can spawn an example for you. :)
mf

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derrick  
Peavy

Sent: Wednesday, June 11, 2008 4:11 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] Need example - XML Import/parse help -  
3 questions about sample data


Steven, thank you. I did go through the W3School article after you  
sent it as well as skimming the doc that Charlie sent. I actually  
use that site a lot.  With your help, I solved the two small  
problems, but the problem with duplicate children still plagues me.


At this point, i am back to my original question with perhaps a  
more direct approach--- Can someone provide an example of accessing  
the data within an XML file wherein a parent element has several  
exactly named children. I still have not found the answer within  
the documents or on line.


I appreciate the documentation that folks are sending - but I also  
learn about, oh I don't know, maybe 1000X faster by seeing actual  
code. But, that's just me.



Example code, demonstrating my problem



A sample XML Child of "entry element"
http://www.someplace.com";>
Looks like greek to me. Looks like greek to me. Looks like  
greek to me. Looks like greek to me. Looks like greek to me. Looks  
like greek to me. Looks like greek to me. 

852
http://www.someplace.com/img/user/442/852/4551594.jpgrm:image>
http://www.someplace.com/img/user/442/852/4551594a.jpgrm:image>
http://www.someplace.com/img/user/442/852/4551594b.jpgrm:image>
http://www.someplace.com/img/user/442/852/4551594c.jpgrm:image>
http://www.someplace.com/img/user/442/852/4551594d.jpgrm:image>





And parsing that type of structure into an array is no problem  
EXPECT where the image is concerned. The following example works  
except for the last array element [4]. If it worked, it would at  
least insert the first instance of the rm:image child element. But  
nothing seems to work.



selectedElements = XmlSearch(XmlParse(trim(cfhttp.fileContent)), "/ 
feed/entry/");

for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImport[i][1] = selectedElements[i].summary.XmlText;
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImport[i][2] = selectedElements[i].link.XmlAttributes.href;
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImport[i][3] = selectedElements[i]["rm:id"].XmlText;
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImport[i][4] = selectedElements[i]["rm:image"].XmlText;



So, documents and tutorials are always useful and appreciated, but  
after 6 hours on this today, I think I would understand the problem  
and solution much, much faster if someone out there had an actual  
example to point to. Thanks!


_
Derrick Peavy
404-786-5036
Sales and Web Services
CollegeClassifieds.com
http://www.collegeclassifieds.com
A Service of Universal Advertising, inc.
___


On Jun 11, 2008, at 1:32 PM, Steven Ross wrote:


I also recommend using the w3c xpath tutorial

when i forget syntax I always look there first...

http://www.w3schools.com/XPath/default.asp

On Wed, Jun 11, 2008 at 11:53 AM, Charlie Arehart  
<[EMAIL PROTECTED]> wrote:
Derrick, besides Steven's useful replies to you so far, since you  
said you were green with CF/XML processing, I can't recommend  
highly enough that you spend 30 minutes reading this wonderful guide:




Utilizing XML and XSLT in ColdFusion MX

http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf



Sure, it'

RE: [ACFUG Discuss] Need example - XML Import/parse help - 3 questions about sample data

2008-06-11 Thread Fennell, Mark P.
Is there no way to "normalize" (if that's the right term) the XML?
Granted, you'd have to be the one generating the XML, but it would sure
be nice to have rm:image1, rm:image2, etc. That would also give you the
ability to have descriptions for each of the images. 
Barring that, and this isn't what you asked for, but I wonder if you
could read the file and write a new file and for each rm:image change
the name to rm:image#x# where x is some loop index value?
Just random thoughts. I'll see if I can spawn an example for you. :)
mf



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derrick
Peavy
Sent: Wednesday, June 11, 2008 4:11 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] Need example - XML Import/parse help - 3
questions about sample data


Steven, thank you. I did go through the W3School article after you sent
it as well as skimming the doc that Charlie sent. I actually use that
site a lot.  With your help, I solved the two small problems, but the
problem with duplicate children still plagues me. 


At this point, i am back to my original question with perhaps a more
direct approach--- Can someone provide an example of accessing the data
within an XML file wherein a parent element has several exactly named
children. I still have not found the answer within the documents or on
line. 


I appreciate the documentation that folks are sending - but I also learn
about, oh I don't know, maybe 1000X faster by seeing actual code. But,
that's just me.


Example code, demonstrating my problem



A sample XML Child of "entry element"
http://www.someplace.com";>
Looks like greek to me. Looks like greek to me. Looks like
greek to me. Looks like greek to me. Looks like greek to me. Looks like
greek to me. Looks like greek to me. 
852
http://www.someplace.com/img/user/442/852/4551594.jpg
http://www.someplace.com/img/user/442/852/4551594a.jpg
http://www.someplace.com/img/user/442/852/4551594b.jpg
http://www.someplace.com/img/user/442/852/4551594c.jpg
http://www.someplace.com/img/user/442/852/4551594d.jpg




And parsing that type of structure into an array is no problem EXPECT
where the image is concerned. The following example works except for the
last array element [4]. If it worked, it would at least insert the first
instance of the rm:image child element. But nothing seems to work.


selectedElements = XmlSearch(XmlParse(trim(cfhttp.fileContent)),
"/feed/entry/"); 
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) 
arrayImport[i][1] = selectedElements[i].summary.XmlText; 
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) 
arrayImport[i][2] = selectedElements[i].link.XmlAttributes.href; 
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) 
arrayImport[i][3] = selectedElements[i]["rm:id"].XmlText; 
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) 
arrayImport[i][4] = selectedElements[i]["rm:image"].XmlText; 



So, documents and tutorials are always useful and appreciated, but after
6 hours on this today, I think I would understand the problem and
solution much, much faster if someone out there had an actual example to
point to. Thanks!

_ 
Derrick Peavy 
404-786-5036 
Sales and Web Services 
CollegeClassifieds.com 
http://www.collegeclassifieds.com 
A Service of Universal Advertising, inc. 
___ 


On Jun 11, 2008, at 1:32 PM, Steven Ross wrote:


I also recommend using the w3c xpath tutorial 

when i forget syntax I always look there first...

http://www.w3schools.com/XPath/default.asp


On Wed, Jun 11, 2008 at 11:53 AM, Charlie Arehart
<[EMAIL PROTECTED]> wrote:


Derrick, besides Steven's useful replies to you so far,
since you said you were green with CF/XML processing, I can't recommend
highly enough that you spend 30 minutes reading this wonderful guide:


 

Utilizing XML and XSLT in ColdFusion MX


http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf


 

Sure, it's 6 years old, and written for CF 6, but it's a
classic and all the info still applies. Just the best intro to the whole
subject I ever saw. Lots of examples, no presumption of your knowing
anything about XML, XSLT, XPATH, yet by the end of it's 30 pages you'll
understand it all well enough to do nearly anything you'd need. And,
yes, it explains all those CFML variables, structures, and functions you
need to understand in order to process XML with CFML. 


 

I honestly wouldn't propose to try to help someone with
a question on the subject without strongly urging them to read it first.
It's that good, and thorough, and does a better job explaining things
tha

Re: [ACFUG Discuss] Need example - XML Import/parse help - 3 questions about sample data

2008-06-11 Thread Derrick Peavy
Steven, thank you. I did go through the W3School article after you  
sent it as well as skimming the doc that Charlie sent. I actually use  
that site a lot.  With your help, I solved the two small problems,  
but the problem with duplicate children still plagues me.


At this point, i am back to my original question with perhaps a more  
direct approach--- Can someone provide an example of accessing the  
data within an XML file wherein a parent element has several exactly  
named children. I still have not found the answer within the  
documents or on line.


I appreciate the documentation that folks are sending - but I also  
learn about, oh I don't know, maybe 1000X faster by seeing actual  
code. But, that's just me.



Example code, demonstrating my problem



A sample XML Child of "entry element"
http://www.someplace.com";>
		Looks like greek to me. Looks like greek to me. Looks like  
greek to me. Looks like greek to me. Looks like greek to me. Looks  
like greek to me. Looks like greek to me. 

852
		http://www.someplace.com/img/user/442/852/4551594.jpgrm:image>
		http://www.someplace.com/img/user/442/852/4551594a.jpgrm:image>
		http://www.someplace.com/img/user/442/852/4551594b.jpgrm:image>
		http://www.someplace.com/img/user/442/852/4551594c.jpgrm:image>
		http://www.someplace.com/img/user/442/852/4551594d.jpgrm:image>





And parsing that type of structure into an array is no problem EXPECT  
where the image is concerned. The following example works except for  
the last array element [4]. If it worked, it would at least insert  
the first instance of the rm:image child element. But nothing seems  
to work.



	selectedElements = XmlSearch(XmlParse(trim(cfhttp.fileContent)), "/ 
feed/entry/");

for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImport[i][1] = selectedElements[i].summary.XmlText;
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImport[i][2] = selectedElements[i].link.XmlAttributes.href;
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImport[i][3] = selectedElements[i]["rm:id"].XmlText;
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImport[i][4] = selectedElements[i]["rm:image"].XmlText;



So, documents and tutorials are always useful and appreciated, but  
after 6 hours on this today, I think I would understand the problem  
and solution much, much faster if someone out there had an actual  
example to point to. Thanks!


_
Derrick Peavy
404-786-5036
Sales and Web Services
CollegeClassifieds.com
http://www.collegeclassifieds.com
A Service of Universal Advertising, inc.
___


On Jun 11, 2008, at 1:32 PM, Steven Ross wrote:


I also recommend using the w3c xpath tutorial

when i forget syntax I always look there first...

http://www.w3schools.com/XPath/default.asp

On Wed, Jun 11, 2008 at 11:53 AM, Charlie Arehart  
<[EMAIL PROTECTED]> wrote:
Derrick, besides Steven's useful replies to you so far, since you  
said you were green with CF/XML processing, I can't recommend  
highly enough that you spend 30 minutes reading this wonderful guide:



Utilizing XML and XSLT in ColdFusion MX

http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf


Sure, it's 6 years old, and written for CF 6, but it's a classic  
and all the info still applies. Just the best intro to the whole  
subject I ever saw. Lots of examples, no presumption of your  
knowing anything about XML, XSLT, XPATH, yet by the end of it's 30  
pages you'll understand it all well enough to do nearly anything  
you'd need. And, yes, it explains all those CFML variables,  
structures, and functions you need to understand in order to  
process XML with CFML.



I honestly wouldn't propose to try to help someone with a question  
on the subject without strongly urging them to read it first. It's  
that good, and thorough, and does a better job explaining things  
than I ever could. :-)



/charlie


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derrick  
Peavy

Sent: Tuesday, June 10, 2008 11:31 PM
To: discussion@acfug.org
Subject: [ACFUG Discuss] XML Import/parse help - 3 questions about  
sample data



I've been working with various XML documents, importing them and  
then putting select data into a database. I am having problems with  
new types of files and cannot seem to find an answer (Google).  
Maybe I am not using the right terms when searching. But I hope  
someone here can help.



For the most part, it's all straight forward. I have been using  
this kind of code






selectedElements = XmlSearch(XmlParse(trim 
(cfhttp.fileContent)), "/feed/feed_item/");


for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)

arrayImportRentMktCom[i][1] =  
selectedElements[i].summary.XmlText;