For Programmers: Free Programming Magazines  


Home > Archive > Tcl > April 2005 > SOAP / xmlrpx / DOM - encoding









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SOAP / xmlrpx / DOM - encoding
Matthias Meier

2005-04-21, 8:58 am

Hello to all!

I want to send data over network via tclsoap (xmlrpc)
(Version 1.6.7, tcldom 3.0 tclxml 3.0) and want to have
nonprintable and other non us-ascii characters converted to their xml-entity
i.e.:

ä => ä or ä

If tclsoap receives an character-entity it is decoded to it's correct character by
'dom::DOMImplementation parse'

But for sending data, tclsoap uses 'dom::DOMImplementation serialize' and here only few special
chars are converted to their entity (i.E. '&' => &#amp;).

Is it posible to configure 'dom::DOMImplementation serialize' that other non us-ascii/non printable
characters are also converted?

Here an example:

package require dom
set doc [dom::DOMImplementation create]
set d_root [dom::document createElement $doc "root"]
dom::document createTextNode $d_root "öäü&"

dom::DOMImplementation serialize $doc

Output is
------------------------------------
<?xml version='1.0'?>
<!DOCTYPE root>
<root>öäü&</root><?xml version='1.0'?>
------------------------------------

But I would like to have
------------------------------------
<?xml version='1.0'?>
<!DOCTYPE root>
<root>öäü&</root>
------------------------------------


Thanks for all ideas!

Matthias




--
________________________________________
_______
Matthias Meier
Fornoff und Heintzenberg GmbH
Consulting, DV-Systeme, Dienstleistungen
Hauptstr. 4, D-79224 Umkirch
Tel +49 7665 937-0, Fax -150
Michael Schlenker

2005-04-21, 8:58 am

Matthias Meier wrote:
> Hello to all!
>=20
> I want to send data over network via tclsoap (xmlrpc)
> (Version 1.6.7, tcldom 3.0 tclxml 3.0) and want to have
> nonprintable and other non us-ascii characters converted to their=20
> xml-entity
> i.e.:
>=20
> =E4 =3D> ä or ä
>=20
> If tclsoap receives an character-entity it is decoded to it's correct=20
> character by
> 'dom::DOMImplementation parse'
>=20
> But for sending data, tclsoap uses 'dom::DOMImplementation serialize'=20
> and here only few special
> chars are converted to their entity (i.E. '&' =3D> &#amp;).
>=20
> Is it posible to configure 'dom::DOMImplementation serialize' that othe=

r=20
> non us-ascii/non printable
> characters are also converted?

It should not be needed as the default encoding for XML is utf-8, but if =

you change the encoding of the XML, you may get the conversion you want.

Michael
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com