Handle special characters in xml

Hi,
  Our end users tend to copy the description text from Word documents to pdf form and submits it.
If that text contains any special characters, its getting carried to the extracted xml. In the next step, when I try to assign a task to user with template and this xml, Managers cannot able to open the form and showing the error. When I assign the xml without special characters, its running fine.
Please assist on how to handle this?
My expectation is that user should be prompted in the form when he pastes any special characters or they should be auto-corrected to null values. if that is not possible, atleast we should able to filter the xml and eliminate special characters before the form go to next stage.
Appreciate your help.
Thanks,
Krishna

In first instance, I would have followed this way:
http://www.dvteclipse.com/documentation/svlinter/How_to_use_special_characters_in_XML.3F.h tml
so, I would have parsed the submitted text in a Validate event and changed any special chars to UTF-8 numeric reference.
However, I found this:
http://blog.mark-mclaren.info/2007/02/invalid-xml-characters-when-valid-utf8_5873.html
which seems to state that not all UTF-8 characters are possible in XML.
In fact, those allowed are listed here:
http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char
so, I would still use a Validate event script but based on the XML specs' Character Range. Exactly as Mark McLaren did in Java.
This will permit to keep those special chars that are allowed. Your Managers will thank you.
Hope it helps.

Similar Messages

  • Handling special characters in XML

    Hi,
    I am using Oracle 10g 'XMLType' datatype to store XML files. Before storing I parse the XML document using Java Xerces Parser. If it parses successfuly, then I perform some business rule execution based on XML file which was parsed. So till this stage there is no problems. But when XML file contains some special characters like copy-paste of some description from MS-Word document into XML tags, then Xerces parser will parse such characters with out any exceptions, but while inserting XML document, Oracle database just throws exception saying unable to handle special characters.. So how to avoid such exceptions or silent such exceptions with any specific settings respect to XMLType datatype in 10g DB.
    Please advice!
    Arvind Patil - IN

    Monica--
    In XI 2.0, we've noticed a number of issues processing special characters, primarily caused by the version of JCO that we're running.  It sounds like SAP has spent some time in the past few months focusing on these errors, so make sure you're on the most recent patchlevels of all your middleware components, including any of the middleware libraries that BC uses. In XI, we had to update the 3 files that make up the RFC library and JCO library.  SDM couldn't update the libraries for us -- we had to manually move the files to the right place.
    Escaped XML characters like "&" """ """ were fixed as of JCO 2.0.10 (the current patchlevel on AIX/UNIX), the special character "'" is fixed in the next release, JCO 2.0.11, due out in a few weeks (hotfixes are available).  I don't know the equivalent versions on other platforms.  By default, XI 2.0 appears to have shipped with JCO 2.0.5.  I would expect many XI 3.0 users to also be affected.
    This may or may not apply to BC, because I don't know what BC uses to talk to SAP under the covers.
    --Dan King
    Capgemini

  • 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

  • Special characters in XML barcode content

    Hello,
    I made a barcoded form with a custom script that creates a custom XML as barcode content.
    The decoding happens well when the user write plain text in the text fields, but whenever it inputs some special characters (for XML syntax), like ",<,>,=,etc... the content of barcode it is decoded as:
    <barcode>
    <!CDATA[... true content ...]>
    </barcode>
    how can I handle this situation?
    I have to handle what the user writes or I have to change the decode activity?
    Thank you very much for your support!
    Fabio

    Steve,
    I have already encoded decode operation in UTF-8. In form level, because it is an acrobat form, no option to choose the encoding as in LC Designer. In further tests, if I change the extractToXML output to XDP instead of XFDF, then I will receive data rather than &# sequence. It is strange. Don't understand why XDP and XFDF would give out different encoding.
    Tim

  • Time-dependent Vendor Master & Handling Special Characters

    Hi,
    I need to extract time-dependent Vendor Master.
    1. The data source for <b>0VENDOR</b> does not have fields to hold the valid date range.
    2. Does the Master data in R/3 for Vendors will hold the valid date range?
    3. The text for <b>0VENDOR</b> provides time-dependent, but how to map the <b>valid from</b> and <b>valid to</b> fields?
    Handling Special Characters:
    We are trying to extract data from Legacy system via DB Connect. The item text field consists of special characters. Of course in BW customization we can specify all the special characters to consider. But the special character we observed is 'square' symbol i.e. 'new line character' in Oracle. We are updating this to an ODS object. When looked at error log, observed that green light for the number of records transferred and updated, but finally when it load into ODS object and activates popping up the error message saying 'could not recognize special character'.
    Please help me getting the 2 issues resolved.
    Thanks in advance.
    Regards,
    Sudhakar.

    Hi Everyone,
    Thanks for inputs on Special characters issue...
    Finally resolved with below piece of code in the start routine:
    DATA: FLAG,
          OFF TYPE I,
          LEN TYPE I VALUE 1,
          ALLOWED_CHAR(95) VALUE
    '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_=+ ' &
    'abcdefghijklmnopqrstuvwxyz:;<>,.?/|\{}[]"'''.
    CONSTANTS: C_CHAR VALUE '-'.
      LOOP AT DATA_PACKAGE WHERE NOT /BIC/ZI_DESC IS INITIAL .
        DO.
          IF DATA_PACKAGE-/BIC/ZI_DESC CN  ALLOWED_CHAR.
            REPLACE SECTION OFFSET SY-FDPOS LENGTH LEN OF
                    DATA_PACKAGE-/BIC/ZI_DESC WITH C_CHAR.
            FLAG = SPACE.
          ELSE.
            FLAG = 'X'.
          ENDIF.
          IF FLAG = 'X'.
            EXIT.
          ENDIF.
        ENDDO.
        MODIFY DATA_PACKAGE.
      ENDLOOP.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    I have seen the link sent by 'Eugene Khusainov' today. Thought putting my piece of code that may help others...
    Regards,
    Sudhakar.

  • To Handle Special Characters(Guideu0099 ) in MATMAS IDOC fields

    Need to handle special characters like Guide™, as an attached  superscript in MATMAS02/05 IDOC field . The field name is TDLINE in E1MTXLM segment.
    As a trial run when these special characters are pasted in the TDLINE field, it throws an error that "the input field contains prohibited characters"
    Please let me know if there is any workaround for this.

    hi
    good
    go through these links, i hope these ll help you to solve your problem.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CAGTFADMLO/CAGTFADMLO.pdf
    http://www.erphome.net/wdb/upload/forum14_f_2908.doc
    thanks
    mrutyun^

  • Handle special characters in the attribute name

    Hi,
    I am generating different view element in WD application dynamically. How to handle special characters other than '-/ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789'  for the attribute name dynamically?
    Thank you, in advance.
    Trupti

    Going with the obvious response - don't use them?
    if you're using dynamic code, there is no reason (other than debug support) to give your created elements any meaningful name.
    Just generate a GUID for each new element and use that.
    If you need to be able to later search for and update the element a simple lookup table of GUID to reference string should work reasonably well.
    Cheers,
    Chris

  • Regd: Handling of special characters in XML

    Hi ALL,
    i am using java mapping to conevrt IDOC XML to Flat file using SAX parse and then reading the whole content into a single Filed,the output of the java mapping is the input for graphical mapping .
    My problem is there may be some special characters  in the input IDOC. when ever these special characters come my java mapping is not able to Parse the IDOC.
    Please let me know how can handle this special characters.
    Thanks,
    hemanth.

    Hi ,
            Java has some characters reserved which is normally used to declare the Entity Name. To handle such kind of situations, you can replace these characters with these special characters, which get substituted automatically while parsing the XML file.
    Refer:
    http://www.javacommerce.com/displaypage.jsp?name=saxparser3.sql&id=18232
    I hope it helps.
    Regards,
    Anurag Gargh
    Edited by: Anurag Gargh on Aug 11, 2009 3:41 PM

  • How to Handle Special Characters in PI7.1

    Hi Team,
    I need to handle some special characters like <,>,& etc.. from WS Adapter to CRM in PI 7.1.
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9420 [original link is broken]
    By using the above blog i had implemented the Java Code as
    public void execute(InputStream in, OutputStream out){
    try{
    int read_data;
    while((read_data = in.read()) != -1){
    if (read_data == '&'){
    out.write("&amp;".getBytes());
    }else if (read_data == '>'){
    out.write("&gt;".getBytes());
    }else if (read_data == '<'){
    out.write("&lt;".getBytes());
    }else if (read_data == '/'){
    out.write("&frasl;".getBytes());
    }else if (read_data == '\''){
    out.write("&apos;".getBytes());
    else { out.write(read_data);
    out.flush();
    } catch (Exception e){}
    I had added this class file in Operational Mapping.
    It is working  if we have only one IF condition for & in while
    Any suggestion
    Thanks
    Sriram

    Hi Ramesh,
    Thanks for your inputs, I have tried your code but it is not working. The error message stays the same.
    Dear Stephane,
    To describe the error more, the requirement is the payload coming from source through WS Adapter consists of the special characters <, > , & which are basic sematics of XML syntax. I need PI to process this payload with special characters and successfully transfer it to target CRM system. I have created the Java class with code (ref: Blog 9420) as stated earlier and added this class to my existing Operation Mapping. I am expecting the java mapping to replace the special characters in payload like  < with "&gt;" . So as the case with the other characters >,&,'
    After activaton of my operation mapping, I triggered the test message with Soap UI client and I could able to get a successful mapping only When I put the logic for &ampersand symbol only. However when I am trying to add the logic for > or < or ' the mapping is failing . I am using UTF-8 encoding across the source and PI enviroments.
    Sample SOAP message :
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:abcabca.com">
       <soapenv:Header/>
       <soapenv:Body>
          <urn:MT_ABCDEFG_Req>
         <activity>
              <id/>
              <type>ZEMA</type>
              <actionType>C</actionType>
              <firewall>10000003</firewall>
              <subject>small &gt; &lt; attachment test</subject>
              <location/>
              <startDate>2010-07-08T10:53:31.000Z</startDate>
              <endDate>2010-07-08T10:53:31.000Z</endDate>
              <mainClient>1000319</mainClient>
              <mainContact>1000003</mainContact>
              <isConfidential>false</isConfidential>
              <summary/>
              <fullText>test body  - small.txt</fullText>
              <owner>1000021</owner>
              <from>ABCDEDF</from>
              <sendTo>emailaddress</sendTo>
              <copyTo/>
              <keywords/>
              <referenceId/>
              <createdBy>1000021</createdBy>
              <additionalContacts/>
              <additionalClients/>
              <additionalParticipants/>
              <status>A0008</status>
              <attachments>
                   <fileUrl>20100708110053-XXXXXXXXX</fileUrl>
                   <fileName>small.txt</fileName>
              </attachments>
              <attachments>
                   <fileUrl>20100708110053-XXXXXXXXX</fileUrl>
                   <fileName>EMail 2010-07-08.pdf</fileName>
              </attachments>
         </activity>
          </urn:MT_ABCDEFG_Req>
       </soapenv:Body>
    </soapenv:Envelope>
    Output on the SOAP UI  client for the above request:
    <!--see the documentation-->
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP:Body>
          <SOAP:Fault>
             <faultcode>SOAP:Server</faultcode>
             <faultstring>Server Error</faultstring>
             <detail>
                <s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">
                   <context>XIAdapter</context>
                   <code>ADAPTER.JAVA_EXCEPTION</code>
                   <text>com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessagingException: XIServer:NO_MAPPINGPROGRAM_FOUND:
         at com.sap.aii.adapter.soap.ejb.XISOAPAdapterBean.process(XISOAPAdapterBean.java:1160)
         at sun.reflect.GeneratedMethodAccessor342.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(
    What do you think where I am doing the wrong?
    Sriram

  • Special characters in XML (UTF8, escapes etc)

    This may seem like a simple problem, but I'm kind of a slow learner, so any help would be appreciated.
    I'm generating XML output via ordinary PL/SQL procedures i.e. not using the Oracle XSQL stuff. The data is built up into a XML document, which will be parsed within the server, then passed out to a client, probably as a CLOB.
    The data may contain "special" characters such as "<&>" and so on. Is there an existing function to translate these into an "XML-safe" form within the text, or do I need to trap and translate them individually?
    Also, the database may contain foreign characters e.g. Thai or Chinese. Will this be handled transparently by my XML-extraction stuff - which just selects the data from the tables and writes it to a CLOB inside XML tags - or do I have to do something to make sure the XML comes out in a safe UTF format?
    Thanks,
    Chris

    use & instead of &
    see http://www.w3.org/TR/2000/REC-xml-20001006#syntax

  • Is there any other way to handle special characters other than using CDATA?

    I have xerces parser with which i am trying to parse data having special characters. Special characters also include other ascii characters. I tried using CDATA Section but still the problem persists.
    It would be really helpful if anyone can help me in solving this problem.
    Error encountered :
    org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xf) was found in the CDATA section.
    The XML which I use contains junk characters also . Have a look at the following:
    <?xml version='1.0' encoding='UTF-8' ?>
    <IMAGE_RESPONSE xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='ImageResponse.xsd'>
    <IMG_TYPE>PNG</IMG_TYPE>
    <IMG_WIDTH>650</IMG_WIDTH>
    <IMG_HEIGHT>250</IMG_HEIGHT>
    <IMAGE_DATA>
    <IMGKEY>20020827:00000000:100000000010:02:</IMGKEY>
    <IMAGE_INFO>This is image info</IMAGE_INFO>
    <IMG_SOURCE>DCE_CIMS</IMG_SOURCE>
    <FRONT_IMG_FBW><![CDATA[�����&�J�Z�R��]]></FRONT_IMG_FBW>
    <FBW_ERROR>B</FBW_ERROR>
    <FRONT_IMG_FGS>C</FRONT_IMG_FGS>
    <FGS_ERROR>D</FGS_ERROR>
    <BACK_IMG_BBW>E</BACK_IMG_BBW>
    <BBW_ERROR>D</BBW_ERROR>
    <BACK_IMG_BGS>A</BACK_IMG_BGS>
    <BGS_ERROR>Unable to retrieve Back Gray-Scale image</BGS_ERROR>
    </IMAGE_DATA>
    </IMAGE_RESPONSE>

    java.net.URLEncoder.encode( text )
    I've found this to be a pretty easy way to handle invalid characters...

  • Special characters in XML structure when prepared using String

    Hi,
       I am preparing an XML structure using 'String'. I print the prepared XML structure in the server log. Issue is that I am seeing extra characters([[ and ]]) that I am not printing.
    Please let me know how to get rid of those.
    Code Excerpt
            String xmlHeader = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
            String lsb_xmlcon = xmlHeader;
            logger.info("ReqXMLString Process  1  --->" + lsb_xmlcon);
            lsb_xmlcon = lsb_xmlcon +("\n");
            logger.info("ReqXMLString Process  1.1  --->" + lsb_xmlcon);
            lsb_xmlcon = lsb_xmlcon +("<REQUEST>");
            lsb_xmlcon = lsb_xmlcon +("\n");
            logger.info("ReqXMLString Process  1.2  --->" + lsb_xmlcon);
    Log
    ReqXMLString Process  1  ---><?xml version="1.0" encoding="utf-8" ?>
    ReqXMLString Process  1.1  ---><?xml version="1.0" encoding="utf-8" ?>[[
    ReqXMLString Process  1.2  ---><?xml version="1.0" encoding="utf-8" ?>[[
    <REQUEST>
    Thanks,
    Message was edited by: 996913
    This issue is observed only while running the code in server, not from Jdev.
    When we append the additional tags without new line character, "\n", there are no extra characters being added. Also, in other case also. where we used "Marshaller" to prepare the XML, we have seen this issue.
    After we set the below property to false, we got rid of the extra characters.
                            jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);
    Apparently the insertion of new line when the code runs on server(Weblogic 10.3.6.0) is creating the issue.
    Please let me know if anyone has come across a similar scenario.
    Thanks,

    I am building this XML in a servlet so ,right, DOM does process XML (even though a valid HTML file can be loaded into a DOM object) but if you build XML using DOM then write the XML out using PrintWriter and Transformer objects this will cause the XML to print out in your browser. If you view source on this XML you will see that the DOM object has translated all special characters to there &xxxx; equivalent. For a example: when the string (I know "cool" java) gets loaded into a attribute using the DOM object then wrote back out it looks like (I know &xxx;cool&xxx; java) if you view the source in your browser. This is what it should do, but the DOM object is not change the � to the "&xxxxx;". This servlet is acting as a gateway between a Java API and a windows asp. The asp will call the servlet expecting to get XML back and load it directly into a DOM object. When the windows DOM object gets the xml that I am returning in this servlet is throws a exception "invalid character" because the � was not translated to &xxxx; like the other characters were. According to the book HTML 4 in 24 hours (and other references) the eacute; or #233; are how you say "�" in HTML or XML. How do you say it?

  • Special characters in xml

    Hello!
    I am trying to generate XML from database by using fnd_file package. Trouble is that application NLS_LANG is not set to UTF8 and it should stay so due to the fact that a lot of custom reports written using Oracle Reports may not display special characters correctly. So i have problem with characters like 'ö','ļ'.... Is there a way to set encoding for only XML output? Also in my last efforts the output XML for some reason is concatenating a strange square shaped character into the end of file. Has anybody seen similar problem and maybe solved it?
    Thanks
    Aleksei

    Refer to
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPSAX6.html

  • Special Characters in XML Publisher PDF Output

    Hi,
    I'm printing "Long Text" in report output in every line based on tab.
    Report output is having special characters like \n.
    I was using below to print in next line, any suggestions for removing \n.
    Below is what was happening:
    ===================
    RDF:
    =====
    lv_notes := replace(:CF_LONG_TEXT_DESC, chr(9), ' ') ;
    lv_notes1 := replace(lv_notes, chr(10), ' ') ;
    lv_notes2 := replace(lv_notes1, chr(13), ' ') ;
    XML
    ===
    <CF_LONG_TEXT_desc>
    Initial Billing Amount: $549,180.00 \n \n Computation: \n a) Estimated Number of Full-Time Students: 12,000 \n
    b) Estimated Number of Calendar Days: 113 \n
    c) Calendar Date (From - To): 1/18/2011 - 5/10/2011 \n
    d) Multiply by: $0.81 \n
    e) Estimated Total Costs: $1,098,360.00 \n
    f) Initial Billing Amount represents 50% of Estimated Total Costs. \n
    \n \n
    If you have questions about your invoice please contact Darud Akbar at (312) 681-2724.
    </CF_LONG_TEXT_desc>
    PDF Output
    ==========
    Initial Billing Amount: $549,180.00 \n \n Computation: \n a) Estimated Number of Full-Time Students: 12,000 \n
    b) Estimated Number of Calendar Days: 113 \n
    c) Calendar Date (From - To): 1/18/2011 - 5/10/2011 \n
    d) Multiply by: $0.81 \n
    e) Estimated Total Costs: $1,098,360.00 \n
    f) Initial Billing Amount represents 50% of Estimated Total Costs. \n
    \n \n
    If you have questions about your invoice please contact Darud Akbar at (312) 681-2724.
    Thanks.

    >
    Initial Value
    =======
    <?CF_LONG_TEXT_desc?>
    Changed to (Below gives me error)
    ========
    <?<xsl:value-of select="translate(CF_LONG_TEXT_desc,'\n','')"/>?>
    Changed to (Below doesn't fetch data)
    ========
    <xsl:value-of select="translate(CF_LONG_TEXT_desc,'\n','')"/>
    >
    must be in field as
    <xsl:value-of select="translate(CF_LONG_TEXT_desc,'\n','')"/>

  • How to handle special characters in metadata?

    I have an implementation in C# to call ACS webservices for a long time. Last week we realized that some special characters in metadata fields are making the package request to not work. Example characters: éë. The response from ACS contains E_ADEPT_DISTRIBUTOR_AUTH. If we remove the special character, the request works as expected.
    I know that characters are working in the jar application but we can't manage to make them work from our C# application.
    Any help is welcome.

    Doing a SHA1-HMAC is relatively simple and there are only two inputs, the key and the message.
    Since you say this works correctly with lower ascii characters, but not with Unicode characters then I would assume you have the key correct and the only thing that is different is the message.  Also since it works correctly with lower ascii characters then you have the  XML infoset serialization correct, so assuming a similiarly sized message (ie take one character and replace with a unicode character), then your problem is going to be in the character encoding.
    I would suggest some healthy paranoia about this, by verifying that the byte stream being hashed is indeed correctly UTF8 encoded by looking at the hex values  (breakpoint in the SHA1-HMAC code) and comparing to a UTF8 table such as  http://www.utf8-chartable.de.

Maybe you are looking for

  • Report in Answers using a SQL Query(Sub Query) URGENT

    HI Can anyone help me in creating a report in answers using this below query please. Its little Urgent. I have no idea how to implement this, please suggest. Select a.account_external_id, a.edc_external_id, c.ann_usg, indclassificationcode, g.usage_c

  • Iphone 3gs 4.3.3 internet problems

    After upgrading my iphone software to 4.3.3. my internet has stopped working. The message 'could not activate cellular data network because I am not subscribed to a cellular data service' comes up. How can I fix this?

  • I fell asleep with my charger last night and woke up this morning and had a 2nd degree burn thanks apple accessory

    I fell asleep with my charger last night and woke up with a 2nd degree burn thanks apple product

  • Partial Payments Against Invoice

    Hi I had AR Invoice with 100000 Inr amount, But I got Payment 50000 ,25,000,25000 in diffrent dates. If i made In coming payment first time . Ok that invoice displaying in incoming payments , Second time no Invoice displaying In incoming payment so N

  • Down load PO Header text

    Hi, My client is switching from SAP to Oracle. (It was taken over by a company which is using Oracle ERP) We are keeping all the MM and FI tables in a Data Portal. We need to take the data of  PO Header Texts also. How to down load the PO header text