Re: Novice - Problem with data encoding

2002-11-01 Thread Antti Haapala

 I have an XML doc that I generated using XML::LibXML that needs to be
 included as a hidden form field in a form post.

 The problem is that the browser is encoding the XML doc.

 ie.
 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE gtfd SYSTEM http://gftd/schemas/data.dtd;

 turns into:
 lt;?xml version=1.0 encoding=UTF-8?gt;
 lt;DOCTYPE gtfd SYSTEM quot;http://gftd/schemas/data.dtdquot;gt;

 which blows up in the parsing.  If I edit the result and swap back the 
 and  it works. How can I prevent the encoding of the XML data?

You have probably escaped the xml snippet twice yourself - check the code
of the page from your browser. If you see the value of your hidden field
as amp;lt;?xml..., you have done double escaping.

Just remove one of the escaping passes and it should work.

The browser isn't supposed to do any such encoding on its own. If it does
you need to change your browser. You aren't using Netscape 4.0, are you?

-- 
Antti Haapala




Re: Novice - Problem with data encoding

2002-11-01 Thread Chris Pizzo
Thats what is wierd.  I don't do any escaping.  I think it might be embperl
doing the escaping because if I do a print of the XML doc string it has no
escaping.  If I put the string between [+ $content +] then it gets escaped.

Thanks for your help,
Chris
- Original Message -
From: Antti Haapala [EMAIL PROTECTED]
To: Chris Pizzo [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, November 01, 2002 6:35 AM
Subject: Re: Novice - Problem with data encoding



  I have an XML doc that I generated using XML::LibXML that needs to be
  included as a hidden form field in a form post.
 
  The problem is that the browser is encoding the XML doc.
 
  ie.
  ?xml version=1.0 encoding=UTF-8?
  !DOCTYPE gtfd SYSTEM http://gftd/schemas/data.dtd;
 
  turns into:
  lt;?xml version=1.0 encoding=UTF-8?gt;
  lt;DOCTYPE gtfd SYSTEM quot;http://gftd/schemas/data.dtdquot;gt;
 
  which blows up in the parsing.  If I edit the result and swap back the 
  and  it works. How can I prevent the encoding of the XML data?

 You have probably escaped the xml snippet twice yourself - check the code
 of the page from your browser. If you see the value of your hidden field
 as amp;lt;?xml..., you have done double escaping.

 Just remove one of the escaping passes and it should work.

 The browser isn't supposed to do any such encoding on its own. If it does
 you need to change your browser. You aren't using Netscape 4.0, are you?

 --
 Antti Haapala






Re: Novice - Problem with data encoding

2002-11-01 Thread Gerald Richter


 Thats what is wierd.  I don't do any escaping.  I think it might be
embperl
 doing the escaping because if I do a print of the XML doc string it has no
 escaping.  If I put the string between [+ $content +] then it gets
escaped.


Yes, Embperl escapes your output per default, you can turn it off by using
$escmode e.g.

[+ do { local $escmode = 0 ; $content } +]

Gerald

P.S. The do { } is only necessary in Embperl 2.0

-
Gerald Richterecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:   Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925131
WWW:http://www.ecos.de  Fax:  +49 6133 925152
-






Novice - Problem with data encoding

2002-10-31 Thread Chris Pizzo
Hi,
I have an XML doc that I generated using XML::LibXML that needs to be
included as a hidden form field in a form post.

Code snippet:

sub getcXML   {
use XML::LibXML;
my $resp_doc = XML::LibXML::Document-new();
my $root = $resp_doc-createElement('blah');
...
my $content = $resp_doc-toString;
return $content
}

The html is:
form name=sndxml method = post action =
http://someserver.com/process_xml
input type = hidden name = xml_here value = [+ getcXML(); +]
input type = submit value = Order
/form



The problem is that the browser is encoding the XML doc.

ie.
?xml version=1.0 encoding=UTF-8?
!DOCTYPE gtfd SYSTEM http://gftd/schemas/data.dtd;

turns into:
lt;?xml version=1.0 encoding=UTF-8?gt;
lt;DOCTYPE gtfd SYSTEM quot;http://gftd/schemas/data.dtdquot;gt;

which blows up in the parsing.  If I edit the result and swap back the  
and  it works.
How can I prevent the encoding of the XML data?


Anyone point me in the right direction?

Thanks,
Chris