You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <bi...@gmail.com> on 2008/04/15 19:33:45 UTC

Re: Q: Issues when attempting to send ">". Wind up with ">"

Something happened to your email, there are no &gt expressions in the XML.

Any > inside of an XML element has to be escaped. If you are trying to add
your own XML elements inside of this, then you need a different mechanism.



On Tue, Apr 15, 2008 at 1:23 PM, adam_j_bradley <ad...@yahoo.com>
wrote:

>
> I'm currently setting this string (which forms part of the
> WSSecurityHeader),
> however, when I try and use ">" I wind up with "&gt;".
>
> ---snip---
> <ppSoapHeader25><s:ppSoapHeader
> xmlns:s="http://url/SoapServices/SoapHeader"
> version="1.0"><s:lcid>1033</s:lcid>s:sitetoken>t:siteheader
> xmlns:t="http://url/SiteToken" id="253988"
> />/s:sitetoken>/s:ppSoapHeader></ppSoapHeader25>
> ---snip---
>
> What I want the web service to see is
>
> ---snip---
> <ppSoapHeader25><s:ppSoapHeader xmlns:s="http://url/SoapHeader"
> version="1.0"><s:lcid>1033</s:lcid><s:sitetoken><t:siteheader
> xmlns:t="http://url/SiteToken" id="253988"
> /></s:sitetoken></s:ppSoapHeader></ppSoapHeader25>
> ---snip---
>
> Any ideas?
> Thanks in advance!
> Adam
>
>
> --
> View this message in context:
> http://www.nabble.com/Q%3A-Issues-when-attempting-to-send-%22-gt%22.-Wind-up-with-%22-amp-gt-%22-tp16703395p16703395.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Q: Issues when attempting to send ">". Wind up with ">"

Posted by Benson Margulies <bi...@gmail.com>.
How are you coding this?

>From the posted items, it's clear that you are passing a string of XML to an
API that specifically wants text payload. So it's carefully excaping your
less-than signs.

If you tell us what you're calling and where, someone can probably tell you
how to insert an XML element into a DOM tree or otherwise get what you want.

Re: Q: Issues when attempting to send ">". Wind up with ">"

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
adam_j_bradley wrote:
> Dan,
> 
> Thanks for the tip, getting closer! One thing I want to now have is for all
> the ">" symbols to be converted to "&gt;" to mimic the behavior of the
> existing Web Service client (C# based).
> 
> Any thoughts on how I might do that?

It shouldn't be necessary - both forms are equivalent XML and will come 
out the same at the other end.  The only characters that absolutely must 
be escaped in XML are < (&lt;) and & (&amp;), plus and single or double 
quotes that occur in attribute values delimited by the same type of 
quote (i.e. attr="&quot;" is the same as attr='"', attr='&apos;' is the 
same as attr="'").  Many processors also escape > (&gt;) and 
non-attribute ' and " characters, but that isn't required by the spec. 
Either way, all the escaping will have been removed by the time the 
other end sees the value.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: Q: Issues when attempting to send ">". Wind up with ">"

Posted by Benson Margulies <bi...@gmail.com>.
Here we go again. I suggest that you write things like 'convert the
greater-than sign to amp g t semi'.

You shouldn't ever need to do this. No standard-conforming XML processor
needs it.

On Wed, Apr 16, 2008 at 9:19 PM, adam_j_bradley <ad...@yahoo.com>
wrote:

>
> Dan,
>
> Thanks for the tip, getting closer! One thing I want to now have is for
> all
> the ">" symbols to be converted to ">" to mimic the behavior of the
> existing Web Service client (C# based).
>
> Any thoughts on how I might do that?
>
> Sincerely,
> Adam
>
>
> dkulp wrote:
> >
> > Don't pre-escape it.   Let the CXF runtime escape it.   The runtime
> > doesn't know if a string that is being passed in is XML or just a
> > straight string.   Thus, it will always escape any of the XML special
> > characters.  You don't need to do it.
> >
>
> --
> View this message in context:
> http://www.nabble.com/Q%3A-Issues-when-attempting-to-send-%22-gt%22.-Wind-up-with-%22-amp-gt-%22-tp16703395p16736921.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Q: Issues when attempting to send ">". Wind up with ">"

Posted by adam_j_bradley <ad...@yahoo.com>.
Dan,

Thanks for the tip, getting closer! One thing I want to now have is for all
the ">" symbols to be converted to "&gt;" to mimic the behavior of the
existing Web Service client (C# based).

Any thoughts on how I might do that?

Sincerely,
Adam


dkulp wrote:
> 
> Don't pre-escape it.   Let the CXF runtime escape it.   The runtime 
> doesn't know if a string that is being passed in is XML or just a 
> straight string.   Thus, it will always escape any of the XML special 
> characters.  You don't need to do it.
> 

-- 
View this message in context: http://www.nabble.com/Q%3A-Issues-when-attempting-to-send-%22-gt%22.-Wind-up-with-%22-amp-gt-%22-tp16703395p16736921.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Q: Issues when attempting to send ">". Wind up with ">"

Posted by Daniel Kulp <dk...@apache.org>.
Don't pre-escape it.   Let the CXF runtime escape it.   The runtime 
doesn't know if a string that is being passed in is XML or just a 
straight string.   Thus, it will always escape any of the XML special 
characters.  You don't need to do it.

Dan


On Wednesday 16 April 2008, adam_j_bradley wrote:
> Interestingly, when I inspect the variable I see
> http://www.papernapkin.org/pastebin/view/500/
>
> But the result in the trace to the Console via the
> LoggingOutInterceptor is still incorrect.
>
> Adam



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: Q: Issues when attempting to send ">". Wind up with ">"

Posted by adam_j_bradley <ad...@yahoo.com>.
Interestingly, when I inspect the variable I see
http://www.papernapkin.org/pastebin/view/500/

But the result in the trace to the Console via the LoggingOutInterceptor is
still incorrect.

Adam




-- 
View this message in context: http://www.nabble.com/Q%3A-Issues-when-attempting-to-send-%22-gt%22.-Wind-up-with-%22-amp-gt-%22-tp16703395p16718470.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Q: Issues when attempting to send ">". Wind up with ">"

Posted by adam_j_bradley <ad...@yahoo.com>.
Bugger! I'll try again. What I want to send is
http://www.papernapkin.org/pastebin/view/494/

But what winds up being send it 
http://www.papernapkin.org/pastebin/view/496/

The ampersand (spaces added to this example) in the "& lt ; " gets further
delimated with "& amp ; lt ;"

Any ideas?
Thanks in advance!
Adam


Benson Margulies-4 wrote:
> 
> Something happened to your email, there are no &gt expressions in the XML.
> 
> Any > inside of an XML element has to be escaped. If you are trying to add
> your own XML elements inside of this, then you need a different mechanism.
> 
> 

-- 
View this message in context: http://www.nabble.com/Q%3A-Issues-when-attempting-to-send-%22-gt%22.-Wind-up-with-%22-amp-gt-%22-tp16703395p16714294.html
Sent from the cxf-user mailing list archive at Nabble.com.