Google Weather API XML Question: Getting the value of a node

2010-03-19 Thread Chuck Weidler

I have been trying to figure this one out for a while now.  Running the below 
code will bring back a valid XML string and the XmlParse() is working just 
fine.  The problem is trying to get the value for Condition in the cfscript.  
The error I'm getting is:  Element 
XML_API_REPLY.WEATHER.CURRENT_CONDITIONS.CONDITION.XMLATTRIBUTES.DATA is 
undefined in XMLGOOGLE. 

I have tried every way I could thing of to address getting at the value, but 
with no luck.

I would appreciate another set or two of eyes on this.

Thanks

cftry
cfset urlAddress=http://www.google.com/ig/api?weather=21787;
cfhttp url=#urladdress# result=myResponse /
cfdump var=#myResponse.FileContent#
cfset xmlGoogle = XmlParse(myResponse.FileContent)
cfdump var=#xmlGoogle# expand=no
cfscript
Condition = 
xmlGoogle.xml_api_reply.weather.current_conditions.condition.xmlAttributes.data;
/cfscript
cfoutput
p#Condition#/p
/cfoutput
cfcatch type=any
cfdump var=#cfcatch#
/cfcatch
/cftry


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331913
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Google Weather API XML Question: Getting the value of a node

2010-03-19 Thread Kym Kovan

On 20/03/2010 13:33, Chuck Weidler wrote:

 I have been trying to figure this one out for a while now.  Running the below 
 code will bring back a valid XML string and the XmlParse() is working just 
 fine.  The problem is trying to get the value for Condition in thecfscript. 
  The error I'm getting is:  Element 
 XML_API_REPLY.WEATHER.CURRENT_CONDITIONS.CONDITION.XMLATTRIBUTES.DATA is 
 undefined in XMLGOOGLE.

 I have tried every way I could thing of to address getting at the value, but 
 with no luck.

 I would appreciate another set or two of eyes on this.

try this:


cftry
cfset urlAddress=http://www.google.com/ig/api?weather=21787;
cfhttp url=#urladdress# result=myResponse /
cfdump var=#myResponse.FileContent#
cfset xmlGoogle = 
XmlSearch(XmlParse(myResponse.FileContent),/xml_api_reply/weather/current_conditions/condition)
cfdump var=#xmlGoogle# expand=no
cfscript
Condition = xmlGoogle[1].xmlAttributes.data;
/cfscript
cfoutput
p#Condition#/p
/cfoutput
cfcatch type=any
cfdump var=#cfcatch#
/cfcatch
/cftry


-- 

Yours,

Kym Kovan
mbcomms.net.au


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331914
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Google Weather API XML Question: Getting the value of a node

2010-03-19 Thread Azadi Saryev

just replace 'xml_api_reply' with 'xmlroot' (without the quotes, of course):

Condition =
xmlGoogle.xmlroot.weather.current_conditions.condition.xmlAttributes.data;

Azadi

On 20/03/2010 10:33, Chuck Weidler wrote:
 I have been trying to figure this one out for a while now.  Running the below 
 code will bring back a valid XML string and the XmlParse() is working just 
 fine.  The problem is trying to get the value for Condition in the 
 cfscript.  The error I'm getting is:  Element 
 XML_API_REPLY.WEATHER.CURRENT_CONDITIONS.CONDITION.XMLATTRIBUTES.DATA is 
 undefined in XMLGOOGLE. 

 I have tried every way I could thing of to address getting at the value, but 
 with no luck.

 I would appreciate another set or two of eyes on this.

 Thanks

 cftry
   cfset urlAddress=http://www.google.com/ig/api?weather=21787;
   cfhttp url=#urladdress# result=myResponse /
   cfdump var=#myResponse.FileContent#
   cfset xmlGoogle = XmlParse(myResponse.FileContent)
   cfdump var=#xmlGoogle# expand=no
   cfscript
   Condition = 
 xmlGoogle.xml_api_reply.weather.current_conditions.condition.xmlAttributes.data;
   /cfscript
   cfoutput
   p#Condition#/p
   /cfoutput
   cfcatch type=any
   cfdump var=#cfcatch#
   /cfcatch
 /cftry


 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331915
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Google Weather API XML Question: Getting the value of a node

2010-03-19 Thread Chuck

Kym,

Thank you very much.  The worked perfectly.  It never crossed my mind to
user XmlSearch().

Chuck


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331916
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Google Weather API XML Question: Getting the value of a node

2010-03-19 Thread Chuck

Azadi,

Thank you very much.  That also worked perfectly.

This is why I love this forum and community.

Developers helping other Developers, it is just so cool.

Thanks again for the help.

Chuck


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331917
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


XML Question

2008-03-16 Thread Jenny Gavin-Wear
Banging head on desk, sure I'm doing something daft ...

When I reference the xml item it looks fine, then I try and insert it into a
table and this happenes:

