OK, Issac, that makes a little more sense.  I'm going to re-read the 
whole thing again right now, but if you have that example you were 
referring to, I'd love to see it.  Seeing other's examples in 
conjunction with the info you just gave should clear this all up.  You 
can send it offline to my CrystalVision account.

Thanks for the explanation.

S. Isaac Dealey wrote:
>> Any ideas on how to properly do this?  I'm an XML noob, so
>> I'm sure there is a function or two I'm missing here.
> 
> Couple of pointers:
> 
> 1) When creating XML nodes with XmlElemNew, it's unnecessary to use
> XMLFormat() to format either text nodes appended to the node array or
> to attributes added to the XmlAttributes collection. So if you're
> using functions to build your doc and using XMLFormat() to format your
> nodes: stop. :)
> 
> 2) With prior versions of CF (6.0 and possibly 6.1) the XML engine by
> default didn't understand the ' entity (which is used in
> XmlFormat() to replace apostrophes). Although for the majority of XML
> packets, the ' entity is unnecessary (because the doc uses
> double-quotes for its attributes). Thus with these versions of CF,
> using XmlFormat() on a value with an apostrophe in it can actually
> _create_ an error that wouldn't otherwise occur. You can get around
> this by either adding the entity to the XML doc or by wrapping
> XmlFormat() with another function to replace the ' entities with
> '  (oddly enough, I had a similar problem with JSStringFormat()
> being broken -- although I believe they've fixed the XmlFormat() issue
> with CF7).
> 
> 3) When a string goes into an XML doc as an attribute or a text node,
> it comes out exactly the way it went in. So if you add
> 
> she said "this"
> 
> it will come out as
> 
> she said "this"
> 
> or if you add
> 
> she said "this"
> 
> it will come out as
> 
> she said "this"
> 
> -- I know, seems obvious -- but the nuance may be what's troubling
> you. Because you don't need to use XmlFormat() when building elements
> with XmlElemNew(), if you then add a text node with XmlFormat() it
> will go in with the extra & and ; characters, so when the XML packet
> is serialized (to a string) it will become
> 
> <p>some stuff</p>
> 
> which will then come back out of the packet as:
> 
> <p>some stuff</p>
> 
> instead of coming out as
> 
> <p>some stuff</p>
> 
> So it may be that just removing XmlFormat() will solve your issue.
> 
> On the flip side, I generally find it easier to creat XML packets
> either with cfxml or cfsavecontent (which is more efficient if you're
> creating a packet for someone else because there's less overhead to
> create the string because CF doesn't automatically parse the XML). If
> you decide to use either of these, then you do need to use XmlFormat()
> when ouputting variables within your cfsavecontent or cfxml tags.
> 
> What's really funny is I had this same conversation with Matt Woodward
> (one of the other Team Macromedia / Adobe Community Experts members
> who's speaking at cf.Objective this weekend) a couple years ago when I
> was still in Dallas. The funny part (more so than the fact that I was
> surprised that he was having any trouble figuring it out) is that iirc
> this was just _after_ he'd written an article about using XSL for the
> ColdFusion Developer's Journal. :P
> 
> p.s. I've got some code for generating an RSS feed that uses
> XmlFormat() to allow html content in the rss body which might help
> illustrate this nuance if you're interested. I think the standard for
> RSS basically specifies what you're trying to accomplish with regard
> to embedding html content.
> 
> 
> s. isaac dealey     434.293.6201
> 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
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234690
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

Reply via email to