开发者

apache CXF - with xml string

I am using CXF for web services.

I have an inner xml wrapped by an outher xml. That is, I produce an xml:

<aa><bb><cc>bla</cc></bb></aa>

and than the CXF wraps it:

<answer>&lt;aa&gt;&lt;bb&gt;&lt;cc&gt;bla&lt;/cc&gt;&lt;/bb&gt;&lt;/aa&gt;</answer>

As you can see, the < and > are escaped with &开发者_如何学运维;lt; and &gt;.

I wish that this doesn't happen.

Thank you very much.


This behavior is by the definition of the xml syntax.

check e.g. http://en.wikipedia.org/wiki/XML

  • The characters "<" and "&" are key syntax markers and may never appear in content outside of a CDATA section.
  • There are five predefined entities: < represents "<", > represents ">", & represents "&", ' represents ', and " represents ".

You can try to wrap your inner xml inside a CDATA.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