
Some parts of this message have been removed.
Learn more about Nabble's
security policy.
> 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.
This is correct. And am only trying to transform it to XML
in CF so I can parse it easily, at the moment I am doing it with RegEx. I would
assume JSON would allow me to do cool stuff in JavaScript but not get at the
values I need within CF.
>
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).
This
is incorrect, it actually escapes the quotes, if it really did generate "25"
then I would be happy.
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!
-
-
We endorse PayPal, accept
payments online now!
-
Seamless Merchant
integration
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 <taco.fleur@...>
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!
-
-
We endorse PayPal, accept payments online now!
-
Seamless Merchant
integration
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 <taco.fleur@...> 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!
-
-
We endorse PayPal, accept payments online now!
-
Seamless Merchant
integration
---
You are currently subscribed to cfaussie as: gmenzel@...
To unsubscribe send a blank email
to leave-cfaussie-23165F@... Aussie
Macromedia Developers: http://lists.daemon.com.au/
b‹šç.®·§¶\¬¹»®&ÞvÚ}«¬²'š²Öœ¡ù^ººZr'âqú1r‰"¢éì¹»®&Þ±éÝi¹ZžG¦j)m¢Wš½çjë,‰íµßΖ+-±Öžš‰Ü¢f®ë,‰ãrº&yØš
ëÞ–Š^®Èm¶Ÿÿ–+-±Öžš‰Ü¢f®
b?????v}????rqr????i?j??j?ߖ???묉㚲?&yؚ
랖?^?ȭ????֞??ܢf?
---
You are currently subscribed to cfaussie as:
lists@...
To unsubscribe send a blank email to
leave-cfaussie-23165F@...
Aussie Macromedia Developers: http://lists.daemon.com.au/