How to escape special xml characters in ALSB

Hi
Can some one tell me how to replace special xml characters < ,> with &lt; and &gt;
I have xml node like below
<payload>
<RatingDetails>
<Action>Add</Action>
</payload>
Using fn-bea:serialize i got xml string as
<payload><RatingDetails><Action>Add</Action></payload>
I want output as below
<payload>&lt;RatingDetails&gt;&lt;Action&gt;Add&lt;/Action&gt;</payload>
Appreciate your help
Thanks in Advance

when i use fn-bea:serialize my request xml node converted to xml string.To that string i had escaped special xml characters.
Original request:
<abc>
<a1 >123</a1>
<payload>
<d>345</d>
<e><678></e>
</payload>
</abc>
After using serialize it became as below (everything in one line)
<abc><a1>123</a1><payload><d>345</d><e><678></e></payload></abc>
then i used java callout for replacing special xml chars in payload element,
now my request is
<abc><a1>123</a1><payload><![CDATA[& lt;d& gt;345& lt;/d& gt;& lt;e& gt;& lt;678& gt;& lt;/e& gt;]]></payload></abc>
i dont want my payload data to be enclosed within CDATA but by default i am getting it when i run my xquery for generating request.
This might be because & will not get parsed in xml parser so enclosing evrything in CDATA.
Need solution to remove CDATA and send the payload data as it is..

