Sorry, mixing my examples up here...

xmlRoot.xmlElement.xmlName=find_business
xmlRoot.xmlElement.xmlChildren would then contain a collection of
struct containers that hold your "name" children.

Every element has a collection of attributes above and beyond the
obvious ones in your document. xmlRoot, xmlAttributes, xmlName,
xmlNSPrefix, xmlURI, etc. and if you're going to build a struct by
hand to mirror an XML document... eh, dude... I think you're going to
have some trouble.

Why not create the string as a variable... just stick the text into a
var... then pass it into xmlParse and use that? It's going to be way
easier and much less frustrating than trying to cobble together a
mock-XML document.

Just my opine...

Laterz!
J

On Thu, 10 Feb 2005 11:51:01 -0600, Jared Rypka-Hauer - CMG, LLC
<[EMAIL PROTECTED]> wrote:
> XML isn't just a straigh-up struct... if you're going to reproduce an
> expected XML snippet into a well-formed XML document by hand, you need
> to recreate the whole thing or it just... won't work.
> 
> Check out this example...
> http://w2ksrv1.neo.servequake.com/tmp/xmlexample.cfm
> 
> If you click the title of the cfdump, it will rotate between simle,
> extended, and collapsed views... check out the extend version of the
> view in the bottom-left table cell.
> 
> xmlRoot.xmlElement.xmlName=find_business
> xmlRoot.xmlElement.xmlChildren contains a collection of structs that
> represent url objects.
> 
> XML isn't just a struct, or an array... if you're talking XML and it
> needs to be validated, you're going to have to either be very VERY
> careful about how you create your structured object OR you should just
> write it out to a file, read it in via cffile, and xmlParse() it into
> a native XML binary object.
> 
> Just remember, though... xmlSearch and xmlTransform both have rules,
> and those rules follow XML standards, and the format of the document
> IN MEMORY is critical or they just won't work.
> 
> Laterz,
> J
> 
> 
> On Thu, 10 Feb 2005 11:26:07 -0500, Doug James <[EMAIL PROTECTED]> wrote:
> > Thanks for the suggestion.
> >
> > Unfortunately, it did not work. This is for a web service and 
> > <find_business> is a complex type
> > which equates to a struct.
> >
> > Calling all web service experts: please offer suggestions.
> >
> > Doug
> >
> > Micha Schopman wrote:
> > > If you see name as a childNode, you might do this
> > >
> > > <cfset find_business = structNew()>
> > > <cfset find.business.attributes = arrayNew(1)>
> > > <cfset find.business.childs = arrayNew(1)>
> > >
> > > And then each array entry gets a new struct :) With the key as structkey
> > > and value as strucktvalue.
> > >
> > > Micha Schopman
> > > Software Engineer
> > >
> > > Modern Media, Databankweg 12 M, 3821 AL  Amersfoort
> > > Tel 033-4535377, Fax 033-4535388
> > > KvK Amersfoort 39081679, Rabo 39.48.05.380
> > >
> > > ------------------------------------------------------------------------
> > > ------------------------------------------------------------------------
> > > -----
> > > Modern Media, Making You Interact Smarter. Onze oplossingen verbeteren
> > > de interactie met uw doelgroep.
> > > Wilt u meer omzet, lagere kosten of een beter service niveau? Voor meer
> > > informatie zie www.modernmedia.nl
> > > ------------------------------------------------------------------------
> > > ------------------------------------------------------------------------
> > > -----
> > >
> > > -----Original Message-----
> > > From: Doug James [mailto:[EMAIL PROTECTED]
> > > Sent: donderdag 10 februari 2005 14:55
> > > To: CF-Talk
> > > Subject: xml to struct help
> > >
> > > Please help, my forehead is very red and painful from banging against
> > > the wall over this one.
> > >
> > > Given this XML snippet:
> > > <find_business generic="2.0" maxRows="10">
> > >       <name>ABC Co.</name>
> > > </find_business>
> > >
> > > This struct accurately represents <find_business> with the "generic" and
> > > "maxRows" attributes.
> > > find_business = structNew();
> > > find_business.generic = "2.0";
> > > find_business.maxRows = "10";
> > >
> > > What I can't figure out is how to get <name> into the structure. If I do
> > > find_business.name = "ABC
> > > Co."; that is making the name an attribute but I need it as an element.
> > >
> > > Any suggestions?
> > >
> > > Doug James
> > > Hollings Cancer Center
> > >
> > >
> > >
> > >
> >
> > 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:194098
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

Reply via email to