The DOM is not XML or HTML. It is just a binary representation in _javascript_ of the structure of the document. I dont know what you mean by "add them manually". The quotes are a textual element and would confuse the value of the attribute if you manually add them to the value you are sending to setAttribute. The quotes will only polute the value. That is to say that once a browser has parsed the HTML into DOM elements, there are no quotes any more. They are only there as delimiters in the textual representation of the document structure (be it HTML or XML).
Doing something like:
someObject.setAttribute("width",'"'+aValue+'"');
Will mean that the actual value of the attribute will have quotes around it. If aValue was 25 then width would not contain 25 it would contain "25" and this would not be able to be interpreted as a number (nor as one of the valid string representations that width accepts).
Having said all that.....
To get anything from the DOM into text (i.e. either HTML or XML) you must be using some mechanism (for example the "toString" method - or possibly a freeware generator) against a DOM object. Or you may be trying to build your own (in which case you still dont need to add quotes when calling setAttribute - you would do it in your HTML/XML generator as it traverses the DOM). It may well be that whatever mechanism you are using in _javascript_ to get the textual representation (HTML or XML) of the DOM structure is what is at fault.
I am assuming that you are creating some DOM structure programmatically from within _javascript_, are then having that translated into XML or HTML, and are sending that back to the CF server via either a FORM or URL of some kind (possibly via the XMLHttp object), and it is this text you are trying to encapsulate and parse as XML on the CF side.
If you don't actually need XML as the transport mechanism between the _javascript_ client and the server, I would suggest you consider using JSON (_javascript_ Object Notation) instead of XML as it is easier to parse and generate. We have found that it is quicker on the _javascript_ side because you don't actually need a parser (you can just "exec" it straight into the variable stack).
Gary
On 12/29/05, Taco Fleur - Pacific Fox <[EMAIL PROTECTED]> wrote:
First, thanks for the reply.Secondly, <cfxml> is a tag used to accept inline XML inside Coldfusion. If you are using the ## mechanism to take some variable and have it rendered as XML inside the <cfxml> tag then you probably need to use the preserveSingleQuotes method to ensure that single quotes created in another XML string representation are faithfully maintained in Coldfusion.It's not XML yet at this stage, it is HTML. I do believe _javascript_ is adding the double quotes around the value once I add them manually, so preserveSingleQuotes won't do the trick.Working with DOM is exactly what I am doing, so you reckon its normal it doesn't generate quotes around the value simply because it is not XML, ok.I am parsing the HTML now anyway to get at the values I need in CF, I just thought it would be easy to convert the document to XML so I could easily address the attributes in CF without the need for parsing etc..Kind regards,Taco Fleur - Chief Executive Officer
Pacific Fox http://www.pacificfox.com.au an industry leader with commercial IT experience since 1994 …
Web Design and Development SMS Solutions, including developer API Domain Registration, .COM for as low as fifteen dollars a year, .COM.AU for fifty dollars two years! BlackBerry® Business Solutions www.OzBlackBerry.com We endorse PayPal, accept payments online now! Seamless Merchant integration
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Gary Menzel
Sent: Thursday, 29 December 2005 5:50 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: _javascript_ setAttribute function generates attributes without quotes
b‹šç.®·§¶\¬¹»®&ÞvÚ}«¬²'š²Öœ¡ù^ººZr'âqú1r‰"¢éì¹»®&Þ±éÝi¹ZžG¦j)m¢Wš½çjë,‰íµßΖ+-±Öžš‰Ü¢f®ë,‰ãrº&yØš ëÞ–Š^®Èm¶Ÿÿ–+-±Öžš‰Ü¢f®Firstly, the _javascript_ setAttribute doesn't set quotes because it doesn't generate XML. It simply creates the attribute as part of the elements DOM structure. If you aren't getting quotes when you generate XML it will be related to the method that is generating the XML (not the setAttribute method).Secondly, <cfxml> is a tag used to accept inline XML inside Coldfusion. If you are using the ## mechanism to take some variable and have it rendered as XML inside the <cfxml> tag then you probably need to use the preserveSingleQuotes method to ensure that single quotes created in another XML string representation are faithfully maintained in Coldfusion.
On 12/23/05, Taco Fleur - Pacific Fox <[EMAIL PROTECTED] > wrote:The _javascript_ setAttribute function generates attributes without quotes, I am using <cfxml> to turn the document constructed in _javascript_ into an XML doc, obviously without the attributes properly quoted it errors. Anyone any idea how to get _javascript_ to create the attributes with quotes?Kind regards,Taco Fleur - Chief Executive Officer
Pacific Fox http://www.pacificfox.com.au an industry leader with commercial IT experience since 1994 …
Web Design and Development SMS Solutions, including developer API Domain Registration, .COM for as low as fifteen dollars a year, .COM.AU for fifty dollars two years! BlackBerry® Business Solutions www.OzBlackBerry.com We endorse PayPal, accept payments online now! Seamless Merchant integration---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