insert into tbl_emails (UserName, Password, FirstName, LastName,
IsSystemAdmin, IsDomainAdmin)
Values (
'?xml version=1.0 encoding=UTF-8?
UserName xmlns=http://tempuri.org/;[EMAIL PROTECTED]/UserName',

How come the XML info is being shown and not just the item, please?

TIA, Jenny



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301388
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: XML Question

2008-03-16 Thread Adrian Lynch
How are you referencing the XML node? Is the query below the generated
query?

Adrian

-Original Message-
From: Jenny Gavin-Wear
Sent: 16 March 2008 17:20
To: CF-Talk
Subject: XML Question


Banging head on desk, sure I'm doing something daft ...

When I reference the xml item it looks fine, then I try and insert it into a
table and this happenes:

insert into tbl_emails (UserName, Password, FirstName, LastName,
IsSystemAdmin, IsDomainAdmin)
Values (
'?xml version=1.0 encoding=UTF-8?
UserName xmlns=http://tempuri.org/;[EMAIL PROTECTED]/UserName',

How come the XML info is being shown and not just the item, please?

TIA, Jenny


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301391
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: XML Question

2008-03-16 Thread Jenny Gavin-Wear
Hi Adrian, this is an excerpt from the generating code:

cfoutput
cfloop from=1 to=#NumUsers# index=I 
Cfset found = 0
cfquery datasource=#application.dsn# name=exists
select * from list_emails where sitedomain like 'fasttrackonline.co.uk'
/cfquery
cfloop query=exists
cfif exists.username is
MyXML.UserInfoListResult.Users.UserInfo[I].Username
cfset found = 1
/cfif
/cfloop
cfif found is 0
cfquery datasource=#application.dsn#
insert into tbl_emails (UserName, Password, FirstName, LastName,
IsSystemAdmin, IsDomainAdmin)
Values (
'#MyXML.UserInfoListResult.Users.UserInfo[I].Username#',
'#ToString(MyXML.UserInfoListResult.Users.UserInfo[I].Password)#',
'#MyXML.UserInfoListResult.Users.UserInfo[I].Firstname#',
'#MyXML.UserInfoListResult.Users.UserInfo[I].LastName#',
cfif MyXML.UserInfoListResult.Users.UserInfo[I].IsSystemAdmin is
true1cfelse0/cfif,
cfif MyXML.UserInfoListResult.Users.UserInfo[I].IsDomainAdmin is
true1cfelse0/cfif
)
/cfquery
/cfif
/cfloop
/cfoutput


-Original Message-
From: Adrian Lynch [mailto:[EMAIL PROTECTED]
Sent: 16 March 2008 18:04
To: CF-Talk
Subject: RE: XML Question


How are you referencing the XML node? Is the query below the generated
query?

Adrian

-Original Message-
From: Jenny Gavin-Wear
Sent: 16 March 2008 17:20
To: CF-Talk
Subject: XML Question


Banging head on desk, sure I'm doing something daft ...

When I reference the xml item it looks fine, then I try and insert it into a
table and this happenes:

insert into tbl_emails (UserName, Password, FirstName, LastName,
IsSystemAdmin, IsDomainAdmin)
Values (
'?xml version=1.0 encoding=UTF-8?
UserName xmlns=http://tempuri.org/;[EMAIL PROTECTED]/UserName',

How come the XML info is being shown and not just the item, please?

TIA, Jenny




~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301393
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: XML Question

2008-03-16 Thread Dominic Watson
Instead of you need to use the XmlText attribute of each of your xml
elements to get at the item's string. So:


Values (
   '#MyXML.UserInfoListResult.Users.UserInfo[I].Username.xmlText#',
   '#MyXML.UserInfoListResult.Users.UserInfo[I].Password.xmlText#',
   '#MyXML.UserInfoListResult.Users.UserInfo[I].Firstname.xmlText#',
   '#MyXML.UserInfoListResult.Users.UserInfo[I].LastName.xmlText#'

etc.

HTH

Dominic

-- 
Blog it up: http://fusion.dominicwatson.co.uk


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301400
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: XML Question

2008-03-16 Thread Jenny Gavin-Wear
Sorted it.

I should have been referencing, for example:

#MyXML.UserInfoListResult.Users.UserInfo[I].Username.XmlText#

-Original Message-
From: Jenny Gavin-Wear [mailto:[EMAIL PROTECTED]
Sent: 16 March 2008 19:23
To: CF-Talk
Subject: RE: XML Question




~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301401
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


XML Question...

2006-10-25 Thread Charles E. Heizer
Hello,
So I'm playing with creating a xml file but I'm not sure what I'm doing
wrong. The problem is that it's only displaying dn and it's text.

Thanks,
- Charles




cfset mydoc = XmlNew()
cfset mydoc.xmlRoot = XmlElemNew(mydoc,root)
cfset i = 1
   
cfset mydoc.root.XmlChildren[i] = XmlElemNew(mydoc,objectclass)
  

cfset mydoc.root.XmlChildren[i].XmlText = objectclass_text

cfset mydoc.root.XmlChildren[i] = XmlElemNew(mydoc,dn)

cfset mydoc.root.XmlChildren[i].XmlText = dn_text

cfoutput#MyDoc#/cfoutput


~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258035
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: XML Question...

2006-10-25 Thread Rob Wilkerson
Just out of curiosity, what about using cfxml?  It's a much more
readable method of creating an XML doc, IMO.

On 10/25/06, Charles E. Heizer [EMAIL PROTECTED] wrote:
 Hello,
 So I'm playing with creating a xml file but I'm not sure what I'm doing
 wrong. The problem is that it's only displaying dn and it's text.

 Thanks,
 - Charles




 cfset mydoc = XmlNew()
 cfset mydoc.xmlRoot = XmlElemNew(mydoc,root)
 cfset i = 1

 cfset mydoc.root.XmlChildren[i] = XmlElemNew(mydoc,objectclass)


 cfset mydoc.root.XmlChildren[i].XmlText = objectclass_text

 cfset mydoc.root.XmlChildren[i] = XmlElemNew(mydoc,dn)

 cfset mydoc.root.XmlChildren[i].XmlText = dn_text

 cfoutput#MyDoc#/cfoutput


 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258038
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: XML Question...

2006-10-25 Thread Dave Watts
 So I'm playing with creating a xml file but I'm not sure what 
 I'm doing wrong. The problem is that it's only displaying dn 
 and it's text.

If you want to output the contents of an XML document object to your page,
you'll need to convert it to a string using ToString. I'd also second Rob's
recommendation to use CFXML - it's a lot easier.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
 
Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore and Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258039
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: XML Question...

2006-10-25 Thread Charles E. Heizer
What is cfxml?


On 10/25/06 10:15 AM, Rob Wilkerson [EMAIL PROTECTED] wrote:

 Just out of curiosity, what about using cfxml?  It's a much more
 readable method of creating an XML doc, IMO.
 
 On 10/25/06, Charles E. Heizer [EMAIL PROTECTED] wrote:
 Hello,
 So I'm playing with creating a xml file but I'm not sure what I'm doing
 wrong. The problem is that it's only displaying dn and it's text.
 
 Thanks,
 - Charles
 
 
 
 
 cfset mydoc = XmlNew()
 cfset mydoc.xmlRoot = XmlElemNew(mydoc,root)
 cfset i = 1
 
 cfset mydoc.root.XmlChildren[i] = XmlElemNew(mydoc,objectclass)
 
 
 cfset mydoc.root.XmlChildren[i].XmlText = objectclass_text
 
 cfset mydoc.root.XmlChildren[i] = XmlElemNew(mydoc,dn)
 
 cfset mydoc.root.XmlChildren[i].XmlText = dn_text
 
 cfoutput#MyDoc#/cfoutput
 
 
 
 
 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258043
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: XML Question...

2006-10-25 Thread Rob Wilkerson
On 10/25/06, Charles E. Heizer [EMAIL PROTECTED] wrote:
 What is cfxml?

Just another CFML tag.

http://www.cfquickdocs.com/?sourceid=cfQDSearch1.02getDoc=cfxml

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258044
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: XML Question...

2006-10-25 Thread Charles E. Heizer
Thanks!

Your right this is a lot easier...


On 10/25/06 11:29 AM, Rob Wilkerson [EMAIL PROTECTED] wrote:

 On 10/25/06, Charles E. Heizer [EMAIL PROTECTED] wrote:
 What is cfxml?
 
 Just another CFML tag.
 
 http://www.cfquickdocs.com/?sourceid=cfQDSearch1.02getDoc=cfxml
 
 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258048
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


XML question

2005-07-06 Thread Rebecca Wells
I'm trying to figure out how to handle an XML file that will be
transmitted to my web app. Since I don't have an example of the actual
XML file, I created a test XML document stored in the variable named
myXML.

First, how do I access the XML document that will be posted to my web
app (via HTTPS POST)?

Second, is there any easier way to refer to an particular XML element
as a simple value as I am attempting to do here with
#variable.myXMLName[1].XmlText#?  


cfoutput
Hello world.br

cfset variable.myXML = ?xml
version='1.0'?CONTACTNAMEFIRSTRebecca/FIRSTLASTWells/LAST/NAMECONTACTDETAILS
EMAIL[EMAIL PROTECTED]/EMAILTELEPHONE(425)
430-6884/TELEPHONE/CONTACTDETAILS/CONTACT

cfset variable.myXMLName = #XmlSearch(XmlParse(variable.myXML),
/CONTACT/NAME/FIRST)#

My name is em#variable.myXMLName[1].XmlText#./em
/cfoutput

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211292
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: XML question

2005-07-06 Thread Ian Skinner
In answer to your second question.  Parse you xml into a CF XML object.

cfset variables.myXMLobj = xmlParse(variables.myXML)

Then you can do things like this.

cfoutput#variables.myXMLobj.Name.First.xmlText#/cfoutput


--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
C code. C code run. Run code run. Please!
- Cynthia Dunning

-Original Message-
From: Rebecca Wells [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 06, 2005 3:31 PM
To: CF-Talk
Subject: XML question

I'm trying to figure out how to handle an XML file that will be
transmitted to my web app. Since I don't have an example of the actual
XML file, I created a test XML document stored in the variable named
myXML.

First, how do I access the XML document that will be posted to my web
app (via HTTPS POST)?

Second, is there any easier way to refer to an particular XML element
as a simple value as I am attempting to do here with
#variable.myXMLName[1].XmlText#?


cfoutput
Hello world.br

cfset variable.myXML = ?xml
version='1.0'?CONTACTNAMEFIRSTRebecca/FIRSTLASTWells/LAST/N
AMECONTACTDETAILS
EMAIL[EMAIL PROTECTED]/EMAILTELEPHONE(425)
430-6884/TELEPHONE/CONTACTDETAILS/CONTACT

cfset variable.myXMLName = #XmlSearch(XmlParse(variable.myXML),
/CONTACT/NAME/FIRST)#

My name is em#variable.myXMLName[1].XmlText#./em
/cfoutput



~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211293
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: XML question

2005-07-06 Thread Eddie Awad
On 7/6/05, Rebecca Wells [EMAIL PROTECTED] wrote:
 First, how do I access the XML document that will be posted to my web
 app (via HTTPS POST)?

http://awads.net/wp/2005/07/06/read-xml-from-an-http-post/

 Second, is there any easier way to refer to an particular XML element
 as a simple value as I am attempting to do here with
 #variable.myXMLName[1].XmlText#?

Don't know what you mean.

-- 
Eddie Awad.
http://awads.net/

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211294
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: XML question

2005-07-06 Thread Anthony Prato
In answer to your first question:

cfset myDoc = GetHTTPRequestData().content

cftry
   cfset myXML = XmlParse(myDoc)
   cfcatch
   ... Put stuff here to deal with invalid requests ...
   /cfcatch
/cftry

I just asked the same question a few days ago an that was a reply I
got. Now I'm wondering how to use coldfusion to post xml. The only i
have heard of is the cfx_socket tag that was released a while back.
its easy with javascript and asp, so there must be an easy way to do
it with MX7

On 7/6/05, Rebecca Wells [EMAIL PROTECTED] wrote:
 I'm trying to figure out how to handle an XML file that will be
 transmitted to my web app. Since I don't have an example of the actual
 XML file, I created a test XML document stored in the variable named
 myXML.
 
 First, how do I access the XML document that will be posted to my web
 app (via HTTPS POST)?
 
 Second, is there any easier way to refer to an particular XML element
 as a simple value as I am attempting to do here with
 #variable.myXMLName[1].XmlText#?
 
 
 cfoutput
 Hello world.br
 
 cfset variable.myXML = ?xml
 version='1.0'?CONTACTNAMEFIRSTRebecca/FIRSTLASTWells/LAST/NAMECONTACTDETAILS
 EMAIL[EMAIL PROTECTED]/EMAILTELEPHONE(425)
 430-6884/TELEPHONE/CONTACTDETAILS/CONTACT
 
 cfset variable.myXMLName = #XmlSearch(XmlParse(variable.myXML),
 /CONTACT/NAME/FIRST)#
 
 My name is em#variable.myXMLName[1].XmlText#./em
 /cfoutput
 
 

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211295
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: XML question

2005-07-06 Thread Ian Skinner
Anthony

From Edie's post a couple of days ago.
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211166

To post XML over http you can use something like this.:
cfhttp url=url_to_post_to method=post
cfhttpparam type=XML name=XmlDoc value=#your_xml# /cfhttp

--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
C code. C code run. Run code run. Please!
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message. 



~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211296
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: XML question

2005-07-06 Thread Eddie Awad
On 7/6/05, Anthony Prato [EMAIL PROTECTED] wrote:
Now I'm wondering how to use coldfusion to post xml

cfhttp url=url_to_post_to method=post
   cfhttpparam 
type=XML 
name=XmlDoc 
value=#your_xml#
/cfhttp


-- 
Eddie Awad.
http://awads.net/

~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211297
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


a simple xml question

2005-06-09 Thread Ida Chen
I am new to cfc/xml. When I tried to create a simple cfc function that returns 
an xml object and tried to call it in a cfm page, the page returned some weird 
strings instead of the string I put in the testing xml. Can anyone help me 
correct errors? Thanks. The code is below:

cfc:
cfcomponent
  cffunction name=simpleXml access=public returntype=xml
cfxml variable=xmlobject
  testthis is a test/test
/cfxml
cfreturn xmlobject
  /cffunction
/cfcomponent

cfm:
cfobject name=myCFC component=testcfc
cfset testxml= myCFC.simpleXml
cfoutput#toString(testxml)#/cfoutput


the weird string that is returned is something like this:
textxml [EMAIL PROTECTED]


thanks again

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209096
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: a simple xml question

2005-06-09 Thread Kerry
Function calls need brackets:

cfset testxml= myCFC.simpleXml()

-Original Message-
From: Ida Chen [mailto:[EMAIL PROTECTED]
Sent: 09 June 2005 16:05
To: CF-Talk
Subject: a simple xml question


I am new to cfc/xml. When I tried to create a simple cfc function that
returns an xml object and tried to call it in a cfm page, the page returned
some weird strings instead of the string I put in the testing xml. Can
anyone help me correct errors? Thanks. The code is below:

cfc:
cfcomponent
  cffunction name=simpleXml access=public returntype=xml
cfxml variable=xmlobject
  testthis is a test/test
/cfxml
cfreturn xmlobject
  /cffunction
/cfcomponent

cfm:
cfobject name=myCFC component=testcfc
cfset testxml= myCFC.simpleXml
cfoutput#toString(testxml)#/cfoutput


the weird string that is returned is something like this:
textxml [EMAIL PROTECTED]


thanks again



~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209104
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: a simple xml question

2005-06-09 Thread Ida Chen
I corrected the error. When I reload the page, it says the value returned from 
function simpleXml() is not of type xml. why is that?

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209109
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: a simple xml question

2005-06-09 Thread S . Isaac Dealey
Yea, I've never understood why it is that functions return a string to
the output buffer instead of producing the can not be used as simple
values error that structs, queries and arrays produce.

 Function calls need brackets:

 cfset testxml= myCFC.simpleXml()


s. isaac dealey   954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm




~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209142
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Stupid XML question

2005-04-26 Thread Matt Robertson
On 4/25/05, Sean Corfield [EMAIL PROTECTED] wrote:
 Are you using CF5 or CFMX?

CFMX 6.1

That sample template is actually a mockup of what I'm getting back
from a cfhttp call.  The xml returned to me is just as I posted it.

Like I said.  I'm a newbie here.  I've managed to avoid XML for
everything but the very occasional storage of a struct in a client var
with cfwddx.

-- 
--mattRobertson--
Janitor, MSB Web Systems
mysecretbase.com

~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204405
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Stupid XML question

2005-04-26 Thread Matt Robertson
On 4/25/05, Sean Corfield [EMAIL PROTECTED] wrote:
  !--- http://66.165.78.2/testoutput.cfm: ---
 
 Not authorized to access this page!

sorry about that.  Missed a digit in the IP:

http://66.165.78.26/testoutput.cfm


-- 
--mattRobertson--
Janitor, MSB Web Systems
mysecretbase.com

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204407
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Stupid XML question

2005-04-26 Thread Jared Rypka-Hauer - CMG, LLC
Matt,

for the struct output your page is showing you'd use

ww_javagame.ww_cpid.value to get the value 0425070052843

BUT, why not just use xmlParse()?

cfhttp url=http://my.xmlsource.com/page.xml;

cfhttp.filecontent would then contain:

?xml version=1.0 encoding=UTF-8?
ww_javagame
ww_cpid
0425070052843
/ww_cpid
ww_statuscode
 2001
/ww_statuscode
ww_statusmsg
 woo hoo
/ww_statusmsg
/ww_javagame

cfset myXML = xmlParse(cfhttp.filecontent)


cfdump var=#myXML # label=myXML

This will result in a few things, one of which is slighly more
complicated paths in the XML object generated by CFMX, but it will
also make it possible for you to use things like XSLT via
xmlTransform() and XPath via xmlSearch(). There's tons of info out
there, and lots of XML users around (like me) who can help you if you
need it.

Now, using the method I outlined here (which is really more correct
when using XML, because it's standards-compliant), you would use:

myXML.ww_javagame.ww_cpid.xmlText

to get the value:

0425070052843

If you take your cfdump output very literally, you'll get to just the
data you need to, including attributes and elements. In XML:

myXMLvalue type=stringthis is some text/myXMLvalue

myXMLvalue is an element, type is an attribute and string is the
value of the type attribute for the element myXMLvalue. this is some
text is the xmlText value associated with the myXMLvalue element with
a type attribute of string.

Note: type and string are randomly chosen names/values. The don't
denote any mandatory aspect of an XML element. It could just as easily
have been widget=someWidget as type=string

HTH,
J

On 4/26/05, Matt Robertson [EMAIL PROTECTED] wrote:
 On 4/25/05, Sean Corfield [EMAIL PROTECTED] wrote:
   !--- http://66.165.78.2/testoutput.cfm: ---
 
  Not authorized to access this page!
 
 sorry about that.  Missed a digit in the IP:
 
 http://66.165.78.26/testoutput.cfm
 
 
 --
 --mattRobertson--
 Janitor, MSB Web Systems
 mysecretbase.com


-- 
---
-
Buy SQLSurveyor!
http://www.web-relevant.com/sqlsurveyor
Never make your developers open Enterprise Manager again.

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204409
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Stupid XML question

2005-04-26 Thread Matt Robertson
Thanks guys.  I just figured it out.  Or more accurately I appear to
have tinkered with it and this time didn't make some stupid typo.

I added this to the bottom of that template:

cfoutput
#myxml.ww_javagame.ww_cpid.value#br
#myxml.ww_javagame.ww_statuscode.value#br
#myxml.ww_javagame.ww_statusmsg.value#
/cfoutput

And it worked just great (I left the template up)  All my earlier
troubles must have stemmed from a misspelling I guess.

Jared, Thanks for the info.  xmlParse()?  I know that about as well as
I know RTFM :-)  Somewhere I remember seeing the 'new' xml functions
but totally forgot they existed.  Definitely some interesting info
that I'll be digging into.  Its a crime to have gone this long without
messing with it.

-- 
--mattRobertson--
Janitor, MSB Web Systems
mysecretbase.com

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204410
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Stupid XML question

2005-04-26 Thread Joe Rinehart
Hey Matt,

If you're using CFMX 6.1, I'd dump SoXML and go straight to the native
XML capabilities.  It'd look like this:

cfset variables.thisxml=?xml version=1.0 encoding=UTF-8?
ww_javagame ww_cpid0425070052843/ww_cpid
ww_statuscode2001/ww_statuscodeww_statusmsgwoo
hoo/ww_statusmsg /ww_javagame

!--- Replace this 
cf_SOXML
   action=XML2CF
   input=#variables.thisxml#
   output=myXML
---

!--- With this: ---
cfset myXml = xmlParse(myXML) /

!--- This'll work, and give you clues as to how to access things ---
cfdump var=#myxml# label=myXML

!--- Show a value ---
cfoutput
  #myXml.xmlRoot.ww_cpid.xmlText#
/cfoutput

Hope that helps.  I would, as you pointed out later in this thread,
RTFM (and I mean it kindly! :) )

-Joe


-- 
Get Glued!
The Model-Glue ColdFusion Framework
http://www.model-glue.com

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204418
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Stupid XML question

2005-04-26 Thread Adrian Lynch
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/functi20.htm#wp346877
0

and the XML and XSLT in ColdFusion MX PDF here

http://www.macromedia.com/devnet/mx/coldfusion/xml_xslt.html

should tell you all you need.

Ade

-Original Message-
From: Matt Robertson [mailto:[EMAIL PROTECTED]
Sent: 26 April 2005 03:14
To: CF-Talk
Subject: Stupid XML question


OK.  First I must confess I don't work with XML hardly at all.  That
will be obvious I guess.

I am using SOXML to convert an xml string into something I can use.

!--- http://66.165.78.2/testoutput.cfm: ---
cfset variables.thisxml=?xml version=1.0 encoding=UTF-8?
ww_javagame ww_cpid0425070052843/ww_cpid
ww_statuscode2001/ww_statuscodeww_statusmsgwoo
hoo/ww_statusmsg /ww_javagame
cf_SOXML
action=XML2CF
input=#variables.thisxml#
output=myXML
cfdump var=#myxml# label=myXML

It produces a nested structure (you can view the cfdump for this code
at the url above).

How the heck would I reference individual values in my CF?  I tried

#myXML.ww_javagame.ww_cpid.value# and my error handler just laughed.
What stupid mistake am I making this evening?

--
--mattRobertson--
Janitor, MSB Web Systems
mysecretbase.com
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.3 - Release Date: 25/04/2005


~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204421
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Stupid XML question

2005-04-26 Thread Matt Robertson
Yeah before I hit the hay last night I had to try out xmlParse() and
boy is that ever simple.  I'd much rather use the native function on
general principles, and besides, performancewise its light years
faster than the custom tag.

Thanks to everyone for helping out!
-- 
--mattRobertson--
Janitor, MSB Web Systems
mysecretbase.com

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204470
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Stupid XML question

2005-04-25 Thread Matt Robertson
OK.  First I must confess I don't work with XML hardly at all.  That
will be obvious I guess.

I am using SOXML to convert an xml string into something I can use.

!--- http://66.165.78.2/testoutput.cfm: ---
cfset variables.thisxml=?xml version=1.0 encoding=UTF-8?
ww_javagame ww_cpid0425070052843/ww_cpid
ww_statuscode2001/ww_statuscodeww_statusmsgwoo
hoo/ww_statusmsg /ww_javagame
cf_SOXML 
action=XML2CF
input=#variables.thisxml#
output=myXML
cfdump var=#myxml# label=myXML

It produces a nested structure (you can view the cfdump for this code
at the url above).

How the heck would I reference individual values in my CF?  I tried

#myXML.ww_javagame.ww_cpid.value# and my error handler just laughed. 
What stupid mistake am I making this evening?

-- 
--mattRobertson--
Janitor, MSB Web Systems
mysecretbase.com

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204401
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Stupid XML question

2005-04-25 Thread Sean Corfield
On 4/25/05, Matt Robertson [EMAIL PROTECTED] wrote:
 I am using SOXML to convert an xml string into something I can use.

Are you using CF5 or CFMX?

 !--- http://66.165.78.2/testoutput.cfm: ---

Not authorized to access this page!

 cfset variables.thisxml=?xml version=1.0 encoding=UTF-8?
 ww_javagame ww_cpid0425070052843/ww_cpid
 ww_statuscode2001/ww_statuscodeww_statusmsgwoo
 hoo/ww_statusmsg /ww_javagame

 #myXML.ww_javagame.ww_cpid.value# and my error handler just laughed.

If you were using CFMX's xmlParse() I'd say you would use:

#myXML.ww_javagame.ww_cpid.xmlText#
-- 
Sean A Corfield -- http://corfield.org/
Team Fusebox -- http://fusebox.org/
Got Gmail? -- I have 50, yes 50, invites to give away!

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204402
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


XML Question

2005-01-31 Thread Charles Heizer
Hello,
I'm new to using XML parsing in coldfusion so I hope I'm phrasing this 
question properly. I was wondering if it's possible to query a xml doc 
and return all of the attribute names (Name, Address, City). I have a 
long list of them and I would like to make my form as dynamic as 
possible.

Thanks,
- Charles

SERVICE
NameCharles/Name
Address123 Main St./Address
CityLivermore/City
/SERVICE


~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192374
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: XML Question

2005-01-31 Thread Qasim Rasheed
Have you looked into using XMLSearch function?


On Mon, 31 Jan 2005 10:38:16 -0800, Charles Heizer [EMAIL PROTECTED] wrote:
 Hello,
 I'm new to using XML parsing in coldfusion so I hope I'm phrasing this
 question properly. I was wondering if it's possible to query a xml doc
 and return all of the attribute names (Name, Address, City). I have a
 long list of them and I would like to make my form as dynamic as
 possible.
 
 Thanks,
 - Charles
 
 SERVICE
NameCharles/Name
Address123 Main St./Address
CityLivermore/City
 /SERVICE
 
 

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192381
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: XML Question

2005-01-31 Thread Ian Skinner
Well to start with, in your code example, name, address and city are child 
notes, not attributes.
SERVICE
NameCharles/Name
Address123 Main St./Address
CityLivermore/City
/SERVICE

If your document was formatted like this, they would be attributes.
SERVICE
Name=Charles
Address=123 Main St.
City=Livermore/

So for the former; name, address and city are part of the XMLchildren's array.
cfloop from=1 to #arrayLen(xmlVAR.service.XMLchildren)# index=i
#xmlVAR.service.XMLchildren[i].xmlName# = 
#xmlVAR.service.XMLchildren[i].xmlText#
/cfloop

For the latter; name, address and city are part of the XMLAttributes Structure.
cfoutput
cfloop collection=#xmlVAR.SERVICE.XmlAttributes# item=i
#i# = #xmlVAR.SERVICE.XmlAttributes[i]#
/cfloop
/cfoutput

HTH

--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
C code. C code run. Run code run. Please!
- Cynthia Dunning

...-Original Message-
...From: Charles Heizer [mailto:[EMAIL PROTECTED]
...Sent: Monday, January 31, 2005 10:38 AM
...To: CF-Talk
...Subject: XML Question
...
...Hello,
...I'm new to using XML parsing in coldfusion so I hope I'm phrasing this
...question properly. I was wondering if it's possible to query a xml doc
...and return all of the attribute names (Name, Address, City). I have a
...long list of them and I would like to make my form as dynamic as
...possible.
...
...Thanks,
...- Charles
...
...SERVICE
... NameCharles/Name
... Address123 Main St./Address
... CityLivermore/City
.../SERVICE
...
...
...

~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192383
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: XML Question

2005-01-31 Thread Charles Heizer
Thanks,
This works great!

- Charles

On Jan 31, 2005, at 11:05 AM, Ian Skinner wrote:

 cfloop from=1 to #arrayLen(xmlVAR.service.XMLchildren)# index=i
   #xmlVAR.service.XMLchildren[i].xmlName# = 
 #xmlVAR.service.XMLchildren[i].xmlText#
 /cfloop


~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192424
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


XML Question

2004-07-14 Thread Ben Densmore
If I have the following XML file:

events startDate=2003-01-01 endDate=2004-12-31
 event id=5 title=Test Event 5 description=every second tuesday
startDate=2003-01-01 endDate=2003-12-31 allDay=1
eventType=weekly
pattern sun=0 sat=0 fri=0 thu=0 wed=0 tue=1 mon=0 recur=2 /
 /event
/events

The pattern node is considered a child of event, is that correct? So
the structure would be:

events - Root Element
 event - Child of events
pattern - Child of event

I'm trying to display the info from the pattern element but not
receiving any data. I am trying to get at by doing:
cffunction access=public name=readXml output=false returntype=events
		cffile action="">
file=C:\cfusionmx\wwwroot\calendar\SparkEventsCalendar_loadXml.xml
variable=event
cfset variables.calEvents = XmlParse(event) /
cfset variables.eventChild =
ArrayLen(variables.calEvents.events.event.XmlChildren) /
		
		cfreturn this /
	/cffunction

I would think that the length of the array in variables.eventChild
would be 1 but it's returning 0. What am I missing when trying to
access the pattern node?

Thanks,
Ben
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: XML Question

2004-07-14 Thread Nick de Voil
 What am I missing when trying to
 access the pattern node?

cfdump.

Nick
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: XML Question

2004-07-14 Thread Ken Ferguson
This works just fine for me and returns 1.

cffunction access=public name=readXml output=false
returntype=numeric

cffile action="">

file=C:\inetpub\wwwroot\temp\ev.xml

variable=event

cfset variables.calEvents = XmlParse(event) /

cfset variables.eventChild =

ArrayLen(variables.calEvents.events.event.XmlChildren) /



cfreturn variables.eventChild

/cffunction

cfoutput#readXml()#/cfoutput
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: XML Question

2004-07-14 Thread Ian Skinner
The best advice I can give, hopefully you are on MX, is CFDUMP.When I was learning to parse an XML file, I just used CFDUMP Var =... starting at the root, working down until I got to the right piece.I'm not sure, but for some reason, I just could never get it right if I just tried to jump right to the node, I always missed some piece of the syntax.

--
Ian Skinner
Web Programmer
BloodSource
file:///C:\Documents%20and%20Settings\iskinner\Application%20Data\Microsoft\Signatures\www.BloodSource.org www.BloodSource.org http://www.BloodSource.orgSacramento 
Sacramento, CA

C code. C code run. Run code run. Please!
- Cynthia Dunning

Confidentiality Notice:This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: XML Question

2003-09-11 Thread Joe Eugene
 Get the children of an element, easy... get the parent of an
 element, I have
 no clue...

CFMX allows basic xml parsing in the simplest form(i.e array and structs)
If you are trying to accomlish XML Parsing in the Popular or Best ways..
I suggest you use XML DOM Parsing with Java.

You have alot functions like

getParentNode(), getChildNode etc to accomplish tasks easier..
Here is some documentation on XML Node
http://java.sun.com/j2se/1.4.1/docs/api/org/w3c/dom/Node.html

Joe Eugene


 -Original Message-
 From: Brad Roberts [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 11, 2003 1:29 AM
 To: CF-Talk
 Subject: RE: XML Question


 Let me re-ask my question...

 What's the best way to insert a child element under page
 id=2, when you
 don't know where it's at in the XML doc?  All you know is that it has an
 attribute id and the value is 2.

 Another thought (along the same lines), if you wanted to show the
 ancestors
 of a specific element, how would this be accomplished?  An
 example would be
 displaying breadcrumbs.  Again, all you would know is the page
 id.  Would
 this require a recursive udf/tag?  And if so, how do you get the parent
 element of a given element.  I can't find this anywhere in the docs (or
 web).

 Get the children of an element, easy... get the parent of an
 element, I have
 no clue...

 Thanks,

 Brad

 -Original Message-
 From: Joe Eugene [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 11, 2003 12:28 AM
 To: CF-Talk
 Subject: RE: XML Question


 Do an xml search for the attribute with XPath..
 xmlSearch(xmlDocObject, Pages/[EMAIL PROTECTED]'2']);

 Or Iterate through the node to find id=2

 Joe Eugene


  -Original Message-
  From: Brad Roberts [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, September 10, 2003 8:15 PM
  To: CF-Talk
  Subject: XML Question
 
 
  Give the following XML, how can I get the full path to a given element?
 
  pages
page id=1 name=Home Page
  page id=2 name=Products
page id=5 name=ColdFusion/
page id=6 name=Dreamweaver/
page id=7 name=Flash/
  /page
  page id=3 name=Support
page id=4 name=FAQ/
  /page
/page
  /pages
 
  Let's say I want to add a child element under page 2, but I don't know
  where 2 falls in the xml object.  All I know is I want to insert a child
  under the page with ID 2.
 
  Any ideas?
 
  Thanks,
 
  Brad
 
 
 

 
~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com


RE: XML Question

2003-09-11 Thread Brad Roberts
Cool!  I'd love to be able to take advantage of these methods, but I don't
know squat about Java.

So, how do you call these methods from within CF?  Any examples you can
point me to?

-Brad

-Original Message-
From: Joe Eugene [mailto:[EMAIL PROTECTED]
Sent: Friday, September 12, 2003 12:02 AM
To: CF-Talk
Subject: RE: XML Question


 Get the children of an element, easy... get the parent of an
 element, I have
 no clue...

CFMX allows basic xml parsing in the simplest form(i.e array and structs)
If you are trying to accomlish XML Parsing in the Popular or Best ways..
I suggest you use XML DOM Parsing with Java.

You have alot functions like

getParentNode(), getChildNode etc to accomplish tasks easier..
Here is some documentation on XML Node
http://java.sun.com/j2se/1.4.1/docs/api/org/w3c/dom/Node.html

Joe Eugene


 -Original Message-
 From: Brad Roberts [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 11, 2003 1:29 AM
 To: CF-Talk
 Subject: RE: XML Question


 Let me re-ask my question...

 What's the best way to insert a child element under page
 id=2, when you
 don't know where it's at in the XML doc?  All you know is that it has an
 attribute id and the value is 2.

 Another thought (along the same lines), if you wanted to show the
 ancestors
 of a specific element, how would this be accomplished?  An
 example would be
 displaying breadcrumbs.  Again, all you would know is the page
 id.  Would
 this require a recursive udf/tag?  And if so, how do you get the parent
 element of a given element.  I can't find this anywhere in the docs (or
 web).

 Get the children of an element, easy... get the parent of an
 element, I have
 no clue...

 Thanks,

 Brad

 -Original Message-
 From: Joe Eugene [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 11, 2003 12:28 AM
 To: CF-Talk
 Subject: RE: XML Question


 Do an xml search for the attribute with XPath..
 xmlSearch(xmlDocObject, Pages/[EMAIL PROTECTED]'2']);

 Or Iterate through the node to find id=2

 Joe Eugene


  -Original Message-
  From: Brad Roberts [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, September 10, 2003 8:15 PM
  To: CF-Talk
  Subject: XML Question
 
 
  Give the following XML, how can I get the full path to a given element?
 
  pages
page id=1 name=Home Page
  page id=2 name=Products
page id=5 name=ColdFusion/
page id=6 name=Dreamweaver/
page id=7 name=Flash/
  /page
  page id=3 name=Support
page id=4 name=FAQ/
  /page
/page
  /pages
 
  Let's say I want to add a child element under page 2, but I don't know
  where 2 falls in the xml object.  All I know is I want to insert a child
  under the page with ID 2.
 
  Any ideas?
 
  Thanks,
 
  Brad
 
 
 



~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com


Re: XML Question

2003-09-11 Thread Massimo, Tiziana e Federica
 Cool!  I'd love to be able to take advantage of these methods, but I don't
 know squat about Java.
 
 So, how do you call these methods from within CF?  Any examples you can
 point me to?

Well, in order to turn an XML string into a DOM object you could use this:

http://www.cfmentor.com/code/index.cfm?action=scriptid=127


Massimo Foti
Certified Dreamweaver MX Developer
Certified Advanced ColdFusion MX Developer
http://www.massimocorner.com/



~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com


XML Question

2003-09-10 Thread Brad Roberts
Give the following XML, how can I get the full path to a given element?

pages
  page id=1 name=Home Page
page id=2 name=Products
  page id=5 name=ColdFusion/
  page id=6 name=Dreamweaver/
  page id=7 name=Flash/
/page
page id=3 name=Support
  page id=4 name=FAQ/
/page
  /page
/pages

Let's say I want to add a child element under page 2, but I don't know
where 2 falls in the xml object.  All I know is I want to insert a child
under the page with ID 2.

Any ideas?

Thanks,

Brad


~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm


RE: XML Question

2003-09-10 Thread Joe Eugene
Do an xml search for the attribute with XPath..
xmlSearch(xmlDocObject, Pages/[EMAIL PROTECTED]'2']);

Or Iterate through the node to find id=2

Joe Eugene


 -Original Message-
 From: Brad Roberts [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 10, 2003 8:15 PM
 To: CF-Talk
 Subject: XML Question
 
 
 Give the following XML, how can I get the full path to a given element?
 
 pages
   page id=1 name=Home Page
 page id=2 name=Products
   page id=5 name=ColdFusion/
   page id=6 name=Dreamweaver/
   page id=7 name=Flash/
 /page
 page id=3 name=Support
   page id=4 name=FAQ/
 /page
   /page
 /pages
 
 Let's say I want to add a child element under page 2, but I don't know
 where 2 falls in the xml object.  All I know is I want to insert a child
 under the page with ID 2.
 
 Any ideas?
 
 Thanks,
 
 Brad
 
 
 
~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm


RE: XML Question

2003-09-10 Thread Brad Roberts
Let me re-ask my question...

What's the best way to insert a child element under page id=2, when you
don't know where it's at in the XML doc?  All you know is that it has an
attribute id and the value is 2.

Another thought (along the same lines), if you wanted to show the ancestors
of a specific element, how would this be accomplished?  An example would be
displaying breadcrumbs.  Again, all you would know is the page id.  Would
this require a recursive udf/tag?  And if so, how do you get the parent
element of a given element.  I can't find this anywhere in the docs (or
web).

Get the children of an element, easy... get the parent of an element, I have
no clue...

Thanks,

Brad

-Original Message-
From: Joe Eugene [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 11, 2003 12:28 AM
To: CF-Talk
Subject: RE: XML Question


Do an xml search for the attribute with XPath..
xmlSearch(xmlDocObject, Pages/[EMAIL PROTECTED]'2']);

Or Iterate through the node to find id=2

Joe Eugene


 -Original Message-
 From: Brad Roberts [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 10, 2003 8:15 PM
 To: CF-Talk
 Subject: XML Question


 Give the following XML, how can I get the full path to a given element?

 pages
   page id=1 name=Home Page
 page id=2 name=Products
   page id=5 name=ColdFusion/
   page id=6 name=Dreamweaver/
   page id=7 name=Flash/
 /page
 page id=3 name=Support
   page id=4 name=FAQ/
 /page
   /page
 /pages

 Let's say I want to add a child element under page 2, but I don't know
 where 2 falls in the xml object.  All I know is I want to insert a child
 under the page with ID 2.

 Any ideas?

 Thanks,

 Brad




~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm


xml question

2002-12-11 Thread Seamus Campbell
Hi
I'm grappling with some xml
I want to export data from my database in an xml file but I only get the 
1st record
I'm doing this: (but I can't see how to loop over each record)

cfquery name=get_data datasource=#request.main_dsn# dbtype=ODBC
SELECT tblWEBSTOCKLEVEL.CustomerID, tblWEBSTOCKLEVEL.ProductCode, 
tblWEBSTOCKLEVEL.ProductDescription, tblWEBSTOCKLEVEL.StockLevel
FROM tblWEBSTOCKLEVEL
WHERE (((tblWEBSTOCKLEVEL.CustomerID)=1));
/cfquery

!--- create a temporary variable to hold XML document ---
cfset tempxml=?xml version 1.0?
stock_levels
CustomerID#trim(#XMLFormat(get_data.CustomerID)#)#/CustomerID
stock_details
cfloop query=get_data
item
ProductCode=#trim(#XMLFormat(get_data.ProductCode)#)#
ProductDescription=#trim(#XMLFormat(get_data.ProductDescription)#)#
StockLevel=#trim(#XMLFormat(get_data.StockLevel)#)#/
/cfloop
/stock_details
/stock_levels


Can anyone help me please with the looping needed to get each record rather 
than just the first one.
Many thanks
Seamus


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com



RE: xml question

2002-12-11 Thread Kola Oyedeji
Seamus

I think your problem is that you have coldfusion tags inside the string
being set to tempxml and is thus being ignored instead of interpreted.
What version of cf are you using? If you are using CF5 you can use
cfsavecontent to wrap the output instead of using cfset.

In CFMX I think there are some XML functions which should allow you to
do this more cleanly.

Finally It may sound silly but double check that the query actually
returns multiple rows.

HTH

Kola

 -Original Message-
 From: Seamus Campbell [mailto:[EMAIL PROTECTED]]
 Sent: 11 December 2002 11:02
 To: CF-Talk
 Subject: xml question
 
 Hi
 I'm grappling with some xml
 I want to export data from my database in an xml file but I only get
the
 1st record
 I'm doing this: (but I can't see how to loop over each record)
 
 cfquery name=get_data datasource=#request.main_dsn#
dbtype=ODBC
 SELECT tblWEBSTOCKLEVEL.CustomerID, tblWEBSTOCKLEVEL.ProductCode,
 tblWEBSTOCKLEVEL.ProductDescription, tblWEBSTOCKLEVEL.StockLevel
 FROM tblWEBSTOCKLEVEL
 WHERE (((tblWEBSTOCKLEVEL.CustomerID)=1));
 /cfquery
 
 !--- create a temporary variable to hold XML document ---
 cfset tempxml=?xml version 1.0?
 stock_levels
 CustomerID#trim(#XMLFormat(get_data.CustomerID)#)#/CustomerID
 stock_details
 cfloop query=get_data
 item
 ProductCode=#trim(#XMLFormat(get_data.ProductCode)#)#

ProductDescription=#trim(#XMLFormat(get_data.ProductDescription)#)#

 StockLevel=#trim(#XMLFormat(get_data.StockLevel)#)#/
 /cfloop
 /stock_details
 /stock_levels
 
 
 Can anyone help me please with the looping needed to get each record
 rather
 than just the first one.
 Many thanks
 Seamus
 
 


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com



RE: xml question

2002-12-11 Thread Seamus Campbell
Thanks Kola,
I have checked that the query returns multiple records - and it does.
I am using CF5.
I can write  read the xml file - but as you suggest the cfloop.. is 
getting ignored (I think).
This is my xml file
- xmp
?xml version=1.0 ?
- stock_levels
CustomerID1/CustomerID
- stock_details
- cfloop query=get_data
item ProductCode=A8-1 ProductDescription=As A Matther of Fact (32) 
StockLevel=4992 /
/cfloop
/stock_details
/stock_levels
/xmp

Any help gratefully received

(I tried cfsavecontent but can't get the stuff within the cfloop to get 
interpreted)




At 22:27 11/12/02 , you wrote:
Seamus

I think your problem is that you have coldfusion tags inside the string
being set to tempxml and is thus being ignored instead of interpreted.
What version of cf are you using? If you are using CF5 you can use
cfsavecontent to wrap the output instead of using cfset.

In CFMX I think there are some XML functions which should allow you to
do this more cleanly.

Finally It may sound silly but double check that the query actually
returns multiple rows.

HTH

Kola

  -Original Message-
  From: Seamus Campbell [mailto:[EMAIL PROTECTED]]
  Sent: 11 December 2002 11:02
  To: CF-Talk
  Subject: xml question
 
  Hi
  I'm grappling with some xml
  I want to export data from my database in an xml file but I only get
the
  1st record
  I'm doing this: (but I can't see how to loop over each record)
 
  cfquery name=get_data datasource=#request.main_dsn#
dbtype=ODBC
  SELECT tblWEBSTOCKLEVEL.CustomerID, tblWEBSTOCKLEVEL.ProductCode,
  tblWEBSTOCKLEVEL.ProductDescription, tblWEBSTOCKLEVEL.StockLevel
  FROM tblWEBSTOCKLEVEL
  WHERE (((tblWEBSTOCKLEVEL.CustomerID)=1));
  /cfquery
 
  !--- create a temporary variable to hold XML document ---
  cfset tempxml=?xml version 1.0?
  stock_levels
  CustomerID#trim(#XMLFormat(get_data.CustomerID)#)#/CustomerID
  stock_details
  cfloop query=get_data
  item
  ProductCode=#trim(#XMLFormat(get_data.ProductCode)#)#
 
ProductDescription=#trim(#XMLFormat(get_data.ProductDescription)#)#

  StockLevel=#trim(#XMLFormat(get_data.StockLevel)#)#/
  /cfloop
  /stock_details
  /stock_levels
  
 
  Can anyone help me please with the looping needed to get each record
  rather
  than just the first one.
  Many thanks
  Seamus
 
 
 


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



RE: xml question

2002-12-11 Thread Kola Oyedeji
Seamus

I noticed a few things which may stop it from working.

First Cfsavecontent still requires ## around variables you want
displayed and the call to cfsavecontent needs to be wrapped in cfoutput
tags

Second I don't think you need to escape the double quotes, if you do,
Use single quotes instead this should make the code more readable

Also you had quotes where they're not needed e.g. when using the trim
function if the value is a function call or a variable you do not need
the quotes.

Finally the line..

CustomerID#trim(#XMLFormat(get_data.CustomerID)#)#/CustomerID

will always return one as this is not inside the loop so it will always
refer to the first record not sure if that's what you wanted.

I have cleaned the code up a little below let me know if this works..

cfquery name=get_data datasource=#request.main_dsn# dbtype=ODBC
SELECT tblWEBSTOCKLEVEL.CustomerID, tblWEBSTOCKLEVEL.ProductCode, 
tblWEBSTOCKLEVEL.ProductDescription, tblWEBSTOCKLEVEL.StockLevel
FROM tblWEBSTOCKLEVEL
WHERE (((tblWEBSTOCKLEVEL.CustomerID)=1));
/cfquery

!--- create a temporary variable to hold XML document ---
cfoutput
cfsavecontent variable=tempxml 
?xml version 1.0?
stock_levels
CustomerID#trim(XMLFormat(get_data.CustomerID))#/CustomerID
stock_details
cfloop query=get_data
item
ProductCode=#trim(XMLFormat(get_data.ProductCode))#
 
ProductDescription=#trim(XMLFormat(get_data.ProductDescription))#
StockLevel=#trim(XMLFormat(get_data.StockLevel))#/
/cfloop
/stock_details
/stock_levels
/cfsavecontent
/cfoutput

HTH

Kola
 -Original Message-
 From: Seamus Campbell [mailto:[EMAIL PROTECTED]]
 Sent: 11 December 2002 12:23
 To: CF-Talk
 Subject: RE: xml question
 
 Thanks Kola,
 I have checked that the query returns multiple records - and it does.
 I am using CF5.
 I can write  read the xml file - but as you suggest the cfloop..
is
 getting ignored (I think).
 This is my xml file
 - xmp
 ?xml version=1.0 ?
 - stock_levels
 CustomerID1/CustomerID
 - stock_details
 - cfloop query=get_data
 item ProductCode=A8-1 ProductDescription=As A Matther of Fact
(32)
 StockLevel=4992 /
 /cfloop
 /stock_details
 /stock_levels
 /xmp
 
 Any help gratefully received
 
 (I tried cfsavecontent but can't get the stuff within the cfloop to
get
 interpreted)
 
 
 
 
 At 22:27 11/12/02 , you wrote:
 Seamus
 
 I think your problem is that you have coldfusion tags inside the
string
 being set to tempxml and is thus being ignored instead of
interpreted.
 What version of cf are you using? If you are using CF5 you can use
 cfsavecontent to wrap the output instead of using cfset.
 
 In CFMX I think there are some XML functions which should allow you
to
 do this more cleanly.
 
 Finally It may sound silly but double check that the query actually
 returns multiple rows.
 
 HTH
 
 Kola
 
   -Original Message-
   From: Seamus Campbell [mailto:[EMAIL PROTECTED]]
   Sent: 11 December 2002 11:02
   To: CF-Talk
   Subject: xml question
  
   Hi
   I'm grappling with some xml
   I want to export data from my database in an xml file but I only
get
 the
   1st record
   I'm doing this: (but I can't see how to loop over each record)
  
   cfquery name=get_data datasource=#request.main_dsn#
 dbtype=ODBC
   SELECT tblWEBSTOCKLEVEL.CustomerID,
tblWEBSTOCKLEVEL.ProductCode,
   tblWEBSTOCKLEVEL.ProductDescription, tblWEBSTOCKLEVEL.StockLevel
   FROM tblWEBSTOCKLEVEL
   WHERE (((tblWEBSTOCKLEVEL.CustomerID)=1));
   /cfquery
  
   !--- create a temporary variable to hold XML document ---
   cfset tempxml=?xml version 1.0?
   stock_levels
  
CustomerID#trim(#XMLFormat(get_data.CustomerID)#)#/CustomerID
   stock_details
   cfloop query=get_data
   item
   ProductCode=#trim(#XMLFormat(get_data.ProductCode)#)#
  

ProductDescription=#trim(#XMLFormat(get_data.ProductDescription)#)#

 
   StockLevel=#trim(#XMLFormat(get_data.StockLevel)#)#/
   /cfloop
   /stock_details
   /stock_levels
   
  
   Can anyone help me please with the looping needed to get each
record
   rather
   than just the first one.
   Many thanks
   Seamus
  
  
  
 
 


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



xml question

2002-08-10 Thread Tony Weeg

If i have a DTD for an xml document that i am
getting back, as a response from a webservice, whats
the easiest way to take that xml feed that i get
back, and format for a web page (using that DTD?)

and i dont have cfmx, just cf 5.0

thanks!

...tony

tony weeg
[EMAIL PROTECTED]
www.revolutionwebdesign.com
rEvOlUtIoN wEb DeSiGn
410.334.6331 

__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



xml question

2002-08-10 Thread Tony Weeg

If i have a DTD for an xml document that i am
getting back, as a response from a webservice, whats
the easiest way to take that xml feed that i get
back, and format for a web page (using that DTD?)

and i dont have cfmx, just cf 5.0

thanks!

...tony

tony weeg
[EMAIL PROTECTED]
www.revolutionwebdesign.com
rEvOlUtIoN wEb DeSiGn
410.334.6331

__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: xml question

2002-08-10 Thread John Wilker

I think if you reference the DTD in the XML document won't IE display it
the way it should look?

I usually just use the MS XML parser and walk through it doing what I
need to do with each node.

J. 
 
John Wilker  Codito, ergo sum
Web Applications Consultant, and Writer
Macromedia Certified ColdFusion Developer
President/Founder, Inland Empire CFUG.
www.red-omega.com
 
I asked Do you know DOS?
 
The reply was: No, but I met Tom and Drew a few minutes ago.


-Original Message-
From: Tony Weeg [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, August 10, 2002 10:51 AM
To: CF-Talk
Subject: xml question


If i have a DTD for an xml document that i am
getting back, as a response from a webservice, whats
the easiest way to take that xml feed that i get
back, and format for a web page (using that DTD?)

and i dont have cfmx, just cf 5.0

thanks!

..tony

tony weeg
[EMAIL PROTECTED]
www.revolutionwebdesign.com
rEvOlUtIoN wEb DeSiGn
410.334.6331


__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: xml question

2002-08-10 Thread Tony Weeg

how does one reference a dtd in an xml doc?
ive looked, and im coming up shortthanks.

tony

-Original Message-
From: John Wilker [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, August 10, 2002 2:42 PM
To: CF-Talk
Subject: RE: xml question


I think if you reference the DTD in the XML document won't IE display it
the way it should look?

I usually just use the MS XML parser and walk through it doing what I
need to do with each node.

J. 
 
John Wilker  Codito, ergo sum
Web Applications Consultant, and Writer
Macromedia Certified ColdFusion Developer
President/Founder, Inland Empire CFUG.
www.red-omega.com
 
I asked Do you know DOS?
 
The reply was: No, but I met Tom and Drew a few minutes ago.


-Original Message-
From: Tony Weeg [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, August 10, 2002 10:51 AM
To: CF-Talk
Subject: xml question


If i have a DTD for an xml document that i am
getting back, as a response from a webservice, whats
the easiest way to take that xml feed that i get
back, and format for a web page (using that DTD?)

and i dont have cfmx, just cf 5.0

thanks!

.tony

tony weeg
[EMAIL PROTECTED]
www.revolutionwebdesign.com
rEvOlUtIoN wEb DeSiGn
410.334.6331



__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: xml question

2002-08-10 Thread Tony Weeg

ok , got that, that made/makes sense...i had sorta figgered that
out, when i had already hit Send...so then, dave, whats ur take
on using css-2 to format that xml doc, into html? or would you use xsl
to transform the xml to html?

tony

-Original Message-
From: Dave Watts [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, August 10, 2002 3:45 PM
To: CF-Talk
Subject: RE: xml question


 If i have a DTD for an xml document that i am
 getting back, as a response from a webservice, whats
 the easiest way to take that xml feed that i get
 back, and format for a web page (using that DTD?)

I think you're misunderstanding the purpose of a DTD, which is not to
provide formatting instructions, but rather to validate a given XML
document
that references the DTD. A DTD lists all of the possible elements, their
possible attributes, and the hierarchical relationship between those
elements. An XML parser can then parse the XML document. If the document
can
be parsed by the XML parser, it is said to be well-formed, meaning
that it
adheres to the generic syntactical rules of XML. The XML parser may then
check the document against the DTD, to make sure that it follows the
rules
specified in that DTD. If the document passes that test, it is said to
be
valid.

None of this has anything to do with formatting; the main point of XML
(to
greatly oversimplify things here) is to separate data from
device-specific
formatting, which is the problem with HTML.

If you want to format an XML document for display on a specific device,
such
as an HTML browser, you'd typically transform the XML document into
another
language, like XHTML. The standard way to do this is to write an XSL
transform, which is basically an XML document itself, which contains
rules
for converting a document in one XML language to some other format. Most
XML
parsers are capable of taking an XML document and applying an XSL
transformation to that document. In CF MX, you'd use the XMLTransform
function for this. In CF MX, you'd use whatever XML parser you're
already
using.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: xml question

2002-08-10 Thread Dave Watts

 ok , got that, that made/makes sense...i had sorta figgered 
 that out, when i had already hit Send...so then, dave, whats 
 ur take on using css-2 to format that xml doc, into html? 
 or would you use xsl to transform the xml to html?

I'd probably use XSL.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: xml question

2002-08-10 Thread Jon Hall

Unless you have some very complex, varied, or large xml documents, you
may want to simply convert your xml into a CF datatype (a structure)
and get a lot more flexibility as far as your design goes. SOXML can
do this. If this is going to be running on a CF platform, why not use
it? Either that, or if you are doing DOM parsing, use the XML DOM
object to choose which parts to display as John suggested.

CSS and XSL really tackle two different problems. XSL is used to
transform the particular XML doc into something else, using various
bits of logic. CSS is just CSS, it's just has to do with the display
of elements, just as when you style html elements. CSS has no
way to do any kind of testing on the element (other than IE's css
expressions...), XSL does. The two technologies complement each other.

-- 
jon
mailto:[EMAIL PROTECTED]

Saturday, August 10, 2002, 3:47:23 PM, you wrote:

TW ok , got that, that made/makes sense...i had sorta figgered that
TW out, when i had already hit Send...so then, dave, whats ur take
TW on using css-2 to format that xml doc, into html? or would you use xsl
TW to transform the xml to html?

TW tony

__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: XML question

2002-03-01 Thread Tim Stadinski

wddx is just another form of an xml document.  you can reference the dtd for
wddx here: http://www.wddx.org

i am not sure of your question though, they are two different sets of
technologies that have XML in common.

cheers,
Timothy Stadinski
Senior Software Engineer
Afternic.com
[EMAIL PROTECTED] 



-Original Message-
From: Rey Bango [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 11:40 PM
To: CF-Talk
Subject: Re: XML question


Andres,

Microsoft's XMLDOM component won't interfere w/ WDDX. The XMLDOM component
is a COM object which needs to be invoked using the CFOBJECT tag. The WDDX
functionality is built into CF and there are defined tags for using it.

HTH.

Rey...

- Original Message -
From: Andres [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Thursday, February 28, 2002 11:34 PM
Subject: RE: XML question


 Jon,
 Thank you for your help on this.

 Do you know if msxml will somehow affect CF's wddx implementation? i dont
know if the two relate to each other... but i am using wddx to export some
data to other systems, and dont want to interfere with those elements.

 Thanks!

 Andres

 -Original Message-
 From: Jon Hall [mailto:[EMAIL PROTECTED]]
 Sent: Thu 2/28/2002 8:45 PM
 To: CF-Talk
 Cc:
 Subject: Re: XML question



 I'd bet that it's same the problem I ran into when using MSXML via
 cfobject to grab the UPS XML, which is essentially what soxml does.
 CFObject apparently doesn't understand the nulls that MSXML passes back
 when an XML element is empty, and bombs. If you are running an older
 version of msxml you may want to upgrade it as 4.0 is out, that may fix
 some problems, as 4.0 is the first solid release imo.

 Have you tried the cf_usps tag? It handles pretty much everything for you.

http://devex.macromedia.com/developer/gallery/info.cfm?ID=9C9C2AB9-7F93-11D5
-83F300508B94F85Amethod=Full

 If you want to do it via soxml here is a real simple custom tag sample
 that I did that just returns the country information that usps passes
 back. Expanding upon this to do full rates would be pretty easy, but
 that's what the above tag goes anyway...

 CFPARAM NAME=attributes.userid
 CFPARAM NAME=attributes.password
 CFPARAM NAME=attributes.server

 CFSCRIPT
 services = 'PACKAGE';
 APIstr = 'IntlRate';
 XMLstr = 'IntlRateRequest USERID=#attributes.userid#
 PASSWORD=#attributes.password#';

 XMLstr = XMLstr  'Package ID=1
 Pounds0/Pounds
 Ounces1/Ounces
 MailTypePackage/MailType
 Country#Attributes.country#/Country
 /Package';
 XMLstr = XMLstr  '/IntlRateRequest';
 /CFSCRIPT


 CFHTTP
 URL=#attributes.server#?API=#APIstr#XML=#urlencodedformat(XMLstr)#
 method=GET resolveurl=false timeout=45
 CFSET XMLResp = CFHTTP.FileContent

 cf_SOXML
action=XML2CF
input=#xmlResp#
output=countryData
type=Variables
 
 cfset caller.countryData = countryData.intlRateResponse.package


 jon

 ps For anyone who cares, FEDEX is finally planning on releasing an XML
 API withing the next two months. It's already been delayed once from Q4
 2001 though, so I'm not getting my hopes up though.

 Andres wrote:
  This a rather long email...
 
  i am trying to query the USPS international rate calculator via their
  API. Their response is an XML document which i am parsing via SOXML.
  This is a great tool!
 
 snip
 
  CF throws an error saying that it cannot resolve the parameter
  outhere.IntlRateResponse.Service. Even though this does exist and indeed
  is to be an array since there are two of them.
 
  Any help would be much appreciated!
 
  Thank you
 



 

__
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: XML question

2002-03-01 Thread Jon Hall

I have a funny feeling Rey knows all about wddx already ;-)
It's openwddx.org now though.

jon
- Original Message -
From: Tim Stadinski [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Friday, March 01, 2002 6:46 PM
Subject: RE: XML question


 wddx is just another form of an xml document.  you can reference the dtd
for
 wddx here: http://www.wddx.org

 i am not sure of your question though, they are two different sets of
 technologies that have XML in common.

 cheers,
 Timothy Stadinski
 Senior Software Engineer
 Afternic.com
 [EMAIL PROTECTED]



 -Original Message-
 From: Rey Bango [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 28, 2002 11:40 PM
 To: CF-Talk
 Subject: Re: XML question


 Andres,

 Microsoft's XMLDOM component won't interfere w/ WDDX. The XMLDOM component
 is a COM object which needs to be invoked using the CFOBJECT tag. The WDDX
 functionality is built into CF and there are defined tags for using it.

 HTH.

 Rey...


__
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: XML question

2002-03-01 Thread Aaron Rouse

Does anyone know of a online source with some examples of accessing WDDX
packets from within a VB application?  I know Forta's book has one example
of this and the SDK for WDDX has a little bit, but that is about all I have
been able to find. Like how it is www.openwddx.org now but the SDK points to
www.wddx.org still, sure does instill confidence in me.  ;)

Snipe - CF_BotMaster Network=EFNet Channel=ColdFusion


- Original Message -
From: Jon Hall [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Friday, March 01, 2002 6:32 PM
Subject: Re: XML question


 I have a funny feeling Rey knows all about wddx already ;-)
 It's openwddx.org now though.

 jon
 - Original Message -
 From: Tim Stadinski [EMAIL PROTECTED]
 To: CF-Talk [EMAIL PROTECTED]
 Sent: Friday, March 01, 2002 6:46 PM
 Subject: RE: XML question


  wddx is just another form of an xml document.  you can reference the dtd
 for
  wddx here: http://www.wddx.org
 
  i am not sure of your question though, they are two different sets of
  technologies that have XML in common.
 
  cheers,
  Timothy Stadinski
  Senior Software Engineer
  Afternic.com
  [EMAIL PROTECTED]
 
 
 
  -Original Message-
  From: Rey Bango [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, February 28, 2002 11:40 PM
  To: CF-Talk
  Subject: Re: XML question
 
 
  Andres,
 
  Microsoft's XMLDOM component won't interfere w/ WDDX. The XMLDOM
component
  is a COM object which needs to be invoked using the CFOBJECT tag. The
WDDX
  functionality is built into CF and there are defined tags for using it.
 
  HTH.
 
  Rey...
 

 
__
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



XML question

2002-02-28 Thread Andres

This a rather long email... 

i am trying to query the USPS international rate calculator via their 
API. Their response is an XML document which i am parsing via SOXML. 
This is a great tool!

an example of the xml that i receive from USPS is as 
follows..==
?xml version=1.0?
IntlRateResponse
Package ID=0
ProhibitionsCurrency of the Albanian State Bank (Banknotes in lek). 
Extravagant clothes and other articles contrary to Albanians' taste. 
Items sent by political emigres. /Prohibitions
RestrictionsHunting arms require an import permit. Medicines for 
personal use are admitted provided the addressee has a medical 
certificate./Restrictions
Observations1. Letter packages may not contain dutiable articles. 2. 
Parcel post service extends only to: Berat Konispol Milot Bilisht Korce 
Peqin/Observations
CustomsFormsPostal Union Mail (LC/AO): PS Form 2976 or 2976-A (see 
123.61) Parcel Post: PS Form 2976-A inside 2976-E 
(envelope)/CustomsForms
ExpressMailCountry Code AL Reciprocal Service Name EMS Required 
Customs Form/Endorsement 1. For correspondence and business papers: PS 
Form 2976, Customs - CN 22 (Old C 1) and Sender's Declaration (green 
label). Endorse item clearly next to mailing label as BUSINESS 
PAPERS./ExpressMail
AreasServedTirana./AreasServed
Service ID=0
Pounds2/Pounds
Ounces0/Ounces
MailTypePackage/MailType
CountryALBANIA/Country
Postage87/Postage
SvcCommitmentsSee Service Guide/SvcCommitments
SvcDescriptionGlobal Express Guaranteed (GXG) Document 
Service/SvcDescription
MaxDimensionsMax. length 46, depth 35, height 46 and max. 
girth 
108/MaxDimensions
MaxWeight22/MaxWeight
/Service
Service ID=1
Pounds2/Pounds
Ounces0/Ounces
MailTypePackage/MailType
CountryALBANIA/Country
Postage96/Postage
SvcCommitmentsSee Service Guide/SvcCommitments
SvcDescriptionGlobal Express Guaranteed (GXG) Non-Document 
Service/SvcDescription
MaxDimensionsMax. length 46, depth 35, height 46 and max. 
girth 
108/MaxDimensions
MaxWeight22/MaxWeight
/Service
/Package
/IntlRateResponse==

I am very new using XML, but the way soxml parses it is by using 
cfscript and looping thorugh the array for each main object in the xml 
doc.

Following the xml2cf section, i basically loop through the array of 
objects in the xml doc as follows:
==
cfif isArray(outhere.IntlRateResponse.Package)
  cfloop index=package_pointer from=1 
to=#ArrayLen(outhere.IntlRateResponse.Package)#
   cfscript
sProhivitions = 
outhere.IntlRateResponse.Package[package_pointer].Prohibitions.value;
sRestrictions = 
utoutherehere.IntlRateResponse.Package[package_pointer].Restrictions.valu
e;
sObservations = 
outhere.IntlRateResponse.Package[package_pointer].Observations.value;
sCustomsForms = 
uthouthereere.IntlRateResponse.Package[package_pointer].CustomsForms.valu
e;
sExpressMail = 
outhere.IntlRateResponse.Package[package_pointer].ExpressMail.value;
sAreasServed = 
outhere.IntlRateResponse.Package[package_pointer].AreasServed.value;
/cfscript
cfelse
cfscript
sProhivitions = 
outhere.IntlRateResponse.Package[package_pointer].Prohibitions.value;
sRestrictions = 
utoutherehere.IntlRateResponse.Package[package_pointer].Restrictions.valu
e;
sObservations = 
outhere.IntlRateResponse.Package[package_pointer].Observations.value;
sCustomsForms = 
uthouthereere.IntlRateResponse.Package[package_pointer].CustomsForms.valu
e;
sExpressMail = 
outhere.IntlRateResponse.Package[package_pointer].ExpressMail.value;
sAreasServed = 
outhere.IntlRateResponse.Package[package_pointer].AreasServed.value;
/cfscript
/cfif==


This, so far, works fine. However, the problem i enconter is when i try 
to utilize the second object: Service. Whe i run the following code, 


cfif isArray(outhere.IntlRateResponse.Service)
cfloop index=service_pointer from=1 
to=#ArrayLen(outhere.IntlRateResponse.Service)#
 cfscript
  //Lets grab the nodes of the information we want to display
sPounds = 
outhere.IntlRateResponse.Service[service_pointer].Prohibitions.value;

RE: XML question

2002-02-28 Thread Matthew Walker

Might be stating the obvious, but have you used cfdump to do a visual check
of your struct outhere ?

 -Original Message-
 From: Andres [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 1 March 2002 12:50 pm
 To: CF-Talk
 Subject: XML question


 This a rather long email...

 i am trying to query the USPS international rate calculator via their
 API. Their response is an XML document which i am parsing via SOXML.
 This is a great tool!

 an example of the xml that i receive from USPS is as
 follows..==
 ?xml version=1.0?
 IntlRateResponse
   Package ID=0
   ProhibitionsCurrency of the Albanian State
 Bank (Banknotes in lek).
 Extravagant clothes and other articles contrary to Albanians' taste.
 Items sent by political emigres. /Prohibitions
   RestrictionsHunting arms require an import
 permit. Medicines for
 personal use are admitted provided the addressee has a medical
 certificate./Restrictions
   Observations1. Letter packages may not
 contain dutiable articles. 2.
 Parcel post service extends only to: Berat Konispol Milot
 Bilisht Korce
 Peqin/Observations
   CustomsFormsPostal Union Mail (LC/AO): PS
 Form 2976 or 2976-A (see
 123.61) Parcel Post: PS Form 2976-A inside 2976-E
 (envelope)/CustomsForms
   ExpressMailCountry Code AL Reciprocal Service
 Name EMS Required
 Customs Form/Endorsement 1. For correspondence and business
 papers: PS
 Form 2976, Customs - CN 22 (Old C 1) and Sender's Declaration (green
 label). Endorse item clearly next to mailing label as BUSINESS
 PAPERS./ExpressMail
   AreasServedTirana./AreasServed
   Service ID=0
   Pounds2/Pounds
   Ounces0/Ounces
   MailTypePackage/MailType
   CountryALBANIA/Country
   Postage87/Postage
   SvcCommitmentsSee Service
 Guide/SvcCommitments
   SvcDescriptionGlobal Express
 Guaranteed (GXG) Document
 Service/SvcDescription
   MaxDimensionsMax. length 46, depth
 35, height 46 and max. girth
 108/MaxDimensions
   MaxWeight22/MaxWeight
   /Service
   Service ID=1
   Pounds2/Pounds
   Ounces0/Ounces
   MailTypePackage/MailType
   CountryALBANIA/Country
   Postage96/Postage
   SvcCommitmentsSee Service
 Guide/SvcCommitments
   SvcDescriptionGlobal Express
 Guaranteed (GXG) Non-Document
 Service/SvcDescription
   MaxDimensionsMax. length 46, depth
 35, height 46 and max. girth
 108/MaxDimensions
   MaxWeight22/MaxWeight
   /Service
   /Package
 /IntlRateResponse==

 I am very new using XML, but the way soxml parses it is by using
 cfscript and looping thorugh the array for each main object
 in the xml
 doc.

 Following the xml2cf section, i basically loop through the array of
 objects in the xml doc as follows:
 ==
 cfif isArray(outhere.IntlRateResponse.Package)
   cfloop index=package_pointer from=1
 to=#ArrayLen(outhere.IntlRateResponse.Package)#
cfscript
   sProhivitions =
 outhere.IntlRateResponse.Package[package_pointer].Prohibitions.value;
   sRestrictions =
 utoutherehere.IntlRateResponse.Package[package_pointer].Restri
 ctions.valu
 e;
   sObservations =
 outhere.IntlRateResponse.Package[package_pointer].Observations.value;
   sCustomsForms =
 uthouthereere.IntlRateResponse.Package[package_pointer].Custom
 sForms.valu
 e;
   sExpressMail =
 outhere.IntlRateResponse.Package[package_pointer].ExpressMail.value;
   sAreasServed =
 outhere.IntlRateResponse.Package[package_pointer].AreasServed.value;
 /cfscript
 cfelse
 cfscript
   sProhivitions =
 outhere.IntlRateResponse.Package[package_pointer].Prohibitions.value;
   sRestrictions =
 utoutherehere.IntlRateResponse.Package[package_pointer].Restri
 ctions.valu
 e;
   sObservations =
 outhere.IntlRateResponse.Package[package_pointer].Observations.value;
   sCustomsForms =
 uthouthereere.IntlRateResponse.Package[package_pointer].Custom
 sForms.valu
 e;
   sExpressMail =
 outhere.IntlRateResponse.Package[package_pointer].ExpressMail.value;
   sAreasServed =
 outhere.IntlRateResponse.Package[package_pointer].AreasServed.value;
 /cfscript
 /cfif==


 This, so far, works fine. However, the problem i enconter is
 when i try
 to utilize the second object: Service. Whe i run the
 following code,


 cfif isArray(outhere.IntlRateResponse.Service)
   cfloop index=service_pointer from=1

Re: XML question

2002-02-28 Thread Jon Hall

I'd bet that it's same the problem I ran into when using MSXML via 
cfobject to grab the UPS XML, which is essentially what soxml does
CFObject apparently doesn't understand the nulls that MSXML passes back 
when an XML element is empty, and bombs If you are running an older 
version of msxml you may want to upgrade it as 40 is out, that may fix 
some problems, as 40 is the first solid release imo

Have you tried the cf_usps tag? It handles pretty much everything for you
http://devexmacromediacom/developer/gallery/infocfm?ID=9C9C2AB9-7F93-11D5-83F300508B94F85Amethod=Full

If you want to do it via soxml here is a real simple custom tag sample 
that I did that just returns the country information that usps passes 
back Expanding upon this to do full rates would be pretty easy, but 
that's what the above tag goes anyway

CFPARAM NAME=attributesuserid
CFPARAM NAME=attributespassword
CFPARAM NAME=attributesserver

CFSCRIPT
services = 'PACKAGE';
APIstr = 'IntlRate';
XMLstr = 'IntlRateRequest USERID=#attributesuserid# 
PASSWORD=#attributespassword#';

XMLstr = XMLstr  'Package ID=1
Pounds0/Pounds
Ounces1/Ounces
MailTypePackage/MailType
Country#Attributescountry#/Country
/Package';
XMLstr = XMLstr  '/IntlRateRequest';
/CFSCRIPT


CFHTTP 
URL=#attributesserver#?API=#APIstr#XML=#urlencodedformat(XMLstr)# 
method=GET resolveurl=false timeout=45
CFSET XMLResp = CFHTTPFileContent

cf_SOXML
   action=XML2CF
   input=#xmlResp#
   output=countryData
   type=Variables
 
cfset callercountryData = countryDataintlRateResponsepackage


jon

ps For anyone who cares, FEDEX is finally planning on releasing an XML 
API withing the next two months It's already been delayed once from Q4 
2001 though, so I'm not getting my hopes up though

Andres wrote:
 This a rather long email 
 
 i am trying to query the USPS international rate calculator via their 
 API Their response is an XML document which i am parsing via SOXML 
 This is a great tool!
 
snip
 
 CF throws an error saying that it cannot resolve the parameter 
 outhereIntlRateResponseService Even though this does exist and indeed 
 is to be an array since there are two of them
 
 Any help would be much appreciated!
 
 Thank you
 


__
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://wwwpennyhostcom/redirectcfm?adcode=coldfusiona
FAQ: http://wwwthenetprofitscouk/coldfusion/faq
Archives: http://wwwmail-archivecom/cf-talk@houseoffusioncom/
Unsubscribe: http://wwwhouseoffusioncom/indexcfm?sidebar=lists



RE: XML question

2002-02-28 Thread Andres

Jon,
Thank you for your help on this.
 
Do you know if msxml will somehow affect CF's wddx implementation? i dont know if the 
two relate to each other... but i am using wddx to export some data to other systems, 
and dont want to interfere with those elements.
 
Thanks!
 
Andres

-Original Message- 
From: Jon Hall [mailto:[EMAIL PROTECTED]] 
Sent: Thu 2/28/2002 8:45 PM 
To: CF-Talk 
Cc: 
Subject: Re: XML question



I'd bet that it's same the problem I ran into when using MSXML via
cfobject to grab the UPS XML, which is essentially what soxml does.
CFObject apparently doesn't understand the nulls that MSXML passes back
when an XML element is empty, and bombs. If you are running an older
version of msxml you may want to upgrade it as 4.0 is out, that may fix
some problems, as 4.0 is the first solid release imo.

Have you tried the cf_usps tag? It handles pretty much everything for you.

http://devex.macromedia.com/developer/gallery/info.cfm?ID=9C9C2AB9-7F93-11D5-83F300508B94F85Amethod=Full

If you want to do it via soxml here is a real simple custom tag sample
that I did that just returns the country information that usps passes
back. Expanding upon this to do full rates would be pretty easy, but
that's what the above tag goes anyway...

CFPARAM NAME=attributes.userid
CFPARAM NAME=attributes.password
CFPARAM NAME=attributes.server

CFSCRIPT
services = 'PACKAGE';
APIstr = 'IntlRate';
XMLstr = 'IntlRateRequest USERID=#attributes.userid#
PASSWORD=#attributes.password#';
   
XMLstr = XMLstr  'Package ID=1
Pounds0/Pounds
Ounces1/Ounces
MailTypePackage/MailType
Country#Attributes.country#/Country
/Package';
XMLstr = XMLstr  '/IntlRateRequest';
/CFSCRIPT


CFHTTP
URL=#attributes.server#?API=#APIstr#XML=#urlencodedformat(XMLstr)#
method=GET resolveurl=false timeout=45
CFSET XMLResp = CFHTTP.FileContent

cf_SOXML
   action=XML2CF
   input=#xmlResp#
   output=countryData
   type=Variables
 
cfset caller.countryData = countryData.intlRateResponse.package


jon

ps For anyone who cares, FEDEX is finally planning on releasing an XML
API withing the next two months. It's already been delayed once from Q4
2001 though, so I'm not getting my hopes up though.

Andres wrote:
 This a rather long email...

 i am trying to query the USPS international rate calculator via their
 API. Their response is an XML document which i am parsing via SOXML.
 This is a great tool!

snip

 CF throws an error saying that it cannot resolve the parameter
 outhere.IntlRateResponse.Service. Even though this does exist and indeed
 is to be an array since there are two of them.

 Any help would be much appreciated!

 Thank you




__
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: XML question

2002-02-28 Thread Rey Bango

Andres,

Microsoft's XMLDOM component won't interfere w/ WDDX. The XMLDOM component
is a COM object which needs to be invoked using the CFOBJECT tag. The WDDX
functionality is built into CF and there are defined tags for using it.

HTH.

Rey...

- Original Message -
From: Andres [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Thursday, February 28, 2002 11:34 PM
Subject: RE: XML question


 Jon,
 Thank you for your help on this.

 Do you know if msxml will somehow affect CF's wddx implementation? i dont
know if the two relate to each other... but i am using wddx to export some
data to other systems, and dont want to interfere with those elements.

 Thanks!

 Andres

 -Original Message-
 From: Jon Hall [mailto:[EMAIL PROTECTED]]
 Sent: Thu 2/28/2002 8:45 PM
 To: CF-Talk
 Cc:
 Subject: Re: XML question



 I'd bet that it's same the problem I ran into when using MSXML via
 cfobject to grab the UPS XML, which is essentially what soxml does.
 CFObject apparently doesn't understand the nulls that MSXML passes back
 when an XML element is empty, and bombs. If you are running an older
 version of msxml you may want to upgrade it as 4.0 is out, that may fix
 some problems, as 4.0 is the first solid release imo.

 Have you tried the cf_usps tag? It handles pretty much everything for you.

http://devex.macromedia.com/developer/gallery/info.cfm?ID=9C9C2AB9-7F93-11D5
-83F300508B94F85Amethod=Full

 If you want to do it via soxml here is a real simple custom tag sample
 that I did that just returns the country information that usps passes
 back. Expanding upon this to do full rates would be pretty easy, but
 that's what the above tag goes anyway...

 CFPARAM NAME=attributes.userid
 CFPARAM NAME=attributes.password
 CFPARAM NAME=attributes.server

 CFSCRIPT
 services = 'PACKAGE';
 APIstr = 'IntlRate';
 XMLstr = 'IntlRateRequest USERID=#attributes.userid#
 PASSWORD=#attributes.password#';

 XMLstr = XMLstr  'Package ID=1
 Pounds0/Pounds
 Ounces1/Ounces
 MailTypePackage/MailType
 Country#Attributes.country#/Country
 /Package';
 XMLstr = XMLstr  '/IntlRateRequest';
 /CFSCRIPT


 CFHTTP
 URL=#attributes.server#?API=#APIstr#XML=#urlencodedformat(XMLstr)#
 method=GET resolveurl=false timeout=45
 CFSET XMLResp = CFHTTP.FileContent

 cf_SOXML
action=XML2CF
input=#xmlResp#
output=countryData
type=Variables
 
 cfset caller.countryData = countryData.intlRateResponse.package


 jon

 ps For anyone who cares, FEDEX is finally planning on releasing an XML
 API withing the next two months. It's already been delayed once from Q4
 2001 though, so I'm not getting my hopes up though.

 Andres wrote:
  This a rather long email...
 
  i am trying to query the USPS international rate calculator via their
  API. Their response is an XML document which i am parsing via SOXML.
  This is a great tool!
 
 snip
 
  CF throws an error saying that it cannot resolve the parameter
  outhere.IntlRateResponse.Service. Even though this does exist and indeed
  is to be an array since there are two of them.
 
  Any help would be much appreciated!
 
  Thank you
 



 
__
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: XML Question

2000-05-30 Thread Brian Kohnen

How would you handle the XML tag attributes using XSL?

ie: money currency="USD"12.2/money

I FINALLY got allaire's example to work (thanks David), but I don't even 
know where to start when it comes to the attributes. Any suggestions?

(If it helps, I'm trying to convert cXML to WDDX)

Thanks in advance,
Brian Kohnen

At 01:21 AM 5/24/00 -0700, you wrote:
Thanks David, I will give it a go.  You the man.
- Original Message -
From: "David Gassner" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 23, 2000 9:30 PM
Subject: RE: XML Question


  Sean, I got Allaire's example working.  I found these problems based on
the
  version I copied from the Allaire website:
 
  1.  If you copy the example XSL file from the website, the
xsl:stylesheet
  tag's xmlns:xsl attribute value is broken into 2 lines, causing the xsl
  processor to fail completely.  Instead of doing the transformation, it was
  just outputting the content of the original xsl file.  The namespace needs
  to be in a continuous line, as follows:
 
  xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
  2.  The printWriter class wasn't being closed, so the file containing the
  wddx was never being flushed to disk.  I added the following to the end of
  the code:
 
  cfset printWriter.close()
 
  3.  The resulting processed file wasn't being read into a CF variable, so
I
  added:
 
  cffile action="read"
 file="[path]wddx_test.wddx"
 variable="wddx"
 
  4.  Next, when I tried to run cfwddx to transform the wddx to a
structure,
  I got:
 
  Error Diagnostic Information
  unknown exception condition
  TagCFWddx::execute
 
  There was an error in the XSL file: the "item" element was being mapped to
a
  named structure; since it was a structure within an array, it couldn't
take
  a name, causing the WDDX parser to fail.  I corrected the XSL file, and
  everything now works.  Here's my corrected XSL file:
 
  
  xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
  !-- Match invoice root  emit WDDX packet wrapper --
  xsl:template match="/invoice"
  wddxPacket version="1.0"
  header/
  data
  struct
  xsl:apply-templates/
  /struct
  /data
  /wddxPacket
  /xsl:template
 
 
  !-- Process all elements that map to array variables --
  xsl:template match="billableHours"
  var name="{name(.)}"
  array length="{count(*)}"
  xsl:apply-templates/
  /array
  /var
  /xsl:template
 
  !-- Process all elements that map to struct variables --
  xsl:template match="invoice|contractorInfo|address"
  var name="{name(.)}"
  struct
  xsl:apply-templates/
  /struct
  /var
  /xsl:template
 
 
  !-- Process structures inside arrays (no names) --
  xsl:template match="item"
  struct
  xsl:apply-templates/
  /struct
  /xsl:template
 
  !-- Process all elements that map to string variables --
  xsl:template
  match="firstName|lastName|street|city|state|zip|country|voice|fax|email|
  description|currency"
  var name="{name(.)}"
  string
  xsl:value-of select="text()"/
  /string
  /var
  /xsl:template
 
  !-- Process all elements that map to number variables --
  xsl:template match="invoiceID|employeeID|hours|amount"
  var name="{name(.)}"
  number
  xsl:value-of select="text()"/
  /number
  /var
  /xsl:template
 
  !-- Process all elements that map to date-time variables --
  xsl:template match="dateSubmitted|date"
  var name="{name(.)}"
  string
  xsl:value-of select="text()"/
  /string
  /var
  /xsl:template
 
  /xsl:stylesheet
 
  
 
  I'll pass this info to the folks at Allaire.
  --David
 
   -Original Message-
   From: Sean Renet [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 23, 2000 5:53 PM
   To: [EMAIL PROTECTED]
   Subject: Re: XML Question
  
  
   yes, you would think someone would have tested the knowledge base
article.
   I though it necessary to point this out as you directed someone that
asked
   how to parse an XML file into CFML to your article which
   references this doc
   as the means to do such.
   - Original Message -
   From: "David Gassner" [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Tuesday, May 23, 2000 11:27 AM
   Subject: RE: XML Question
  
  
Interesting; I never actually tested Allaire's approach, but
   included the
reference in my article for the sake of completeness.  My
   article focuses
   on
parsing xml file's documen

RE: XML Question

2000-05-30 Thread Shawn Regan

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--_=_NextPart_001_01BFCA95.BF5DC120
Content-Type: text/plain;
charset="iso-8859-1"

do a search at microsfot.com for beginning XSL. they have a pretty simple
example on how to use XSL.

Shawn Regan

--_=_NextPart_001_01BFCA95.BF5DC120
Content-Type: text/html;
charset="iso-8859-1"

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"
HTML
HEAD
META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"
META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2650.12"
TITLERE: XML Question/TITLE
/HEAD
BODY

PFONT SIZE=2do a search at microsfot.com for beginning XSL. they have a pretty 
simple example on how to use XSL./FONT
/P

PFONT SIZE=2Shawn Regan/FONT
/P

/BODY
/HTML
--_=_NextPart_001_01BFCA95.BF5DC120--
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: XML Question

2000-05-24 Thread Sean Renet

Thanks David, I will give it a go.  You the man.
- Original Message -
From: "David Gassner" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 23, 2000 9:30 PM
Subject: RE: XML Question


 Sean, I got Allaire's example working.  I found these problems based on
the
 version I copied from the Allaire website:

 1.  If you copy the example XSL file from the website, the
xsl:stylesheet
 tag's xmlns:xsl attribute value is broken into 2 lines, causing the xsl
 processor to fail completely.  Instead of doing the transformation, it was
 just outputting the content of the original xsl file.  The namespace needs
 to be in a continuous line, as follows:

 xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

 2.  The printWriter class wasn't being closed, so the file containing the
 wddx was never being flushed to disk.  I added the following to the end of
 the code:

 cfset printWriter.close()

 3.  The resulting processed file wasn't being read into a CF variable, so
I
 added:

 cffile action="read"
file="[path]wddx_test.wddx"
variable="wddx"

 4.  Next, when I tried to run cfwddx to transform the wddx to a
structure,
 I got:

 Error Diagnostic Information
 unknown exception condition
 TagCFWddx::execute

 There was an error in the XSL file: the "item" element was being mapped to
a
 named structure; since it was a structure within an array, it couldn't
take
 a name, causing the WDDX parser to fail.  I corrected the XSL file, and
 everything now works.  Here's my corrected XSL file:

 
 xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

 !-- Match invoice root  emit WDDX packet wrapper --
 xsl:template match="/invoice"
 wddxPacket version="1.0"
 header/
 data
 struct
 xsl:apply-templates/
 /struct
 /data
 /wddxPacket
 /xsl:template


 !-- Process all elements that map to array variables --
 xsl:template match="billableHours"
 var name="{name(.)}"
 array length="{count(*)}"
 xsl:apply-templates/
 /array
 /var
 /xsl:template

 !-- Process all elements that map to struct variables --
 xsl:template match="invoice|contractorInfo|address"
 var name="{name(.)}"
 struct
 xsl:apply-templates/
 /struct
 /var
 /xsl:template


 !-- Process structures inside arrays (no names) --
 xsl:template match="item"
 struct
 xsl:apply-templates/
 /struct
 /xsl:template

 !-- Process all elements that map to string variables --
 xsl:template
 match="firstName|lastName|street|city|state|zip|country|voice|fax|email|
 description|currency"
 var name="{name(.)}"
 string
 xsl:value-of select="text()"/
 /string
 /var
 /xsl:template

 !-- Process all elements that map to number variables --
 xsl:template match="invoiceID|employeeID|hours|amount"
 var name="{name(.)}"
 number
 xsl:value-of select="text()"/
 /number
 /var
 /xsl:template

 !-- Process all elements that map to date-time variables --
 xsl:template match="dateSubmitted|date"
 var name="{name(.)}"
 string
 xsl:value-of select="text()"/
 /string
 /var
 /xsl:template

 /xsl:stylesheet

 

 I'll pass this info to the folks at Allaire.
 --David

  -Original Message-
  From: Sean Renet [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 23, 2000 5:53 PM
  To: [EMAIL PROTECTED]
  Subject: Re: XML Question
 
 
  yes, you would think someone would have tested the knowledge base
article.
  I though it necessary to point this out as you directed someone that
asked
  how to parse an XML file into CFML to your article which
  references this doc
  as the means to do such.
  - Original Message -
  From: "David Gassner" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, May 23, 2000 11:27 AM
  Subject: RE: XML Question
 
 
   Interesting; I never actually tested Allaire's approach, but
  included the
   reference in my article for the sake of completeness.  My
  article focuses
  on
   parsing xml file's document object model, rather than
  translation with xls
   (which the knowledgebase article deals with).
  
   Side note: I've been playing with IBM's java-based xerces processor
from
   cfobject and have been having some good results.
  
   David
  
-Original Message-
From: Sean Renet [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 23, 2000 11:09 AM
To: [EMAIL PROTECTED]
Subject: Re: XML Question
   
   
David,
The "Tech Note" you are refering to "
www.all

Re: XML Question

2000-05-23 Thread Sean Renet

David,
The "Tech Note" you are refering to "
www.allaire.com/handlers/index.cfm?ID=14244Method=Full#1020244 "  does not
work.  I have an open incident with Allaire, wherein they are trying to
figure out why.  Evidently after they fix the problem they are going to
update the knowledge base article.
- Original Message -
From: "David Gassner" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 23, 2000 7:29 AM
Subject: RE: XML Question


 Bob, I wrote an article on using the MS XMLDOM COM object with CF to parse
 conventional XML files; it's at:

 http://www.sys-con.com/xml/archives/0102/gassner/index.html

 Take a look and email me off-list if you need any clarification.

 David

  -Original Message-
  From: Robert Everland III [mailto:[EMAIL PROTECTED]]
  Sent: Monday, May 22, 2000 7:22 PM
  To: [EMAIL PROTECTED]
  Subject: XML Question
 
 
  Ok I get the gist on how to use WDDX, but how would I read in an XML
  document? Same prinipal, 3rd party utility?
 
 
  Bob Everland
 
  --
  
  Archives: http://www.eGroups.com/list/cf-talk
  To Unsubscribe visit
  http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf
 _talk or send a message to [EMAIL PROTECTED] with
 'unsubscribe' in the body.

 --

 Archives: http://www.eGroups.com/list/cf-talk
 To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: XML Question

2000-05-23 Thread Steve Reich

Check out http://www.xmltree.com. James Carlyle has set up an excellent
resource for XML content. If you search the discussion forums you will find
a lot of great information on handling XML with CF.

HTH,
Steve

-Original Message-
From: Robert Everland III [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 22, 2000 10:22 PM
To: [EMAIL PROTECTED]
Subject: XML Question


Ok I get the gist on how to use WDDX, but how would I read in an XML
document? Same prinipal, 3rd party utility?


Bob Everland


--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: XML Question

2000-05-23 Thread Sean Renet

yes, you would think someone would have tested the knowledge base article.
I though it necessary to point this out as you directed someone that asked
how to parse an XML file into CFML to your article which references this doc
as the means to do such.
- Original Message -
From: "David Gassner" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 23, 2000 11:27 AM
Subject: RE: XML Question


 Interesting; I never actually tested Allaire's approach, but included the
 reference in my article for the sake of completeness.  My article focuses
on
 parsing xml file's document object model, rather than translation with xls
 (which the knowledgebase article deals with).

 Side note: I've been playing with IBM's java-based xerces processor from
 cfobject and have been having some good results.

 David

  -Original Message-
  From: Sean Renet [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 23, 2000 11:09 AM
  To: [EMAIL PROTECTED]
  Subject: Re: XML Question
 
 
  David,
  The "Tech Note" you are refering to "
  www.allaire.com/handlers/index.cfm?ID=14244Method=Full#1020244 "
   does not
  work.  I have an open incident with Allaire, wherein they are trying to
  figure out why.  Evidently after they fix the problem they are going to
  update the knowledge base article.
  - Original Message -
  From: "David Gassner" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, May 23, 2000 7:29 AM
  Subject: RE: XML Question
 
 
   Bob, I wrote an article on using the MS XMLDOM COM object with
  CF to parse
   conventional XML files; it's at:
  
   http://www.sys-con.com/xml/archives/0102/gassner/index.html
  
   Take a look and email me off-list if you need any clarification.
  
   David
  
-Original Message-
From: Robert Everland III [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 22, 2000 7:22 PM
    To: [EMAIL PROTECTED]
Subject: XML Question
   
   
Ok I get the gist on how to use WDDX, but how would I read in an XML
document? Same prinipal, 3rd party utility?
   
   
Bob Everland
   
--

Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf
   _talk or send a message to [EMAIL PROTECTED] with
   'unsubscribe' in the body.
  
  

 --
  
   Archives: http://www.eGroups.com/list/cf-talk
   To Unsubscribe visit
  http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
or
  send a message to [EMAIL PROTECTED] with 'unsubscribe'
in
  the body.
  
 
  --
  
  Archives: http://www.eGroups.com/list/cf-talk
  To Unsubscribe visit
 http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
 send a message to [EMAIL PROTECTED] with 'unsubscribe' in
 the body.

 --

 Archives: http://www.eGroups.com/list/cf-talk
 To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: XML Question

2000-05-23 Thread David Gassner

Sean, I got Allaire's example working.  I found these problems based on the
version I copied from the Allaire website:

1.  If you copy the example XSL file from the website, the xsl:stylesheet
tag's xmlns:xsl attribute value is broken into 2 lines, causing the xsl
processor to fail completely.  Instead of doing the transformation, it was
just outputting the content of the original xsl file.  The namespace needs
to be in a continuous line, as follows:

xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

2.  The printWriter class wasn't being closed, so the file containing the
wddx was never being flushed to disk.  I added the following to the end of
the code:

cfset printWriter.close()

3.  The resulting processed file wasn't being read into a CF variable, so I
added:

cffile action="read"
   file="[path]wddx_test.wddx"
   variable="wddx"

4.  Next, when I tried to run cfwddx to transform the wddx to a structure,
I got:

Error Diagnostic Information
unknown exception condition
TagCFWddx::execute

There was an error in the XSL file: the "item" element was being mapped to a
named structure; since it was a structure within an array, it couldn't take
a name, causing the WDDX parser to fail.  I corrected the XSL file, and
everything now works.  Here's my corrected XSL file:


xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

!-- Match invoice root  emit WDDX packet wrapper --
xsl:template match="/invoice"
wddxPacket version="1.0"
header/
data
struct
xsl:apply-templates/
/struct
/data
/wddxPacket
/xsl:template


!-- Process all elements that map to array variables --
xsl:template match="billableHours"
var name="{name(.)}"
array length="{count(*)}"
xsl:apply-templates/
/array
/var
/xsl:template

!-- Process all elements that map to struct variables --
xsl:template match="invoice|contractorInfo|address"
var name="{name(.)}"
struct
xsl:apply-templates/
/struct
/var
/xsl:template


!-- Process structures inside arrays (no names) --
xsl:template match="item"
struct
xsl:apply-templates/
/struct
/xsl:template

!-- Process all elements that map to string variables --
xsl:template
match="firstName|lastName|street|city|state|zip|country|voice|fax|email|
description|currency"
var name="{name(.)}"
string
xsl:value-of select="text()"/
/string
/var
/xsl:template

!-- Process all elements that map to number variables --
xsl:template match="invoiceID|employeeID|hours|amount"
var name="{name(.)}"
number
xsl:value-of select="text()"/
/number
/var
/xsl:template

!-- Process all elements that map to date-time variables --
xsl:template match="dateSubmitted|date"
var name="{name(.)}"
string
xsl:value-of select="text()"/
/string
/var
/xsl:template

/xsl:stylesheet



I'll pass this info to the folks at Allaire.
--David

 -Original Message-
 From: Sean Renet [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 23, 2000 5:53 PM
 To: [EMAIL PROTECTED]
 Subject: Re: XML Question


 yes, you would think someone would have tested the knowledge base article.
 I though it necessary to point this out as you directed someone that asked
 how to parse an XML file into CFML to your article which
 references this doc
 as the means to do such.
 - Original Message -
 From: "David Gassner" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, May 23, 2000 11:27 AM
 Subject: RE: XML Question


  Interesting; I never actually tested Allaire's approach, but
 included the
  reference in my article for the sake of completeness.  My
 article focuses
 on
  parsing xml file's document object model, rather than
 translation with xls
  (which the knowledgebase article deals with).
 
  Side note: I've been playing with IBM's java-based xerces processor from
  cfobject and have been having some good results.
 
  David
 
   -Original Message-
   From: Sean Renet [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 23, 2000 11:09 AM
   To: [EMAIL PROTECTED]
   Subject: Re: XML Question
  
  
   David,
   The "Tech Note" you are refering to "
   www.allaire.com/handlers/index.cfm?ID=14244Method=Full#1020244 "
does not
   work.  I have an open incident with Allaire, wherein they are
 trying to
   figure out why.  Evidently after they fix the problem they
 are going to
   update the knowledge base article.
   - Original Message -
   

XML Question

2000-05-22 Thread Robert Everland III

Ok I get the gist on how to use WDDX, but how would I read in an XML
document? Same prinipal, 3rd party utility?


Bob Everland

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: XML Question

2000-05-22 Thread Jeff Polaski

If you're on NT you could use a com object, or use some of the other freely
available tools. MS has a set of com-based xml tools. Depending on your app,
you might be able to write it  in JavaScript.



-Original Message-
From: Robert Everland III [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 22, 2000 7:22 PM
To: [EMAIL PROTECTED]
Subject: XML Question


Ok I get the gist on how to use WDDX, but how would I read in an XML
document? Same prinipal, 3rd party utility?


Bob Everland


--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.