Similar Messages

  • How to escape special characters in Simple Transformation

    Hi Experts,
    I have got a problem to get a well formed xml document from the below simple transformation. The content of maktx contains
    special characters like & <, which are not allowed in a well formed XML-Document. But the result of the Simple Transformation
    contains this charcters even after the transformation as you can the in the result below. Has anyone a hint how to escape the
    characters included in the maktx.
    The transformation for maktx, should be something like
    Before: Material & < TEST
    After: Material &amp &lt TEST
    Report wihich calls the simple transformation
    types:
    BEGIN OF t_mat,
       matnr type matnr,
       maktx type maktx,
    end of t_mat.
    Data:
      mat type t_mat,
      xml_stream type xstring.
    START-OF-SELECTION.
    mat-matnr = '4711'.
    mat-maktx = 'Material & < Test'.
    CALL TRANSFORMATION ztest_st2
            SOURCE mat = mat
            RESULT XML xml_stream.
    CALL FUNCTION 'DISPLAY_XML_STRING'
      EXPORTING xml_string = xml_stream.
    Simple Transformation
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="MAT"/>
      <tt:template>
        <Leistungsschild>
            <CHARACT> MATNR </CHARACT>
            <CHARACT_DESCR> Materialnummer </CHARACT_DESCR>
            <VALUE tt:value-ref="MAT.MATNR"/>
            <CHARACT> MAKTX </CHARACT>
            <CHARACT_DESCR> Materialkurztext </CHARACT_DESCR>
            <VALUE tt:value-ref="MAT.MAKTX" />
        </Leistungsschild>
      </tt:template>
    </tt:transform>
    RESULT
    <?xml version="1.0" encoding="utf-8" ?>
    <Leistungsschild>
      <CHARACT>MATNR</CHARACT>
      <CHARACT_DESCR>Materialnummer</CHARACT_DESCR>
      <VALUE>4711</VALUE>
      <CHARACT>MAKTX</CHARACT>
      <CHARACT_DESCR>Materialkurztext</CHARACT_DESCR>
      <VALUE>Material & < Test</VALUE>   </Leistungsschild>

    Hi Sandra,
    First of all thaks for your quick answer to my problem.
    I see what you mean and get the same result, if I am using data-type string instead of xstring. But the recommendation in the XML-Books of SAP is to use XSTRING to save memory and circumflex problems between Codepages, when writing the XML-Stream to a filesystem.
    As you can see in the code abvoe I am using a SAP-FM to display the XML-Stream and this FM works only with XSTRING´s,
    that is one reason why I don´t understand that it displays it in the wrong way.
    Even the Debugger shows me for the XSTRING the wrong result. Does all that mean that the escaping will not be applyed if you are working with XSTING´s??

  • How to escape special characters in a region title

    I have created a drill down report where the second report is filtered by a value chosen in the first report. I am using &Pn_field. syntax to pass the name of the select value to the region title of the second report. Some of the returned values have a ':' in them and therefore the text does not print after the ':'. How do I escape the ':' in the region title?
    regards
    Paul P

    Paul,
    I think your question is "How do I use f?p URL syntax to pass data values to a page where the data includes a colon?" (Please correct me if that's not the issue.) The answer is, you can't. Same with commas. HTML DB reserves those two characters for the f?p request syntax. You'll have to save the string into the item before the page branch. There is no restriction on what characters can be used in a region title, it's just HTML-formatted text, except that you must escape anything that looks like HTML unless you want the browser to treat it as HTML. There are restrictions, however, on what characters you can pass in URLs in general and you must take care to escape them properly, e.g., ?, &, whitespace.
    And do speak up if I've missed the point.
    Scott

  • How to escape special characters in expression

    Hi all,
    I have to build a wildcard search expression, some key words, such as "%%%", "___%" will list out all records, which is not allowed in our application.
    In oralce sql , we have an key word: "escape", but I can't translate it into an expression.
    Any one can help me?
    Any help will be appreciated. Thank you.
    Regards,
    Roger

    Are using using like()? Expression also defines like() with two arguments, the second is the escape.
    JPQL also defines this.
    James : http://www.eclipselink.org

  • How to escape or remove the special characters in the xml element by regula

    Hi members,
    How to escape or remove the special characters in the xml element by regular expression  in java??
    For Example ,
    <my:name> aaaa </my:name>
    <my:age> 27 </my:age>
    In the above example , i have to retrieve the value of the <my:name> Element(For examlpe -- i have to get "aaaa" from <my:name> tag)...
    How to retreive this value by using DOM with XPATH in java
    Thanks in Advance

    Hi members,
    I forget to paste my coding for the above question....This is my coding......In this display the error...... Pls reply ASAP.......
    PROGRAM:
    import java.io.IOException;
    import java.util.Hashtable;
    import java.util.Map;
    import org.w3c.dom.*;
    import org.xml.sax.SAXException;
    import javax.xml.parsers.*;
    import javax.xml.xpath.*;
    public class DOMReaderForXMP {
         static Document doc;
         static XPath xpath;
         static Object result;
         static NodeList nodes;
         public DOMReaderForXMP() throws ParserConfigurationException, SAXException,
                   IOException, XPathExpressionException {
              DocumentBuilderFactory domFactory = DocumentBuilderFactory
                        .newInstance();
              domFactory.setNamespaceAware(true);
              DocumentBuilder builder = domFactory.newDocumentBuilder();
              doc = builder.parse("d:\\XMP.xml");
              XPathFactory factory = XPathFactory.newInstance();
              xpath = factory.newXPath();
         public static void perform(String path) throws Exception {
              result = xpath.evaluate(path, doc, XPathConstants.NODESET);
              nodes = (NodeList) result;
         public void check() throws Exception {
              perform("//my:name/text()");
              if (!nodes.item(0).getNodeValue().equals("application/pdf")) {
                   System.out.println("Mathces....!");
    ERROR:
    Exception in thread "main" net.sf.saxon.trans.StaticError: XPath syntax error at char 9 in {/my:name}:
    Prefix aas has not been declared

  • How to remove special characters in xml

    Dear friends,
    How to remove the special character  from the xml. I am placing the xml file and  fetching through file adapter.
    The problem is when there is any special character in xml. i am not able to pass to target system smoothly.
    Customer asking schedule the file adapter in order to do that the source xml should not have any special charatcters
    How to acheive this friends,
    Thanx in advance.
    Take care

    Hi Karthik,
    Go throgh the following links how to handle special character
    https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
    Restricting special characters in XML within XI..
    Regards
    Goli Sridhar

  • How to export special characters into an XML file?

    Dear experts,
    We read files from our customers and save data into our customized table without any character changed, including some address fields. In those address fields, some special characters (not in our code page) are also kept. When we want to write these address fields into an XML file or flat file, the special charcters become "##" or not readable, can anyone help us to solve this issue?
    Question1: How to write special code to an external file?
    Question2: how to use 'CALL TRANSFORMATION' from an internal table to an XML file?
    Your answer is highly appreciated!
    Joanne

    Hi Joanne.
    Please check the below link.
    CALL TRANSFORMATION
    Before that u have to create one transformation program in STRANS tcode for using it in call transformation statement.
    Hope it will be useful.
    Regards,
    Lakshman

  • How to get an xml string into a Document w/o escaping mark-up characters?

    Hi,
    I am using one of the latest xerces using Java. I am pretty sure I am using xerces-2.
    I have an existing Document and I am trying to add more content to it. The new content itself is xml string. I am trying to insert this xml string into the document using document.createTextNode. I am able to insert, but somewhere it is escaping the mark-up characters (<,>,etc). When I convert the document into String, I can see, for example, <userData> instead of <userData>.
    There is an alternative option to accomplish this by creating a new document with this xml string, get the root element, import this element into my document. Execution time for this procedure is very high - means, this is very bad in terms of time-wise performance.
    Can any help on how to accomplish this (bringing an xml string into a document without escaping mark-up characters) in time-efficient way.

    So you want to treat the contents of the string as XML rather than as text? Then you have to parse it.
    Or if your reason for asking is just that you don't like the look of escaped text, then use a CDATA section to contain the text.

  • How to use Special Characters in CONCAT function or another form with Xquer

    Hello everyone
    I'm using PS3 OEPE within message flow (proxy)and I'm using Xquery.
    I'm using the CONCAT function, but this does not allow me to concatenate special characters not allowed, for example:
    I want to concatenate these strings:
    String1 = “&amp;lt;get-person&amp;gt;&amp;lt;id-person&amp;;gt;”
    String2 = “123”
    String3 = “&amp;lt;/id-person&amp;;gt; &amp;lt;/get-person&amp;gt;”
    I want to represent characters regex. It means no XML characters
    Someone knows some way, any function that allows me to concatenate in OSB these values with Xquery?
    Edited by: chromosoma on Sep 5, 2012 5:59 PM

    Hi,
    It seems to me you're doing things in the most complicated way possible...
    Firstly, you should use codepoints-to-string not the reverse... Secondly, the function work with decimals, not hexa
    http://www.xqueryfunctions.com/xq/fn_codepoints-to-string.html
    http://www.xqueryfunctions.com/xq/fn_string-to-codepoints.html
    This works...
    concat(codepoints-to-string(38),'lt',codepoints-to-string(59),'get-person')But this also works... Note that I've inserted a space between the &amp; and the lt so the forum formatting can show it...
    let
    $String1 := "& lt;get-person& gt;& lt;id-person& gt;",
    $String2 := "123",
    $String3 := "& lt;/id-person& gt;& lt;/get-person& gt;"
    return
         concat($String1,$String2,$String3)And, finally this also works... So what's the reason for escaping &lt; and &gt; with &amp;lt and &amp;gt; and why codepoints?
    let
    $String1 := "<get-person><id-person>",
    $String2 := "123",
    $String3 := "</id-person></get-person>"
    return
         concat($String1,$String2,$String3)Cheers,
    Vlad

  • How to display special characters in APEX Classic Report column

    Ref: Thread: How to display newline characters as new lines
    Version: APEX 3.2
    Hi,
    I have created an classic SQL Report with one of the columns being a decode that gives a value 'Post'(the value should be highlighted in Red) on one condition and 'Pre' on another. I have followed the advice given in the page (URL provided above) , i.e. I have changed Strip HTML to 'No', changed Display as to 'Display as text (escape special characters, does not save state)'. I have also passed this value back to the same page to be stored in a page item each time a link (another column in report) in report is clicked. I have tried passing it as #DEADLINE# and \#DEADLINE#\. The issue I face is, instead of the value being highlighted in Red, it gets passed back as a string holding the value 'Post'. Is there any way I can get this to display as it should without the Strip HTML being changed to 'Yes'.
    Thanks very much.
    Rohi
    Edited by: Rohi on 18-Jul-2012 04:21

    876651 wrote:
    Hi,
    Thanks for your response.
    I am trying to display a page item that is derived from a report column based on a click on the URL link (*view >*>)
    This page item (here, it is Manager_ID) should ideally be highlighted when a particular condition is satisfied (achieved using a DECODE in the report).
    But it is not displayed like it should be.
    I do not want the value to be displayed along with the html tags as a string.
    I want the html tags to take effect and highlight the value within it.
    Initially, I had set Strip HTML to Yes and the value was returned without any highlighting .
    So I changed it to 'No' and and it contained the html tags.
    I am not sure what setting in APEX Report Attributes can help me achieve that effect I want.None of the report settings are relevant. They affect the rendering of the report and none of the columns you were changing the properties of were actually rendered.
    You can't pass HTML and CSS around in URL parameters.
    I suggest you pass *2* values in the column link: the MGR ID and a simple class or colour value computed by the DECODE in the report. I've suppressed the first version of the report and created a new one that does this:
    decode(dept.deptno, '30', 'c00', '000') highlight The link column now passes the MGR ID and the HIGHLIGHT colour (red when the condition is satisfied and black when it is not).
    I created another hidden and protected page item <tt>P0_HIGHLIGHT</tt> as the target for the highlight value, and used the Pre/Post Element Text properties of the <tt>P0_G_MGR</tt> to wrap it in a <tt>span</tt> whose colour is changed using the <tt>P0_HIGHLIGHT</tt> value as a subtitution string:
    <span style="color: #&P0_HIGHLIGHT.;">Having done that, I still don't really get the requirement here. I'm sure that given the full picture I'd be using a completely different approach...

  • How to escape the special character ' (ascii 39) in a select query?

    Hi,
    does anybody know how to escape the special character ' (ascii 39) in a select query?
    I've tried a lot of ways but nothing seems to work, for example I try to get all
    names in table foo where coloumn name contains a '-sign (ascii 39)
    select name from foo where name like '%\'%';
    select name from foo where name like '%{'}%';
    select name from atg_horse where name like '%chr(39)%'
    ... but neither works, I end up with a ORA-01756: quoted string not properly terminated
    I would apriciate any help
    /Carl-Michael

    friends
    thanks for ur time and effort that u gave to reply to my problem.
    But my main problem is that when my application (VC++ 7) fires the following query in the oracle database , it does not return any rows.
    SELECT count(*) FROM ORGANISATION WHERE UPPER(ORGANISATION.ORGANISATIONNAME)
    LIKE N'&#946;%' ORDER BY ORGANISATION.ORGANISATIONNAME
    the above question in the previous thread was just to check on sql plus as it's editor does not support unicode characters.

  • Escape special characters in url for redirection

    In my web page, I want all the characters of the URL to be lower case. For that I created the following method:
    private bool UrlFormatoCorrecto(string url)
    bool formatoCorrecto = true;
    bool upperCa = url.Any(c => char.IsUpper(c));
    if (url.Any(c => char.IsUpper(c)))
    formatoCorrecto = false;
    if (url.Contains(" ") || url.Contains("+"))
    formatoCorrecto = false;
    return formatoCorrecto;
    This works like a charm until a special character appears. The url that I get then will be the following:
    http://localhost/web/coches/proven%C3%A7a-aribau,-08036-barcelona,-barcelona
    So I have upper case characters. When I redirect it using the following code:
    if (!UrlFormatoCorrecto(urlActual))
    Response.RedirectPermanent(urlActual.Replace(" ", "-").Replace("+", "-").ToLower());
    I get the code again with the same URL with upper case. How can I escape the special characters so they won't bother me anytime I want to make the redirection?

    hello,
    you could escape special caracters with :
    Regex.Escape Method
    Regards
    Cédric

  • Special Unicode characters in RSS XML

    Hi,
    I'm using an adapted version of Husnu Sensoy's solution (http://husnusensoy.wordpress.com/2007/11/17/o-rss-11010-on-sourceforgenet/ - thanks, Husnu) to consume RSS feeds in an Apex app.
    It works a treat, except in cases where the source feeds contain special unicode characters such as [right double quotation mark  - 0x92  0x2019] (thankyou, http://www.nytimes.com/services/xml/rss/nyt/GlobalBusiness.xml)
    These cases fail with
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00217: invalid character 8217 (U+2019) Error at line 19
    Any ideas on how to translate these characters, or replace them with something innocuous (UNISTR?), so that the XML transformation succeeds?
    Many thanks,
    jd
    The relevant code snippet is:
    procedure get_rss
    (  p_address                 in httpuritype
    ,  p_rss                    out t_rss
    is
       function oracle_transformation
          return       xmltype is
          l_result     xmltype;
       begin
          select xslt
          into   l_result
          from   rsstransform
          where  rsstransform = 0;
          return l_result;
       exception
       when no_data_found then
          raise_application_error(-20000, 'Transformation XML not found');
       when others then
          l_sqlerrm := sqlerrm;
          insert into errorlog...
       end oracle_transformation;
    begin
       xmltype.transform(p_address.getXML()
                        ,oracle_transformation
                        ).toobject(p_rss);
    exception
    when others then
      l_sqlerrm := sqlerrm;
      insert into errorlog....
    end get_rss;My environment:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_CHARACTERSET WE8ISO8859P1
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE

    environment
    Oracle 10g R2 x86 10.2.0.4 on RHEL4U8 x86.
    db NLS_CHARACTERSET WE8ISO8859P1
    After following the following note:
    Changing US7ASCII or WE8ISO8859P1 to WE8MSWIN1252 [ID 555823.1]
    the nls_charset was changed:
    Database character set WE8ISO8859P1
    FROMCHAR WE8ISO8859P1
    TOCHAR WE8MSWIN1252
    And the error:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00217: invalid character 8217 (U+2019)
    was no longer generated.
    A Unicode database charset was not required in this case.
    hth.
    Paul

  • SAP special german characters(umlaut) like ü, ö, ä not displayed properly in XML output

    Hello Team,
    Here we are facing issues while converting SAP tables data to XML file.
    the description is not converting properly for the special German characters like ü, ö, ä.
    Actual output should be :Überprüfung nach § 29 STVZO
    Output Displayed :Ã#berprüfung nach § 29 STVZO
    Can you please look into and help me in this to get correct output .
    Thank you.

    Hi,
    Unicode or Non-Unincode System ?
    Displayed where ? SAPGUI ? Print Preview ? Spool-Display ?
    And how is the XML file written ?  OPEN DATASET ? BAPI ?
    At all of these stages it might be either that it is only a display system, like the selected display CHARSET in SAPGUI, when it is a non-unicode system, or simply not coded correctly like OPEN DATASET without specifying the cdepage when necessary.
    And it might even be, that even "displaying" the XML File is simply done with the incorrect codepage while the data inside the file is correct.
    If you are on Windows, you might even face funny results when saving a simple textfile from notepad with ANSI/DOS and both Unicode variants and then go to CMD.EXE ans simply "type" the content.
    All 4 results will be different, allthough notepad will display the same stuff.
    So first of all, makes sure which codepage is relevant at all stages from DB-table to "display"
    - DB-Charset
    - SAP system type (unicode/non-unicode)
    - SAP codepage (1100 / 410x )
    - crosscheck the test from report RSCPINST
    - Codepage on Windows running SAPGUI
    - Selected codpage for Sapgui
    Good hunting
    Volker

  • Inconsistent behaviour (I think) with escaping of invalid characters. Select in MSSQLMS escapes fine but assigning to an xml typed variable fails.

    -- How can I assign an xml typed variable and take advantage of the automatic escaping of invalid characters?
    -- This query escapes the character fine in MSSQLMS
    SELECT * FROM (SELECT CAST(0x1B00 AS NVARCHAR(128)) AS TestCharacter) MyTable FOR XML auto
    <MyTable TestCharacter="&#x1B;" />
    -- This fails in MSSQLMS and in a similar production procedure.
    DECLARE @MyXml XML
    SET @MyXML = (SELECT * FROM (SELECT CAST(0x1B00 AS NVARCHAR(128)) AS TestCharacter) MyTable FOR XML auto)
    Msg 9420, Level 16, State 1, Line 2
    XML parsing: line 1, character 30, illegal xml character
    Scott Mitchell

    Thanks for the reply. I looked at casting to varbinary but didn't want to cast the large strings that have these characters in them. Sorry for not mentioning that. My example above is simplified. The text isn't only in an attribute and can be quite large.
    I want to be able to read the text by just looking at the xml. 
    I really would like the escaped form:
    &#x1B; for all the invalid characters. 
    Scott Mitchell

Maybe you are looking for

  • Exporting as PDF from Keynote type problem

    Hi, I'm trying to export a Keynote presentation as a PDF for a client leave-behind, and the PDF is not showing all fonts correctly. Some slides have simple text boxes that Adobe Reader and Acrobat render as complete gibberish. Other screens have Numb

  • What is the 5s model number for UK

    I am looking to buy the new 5s and want to get whilst I'm in the US, but need to know the right model number for full UK network access, with the ability to operate on 4g when others companies than EE offer it, but I'm told they will be on other freq

  • Component Usage in Select Options

    Hi I need to bring Profit Center Hierarchy in Select Options of Webdynpro for Profit Center field. For this have created component Usage with hierarchy which works fine in case of input field but I want to make it work on select options field for usi

  • Pmt doc reset without cheque cancellation

    Dear All, After doing payment run & cheque generation, can I do FBRA to reset(only reset, not reset & reverse) Payment document (without cancelling cheque). Surprisingly, system is allowing me to do this. My understanding was unless cheque is cancell

  • Discoverer Export Problem - Column headers dropped & row data used instead

    In Discoverer 9i, when I export the data for a 12 month period from one of my workbooks to Excel 2002, three of the twelve column headers are dropped in the spreadsheet and one piece of row data is used as a column header instead. The total number of