cancel
Showing results for 
Search instead for 
Did you mean: 

Escape angle bracket in XML <>

Former Member
0 Kudos

Hi,

I am mapping to the cXML from the idoc. In the cXML field call extrinsic I want to map a hyperlink to it. When I send it through the adapter look like XI convert the angle bracket <> to &lt; and &gt;. Here is what I tried to map

<URL name="TC">http://www.mycompany.pdf</URL>

Do you have any suggestion on how to escape the angle bracket conversion? I was trying different option below but non of them work. When I use the converstion code then it pass through as text. When I looked at the moni under technical routing xml it show the url link but when I open it with note pad then I see the bracket converted.

&lt;URL name="TC"&gt;http://www.mycompany.pdf&lt;/URL&gt;

"&#60"URL name="TC""&#62"http://www.mycompany.pdf"&#60/URL"&#62"

Thanks

MN

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try using CDATA

All text in an XML document will be parsed by the parser.

But text inside a CDATA section will be ignored by the parser.

CDATA - (Unparsed) Character Data

The term CDATA is used about text data that should not be parsed by the XML parser.

Characters like "<" and "&" are illegal in XML elements.

"<" will generate an error because the parser interprets it as the start of a new element.

"&" will generate an error because the parser interprets it as the start of an character entity.

Some text, like JavaScript code, contains a lot of "<" or "&" characters. To avoid errors script code can be defined as CDATA.

Everything inside a CDATA section is ignored by the parser.

A CDATA section starts with "<![CDATA[" and ends with "]]>":

Refer to http://www.w3schools.com/xml/xml_cdata.asp

Regards,

Mike

Answers (4)

Answers (4)

Former Member
0 Kudos

MN,

Please have a look at the 'href' attribute

I have provided one example http://www.w3schools.com/HTML/html_links.asp --> Examples --> Create hyperlinks.

You may want to type 'href' in a search engine to find the syntax to meet you specific requirement

Regards,

Mike

Former Member
0 Kudos

Hi,

I was tried the CDATA approached but it doesn't work. It send out as a text (see below) instead of hyperlink.

<![CDATA[<URL name="TC"> http://www.mycompany.pdf </URL>]]>

Any other suggestion would be appreciated.

Thanks

MN

Former Member
0 Kudos

a good solution by riaz. another work around may be:- you can replace illigal characters

with " { " and write a script which will replace" { " with the " < "in xml file.

Former Member
0 Kudos

Hi,

You can make use of CDATA.

e.g. if you have a node say


<Node1>String & with &  Special & Characters like < angle > brackets</Node1>

replace it with


<Node1><![CDATA[String & with &  Special & Characters like < angle > brackets
]]>

A CDATA section starts with


<![CDATA[

and ends with



]]>

Everything inside the CDATA section is ignored by the parser.

For more info about CDATA, refer - [http://www.w3schools.com/XML/xml_cdata.asp]

Regards,

Riyaz