Re: MS XML Parse

2011-05-06 Thread Russ Michaels

stick it inside a 

--

Russ Michaels

www.bluethunderinternet.com  : Business hosting services & solutions
www.cfmldeveloper.com: ColdFusion developer community
www.michaels.me.uk   : my blog
www.cfsearch.com : ColdFusion search engine
**
*skype me* : russmichaels


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344304
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: MS XML Parse

2011-05-06 Thread John M Bliss

If you're using SQL Server, it'll auto-handle the XML directly with no
pre-parsing with CF (SEE
http://msdn.microsoft.com/en-us/library/ms186918.aspx ):





PROCEDURE [BulkInsert]

@doc text

AS
BEGIN
DECLARE @idoc int

--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc

INSERT INTO yourTable (colum1, colum2, ...)
SELECT xmlnodename1, xmlnodename2, ...
FROM OPENXML(@idoc, '/xml/path/to/rows', 0)
WITH ( xmlnodename1 datatype,
xmlnodename2 datatype,
...)

EXEC sp_xml_removedocument @idoc

END

On Fri, May 6, 2011 at 2:46 PM, Torrent Girl  wrote:

>
> Hi all.
>
> I have been able to output my values from the xml (YAY!!) using xmlSearch
> (Thanks Guys).
>
> Here is my code:
>
> 
>   myxmldoc = XmlParse("E:\domains\aawit.net
> \wwwroot\Microsoft-Diversity-AAWIT116obs.xml");
>   title= XmlSearch(myxmldoc, "/jobs/job/title");
>   location = XmlSearch(myxmldoc, "/jobs/job/location");
>   department = XmlSearch(myxmldoc, "/jobs/job/department");
>   referencenumber = XmlSearch(myxmldoc, "/jobs/job/referencenumber");
>   description = XmlSearch(myxmldoc, "/jobs/job/description");
>   for (i = 1; i LTE ArrayLen(title); i = i + 1)
>  writeoutput("" & title[i].XmlText & "" &
> location[i].XmlText & "" & department[i].XmlText & "" &
> referencenumber[i].XmlText & "" & description[i].XmlText &
> "" & description[i].XmlText & "");
> 
>
> What I'd like to do is to be able to add these values to a table in my
> database but when I try to take the above code out of CFSCRIPT and do a
> straight output, it doesn't work.
>
> Any ideas on how I can do this?
>
> TIA
>
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344303
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: MS XML Parse

2011-05-06 Thread Torrent Girl

Hi all.

I have been able to output my values from the xml (YAY!!) using xmlSearch 
(Thanks Guys).

Here is my code:


   myxmldoc = 
XmlParse("E:\domains\aawit.net\wwwroot\Microsoft-Diversity-AAWIT116obs.xml");
   title= XmlSearch(myxmldoc, "/jobs/job/title");
   location = XmlSearch(myxmldoc, "/jobs/job/location");
   department = XmlSearch(myxmldoc, "/jobs/job/department");
   referencenumber = XmlSearch(myxmldoc, "/jobs/job/referencenumber");
   description = XmlSearch(myxmldoc, "/jobs/job/description");
   for (i = 1; i LTE ArrayLen(title); i = i + 1)
  writeoutput("" & title[i].XmlText & "" & 
location[i].XmlText & "" & department[i].XmlText & "" & 
referencenumber[i].XmlText & "" & description[i].XmlText & 
"" & description[i].XmlText & "");


What I'd like to do is to be able to add these values to a table in my database 
but when I try to take the above code out of CFSCRIPT and do a straight output, 
it doesn't work.

Any ideas on how I can do this?

TIA


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344302
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: MS XML Parse

2011-05-03 Thread Torrent Girl

>On 5/3/2011 10:18 AM, Torrent Girl wrote:
>> Actually, I can dump the contents of the cfhttp.filecontent return 
>> with no problem.
>
>That is because at that point, the data is still flat text.  One can fit 
>a WHOLE LOT of flat text into a gigabyte or two of ram memory.
>
>The problem will occur when you try to parse that flat text into a DOM 
>relational data structure.
>
>Now IF you do not need to parse the flat data, you can use 
>xmlTransform(), and maybe xmlSearch(), to apply XPATH to the large flat 
>text data and create smaller subsets of the XML.  That might get you 
>where you need to go.

Great thanks!

I'll try one of these. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344179
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: MS XML Parse

2011-05-03 Thread Ian Skinner

On 5/3/2011 10:18 AM, Torrent Girl wrote:
> Actually, I can dump the contents of the cfhttp.filecontent return 
> with no problem.

That is because at that point, the data is still flat text.  One can fit 
a WHOLE LOT of flat text into a gigabyte or two of ram memory.

The problem will occur when you try to parse that flat text into a DOM 
relational data structure.

Now IF you do not need to parse the flat data, you can use 
xmlTransform(), and maybe xmlSearch(), to apply XPATH to the large flat 
text data and create smaller subsets of the XML.  That might get you 
where you need to go.




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344176
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: MS XML Parse

2011-05-03 Thread Torrent Girl

> On 5/3/2011 9:14 AM, Torrent Girl wrote:
> > 
> 
> That looks to be a pretty large XML document.  There are definite 
> limits 
> on how large of document that xmlParse() can process.  As xmlParse 
> uses 
> a DOM parsing methodology, the entire resulting data structure (which 
> 
> will be several times larger the the original text document) must fit 
> 
> into memory.
> 
> If this document is too large to dom parse you need to do something 
> that 
> parses it segment by segment, such as a sax parser.  ColdFusion does 
> not 
> have a built in sax parser.  I used Ben Nadel's pseudo parser 
> [http://www.bennadel.
> com/blog/1345-Ask-Ben-Parsing-Very-Large-XML-Documents-In-ColdFusion.
> htm] 
> once when I needed a quick solution.  One could also dive into the 
> underlining Java and access some true sax parser through it.
> 


Actually, I can dump the contents of the cfhttp.filecontent return with no 
problem.



 


I usually have to dump the parse to see what available for outputing the actual 
values.

Here is my page with the cfhttp content dumped:

http://www.aawit.net/xmlJobFeedtest.cfm

If I can get the structure of the values I'd be good: i.e., 
#msjobs.job.title.XmlText#

I am not familiar with XML enough to know how to output the parsing.



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344172
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: MS XML Parse

2011-05-03 Thread Ian Skinner

On 5/3/2011 9:14 AM, Torrent Girl wrote:
>  'http://www.microsoft-careers.com/Microsoft-Diversity-AAWIT116obs.xml'>

That looks to be a pretty large XML document.  There are definite limits 
on how large of document that xmlParse() can process.  As xmlParse uses 
a DOM parsing methodology, the entire resulting data structure (which 
will be several times larger the the original text document) must fit 
into memory.

If this document is too large to dom parse you need to do something that 
parses it segment by segment, such as a sax parser.  ColdFusion does not 
have a built in sax parser.  I used Ben Nadel's pseudo parser 
[http://www.bennadel.com/blog/1345-Ask-Ben-Parsing-Very-Large-XML-Documents-In-ColdFusion.htm]
 
once when I needed a quick solution.  One could also dive into the 
underlining Java and access some true sax parser through it.



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344167
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: MS XML Parse

2011-05-03 Thread Mark Drew

Maybe it's too big a file this time. 

the XMlParse function isn't the best when it gets to large documents, time to 
drop into java :) SAX parsers work even better for large documents. 

I looked at it and it seems to be a rather big file BTW. 

Regards

Mark Drew

On 3 May 2011, at 12:14, Torrent Girl wrote:

> 
> Hello all.
> 
> I am trying to parse thru an XML feed using the method that I always use and 
> it's not working:
> 
> Here is my code:
> 
>  'http://www.microsoft-careers.com/Microsoft-Diversity-AAWIT116obs.xml'>
> 
> 
>  
> 
> 
> The dump doesn't show up. I just get a blank screen.
> 
> Any suggestions?
> 
> TIA 
> 
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344165
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: MS XML Parse

2011-05-03 Thread DURETTE, STEVEN J (ATTASIAIT)

Are you sure that someone didn't screw up the XML in the file?


-Original Message-
From: Torrent Girl [mailto:moniqueb...@gmail.com] 
Sent: Tuesday, May 03, 2011 12:15 PM
To: cf-talk
Subject: MS XML Parse


Hello all.

I am trying to parse thru an XML feed using the method that I always use
and it's not working:

Here is my code:




 


The dump doesn't show up. I just get a blank screen.

Any suggestions?

TIA 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344162
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm