Escaping illegal characters

Hi everyone,
I'm looking for some help on how to encode or "escape" illegal characters when writing strings (which contain the illegal characters) to XML. I'm basically creating an XML document which describes the structure of a JTree I have, but thus far, i've been using the replaceAll method to replace illegal characters in the strings with legal ones before converting to XML but i don't feel this is the best way to do it.
The first part of my export to xml method is:
public void export(DefaultMutableTreeNode rootNode) {
     try {
          textArea.append("Export: Exporting current tree... \n");
          final DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
          final Document document = builder.newDocument();
          try {
               GetTitle parser = new GetTitle();
               Reader reader = getReader(userI.getTarget().toString());
               new ParserDelegator().parse(reader, parser, true);
          catch (Exception e)     {
               System.out.println(e);
          String validRoot = docTitle.replaceAll("\\'", "_");
          final Element root = document.createElement(validRoot);
          root.setAttribute("node", "root");
The GetTitle method will simply get the title of the URL returned by userI.getTarget and store it in the docTitle variable. If there are any illegal characters in the validRoot string, then i get an error at the line:
final Element root = document.createElement(validRoot);
Could anyone suggest how i can encode any illegal characters in the validRoot string before i invoke the createElement method? Is there a parser I can use which already does this?
Any help will be much appreciated.
Thanks.

Correct me if I am wrong but the code:
Element foo = document.createElement("King's College");is essentially creating something corresponding to the XML <King's College></King's College> which is of course illegal characters in the XML tags
the solution that you went for:
Element foo = document.createElement("Root");
foo.setAttribute("Title", "King's College");is essentially equivalent to this XML <Root Title="King's College"></Root> which is a legal use of a tic mark, but still locates the data in the wrong place
Perhaps what you wanted was:
Element foo = document.createElement("Root");
foo.appendChild(document.createText("King's College"))which corresponds to the more natural XML <Root>King's College</Root>
By the way, I've never tried any of this and could have it all wrong. I just happened to be reading the XML tutorial and noticed their comments that the most common mistake in DOM style XML processing is to confuse the element nodes (which are just the tags) with the the data contained in the element which will always be in one or more text children of an element node.
see Document, Element, & Node in the API

Similar Messages

  • JAVA Regex Illegal Characters

    Hello - I am trying to find a list of all illegal characters which have to be escaped in JAVA Regex pattern matching but I cannot find a complete list.
    Also I understand that when doing the replaceall function that there is a special list of characters which can't be used for that as well, which also have to be escaped differently.
    If anyone has access to a full complete list as to when to escape and how I would greatly appreciated it!
    Thanks,
    Dan

    I also noticed this below link:
    http://java.sun.com/docs/books/tutorial/extra/regex/literals.html
    It said the following characters are meta-characters in regex API:
    ( [ { \ ^ $ | ) ? * + .
    But it also says the below:
    Note: In certain situations the special characters listed above will not be treated as metacharacters. You'll encounter this as you learn more about how regular expressions are constructed. You can, however, use this list to check whether or not a specific character will ever be considered a metacharacter. For example, the characters ! @ and # never carry a special meaning.
    Does anyone know if there would be any issues if I escaped when a character didn't need to be escaped?

  • 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??

  • Cannot insert Captivate Demo - filename contains illegal characters

    RoboHelp HTML v8 on XPpro. Captivate v4.
    I have created a simple Captivate v4 application demo and published to SWF.
    In my RHhtmlv8 project, I create a new topic, and choose Insert > Adobe Captivate Demo.
    The Insert dialog allows me to select my SWF file. It shows it in the Insert dialog and starts to play it.
    No matter what my SWF filename is (e.g. abc.swf, video1.swf, etc.), when I click the OK button in the Insert dialog, I get the error:
    'Unable to rename file, "abc.swf". The filename contains illegal characters.'
    I have searched the forums here and find no solution.
    How do you get support from this company? I went to the support link and it only showed Captivate as an option, even though I have a valid license for RH8 and have registered it. Yet - for 2 days now, I have not heard back from any support via that mechanism.
    Jeff

    Hi Jeff
    When you attempt to insert the demo, by chance do you still have the project open in the Captivate editor? If so, you likely need to close it there before attempting to insert into RoboHelp. I've seen all manner of weirdness with this.
    Another thing that seems to have happened recently that is worth looking at. When you Published your Captivate demo, did you Publish as AS2 or AS3? (For those that may wonder, AS refers to ActionScript. Similar to JavaScript and is the Flash programming language.)
    I've begun to notice issues with inserting Captivate content where I have published as AS3.
    Let us know... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • How to get the unicode escapes for characters outside a characterset

    Hi!
    I'm tryiing to edit into a RTF file and have been fairly successful so far. But living outside the U.S i need some characters outside ASCII. Those characters are supposed to be escaped as unicode-escapes, eg \u45. But I can't find a way to get the escapesequense for the unicode-characters that lives outside ASCII.
    I'm guessing that this is a very simple thing to do but I have not been lucky with google so far.
    So, how do I get the unicode escapes for characters outside a characterset?
    Thanks in advance
    Roland Carlsson

    I'm tryiing to edit into a RTF file and have been
    fairly successful so far. But living outside the U.S
    i need some characters outside ASCII. Those
    characters are supposed to be escaped as
    unicode-escapes, eg \u45. But I can't find a way to
    get the escapesequense for the unicode-characters
    that lives outside ASCII.You are asking about RTF and not java correct?
    As a guess....
    Unicode is 32 bit (presumably you are not using the newest one.) Thus it requires a 32 bit representation. Thus \u45 actually is the same as \u0045. Thus something like \u1e45 would probably work.

  • Insert 'illegal' characters into file name for print label?

    Hey all (Happy New Year)
    I actually see some people here who helped me with this originally so many years ago (hi 'x'). Any way, I'm using this .js file to annotate aerial imagery prior to printing, and I know just enough about scripting to make changes to the basic layout as needs arise - until now. A new rather anal retentive mgr doesn't like substitutions I've made for a few 'illegal' characters that windows doesn't allow in file names. For example, the file name used for the annotation is:
    001    0003    1in = 660ft    CFL 154_074    01-01014   503-013.tif
    But Mr. mgr doesn't like the in, the ft and the use of the _ instead of a period (.) so what I need is a modification that goes something like (and note I DO NOT CODE, so stop laughing) -
    "look for in and replace with ", look for ft and replace with ' and look for _ and replace with , " so the final annotation written to the image is:
    001    0003    1" = 660'    CFL 154.074    01-01014   503-013.tif
    My current .js is below, I'd really appreciate any assistance. Thanks! TLL
    // CREATE NEW CANVAS W/SPACE ON TOP
    var deltaW = 0; // add 'N' pixels to the width
    var deltaH = 150; // add 'N' pixels to the height
    var anchor = AnchorPosition.BOTTOMCENTER; // anchor point for canvas resize
    // SET FONT TYPE AND SIZE - use GetFontName.js to get exact name
    var fontName = "ArialMT";
    var fontSize = 18;
       // Check if a document is open
       if ( documents.length > 0 ) {
       var originalRulerUnits = preferences.rulerUnits;
       preferences.rulerUnits = Units.PIXELS;
       try {
         var docRef = activeDocument;
         docRef.resizeCanvas(docRef.width + deltaW, docRef.height + deltaH, anchor);
       // Create a text layer at the front
       var myLayerRef = docRef.artLayers.add();
       myLayerRef.kind = LayerKind.TEXT;
       myLayerRef.name = "Filename";
       var myTextRef = myLayerRef.textItem;
       // ADD FILE EXTENSION, change the n to y below
       var ShowExtension = "n";
       myTextRef.size = fontSize;
       myTextRef.font = fontName;
    // SET TEXT COLOR in RGB values
    var newColor = new SolidColor();
        newColor.rgb.red = 0;
        newColor.rgb.green = 0;
        newColor.rgb.blue = 0;
        myTextRef.color = newColor;
    // SET POSITION OF TEXT - PIXELS from left first, then from top.
    myTextRef.position = new Array( 30,110);
        // Set the Blend Mode of the Text Layer. The name must be in CAPITALS
        // ie change NORMAL to DIFFERENCE.
        myLayerRef.blendMode = BlendMode.NORMAL;
        // select opacity in percentage
        myLayerRef.opacity = 100;
        // The following code strips the extension and writes tha text layer.
        // fname = file name only
        //use extension if set
        if ( ShowExtension == "y" ) {
           fname = docRef.name;
         } else {
           di=(docRef.name).indexOf(".");
           fname = (docRef.name).substr(0, di);
         myTextRef.contents = fname;
         // docRef.flatten("n");
       } catch( e ) {
         // An error occurred. Restore ruler units, then propagate the error back
         // to the user
         preferences.rulerUnits = originalRulerUnits;
         throw e;
       // Everything went Ok. Restore ruler units
       preferences.rulerUnits = originalRulerUnits;
    }  else {
       alert( "You must have a document open to add the filename!" );

    I did some quick testing and here is what I have seen.
    I went into a cygwin shell and successfully did this:
    $ touch t\"est\'t.jpg
    $ ls t\"*
    t"est't.jpg
    This means that the underlying file system (NTFS) is able to correctly encode both the ' and " characters, at least as far as cygwin is concerned.
    However, from the Windows command line and Explorer point of view, the ' is OK but the " is not. The characters /\"*?<>:| can't be used in file names in Win. This means you can get the ' and . characters working but not the " character.
    From the js side, the code would look like:
    var x = "001    0003    1in = 660ft    CFL 154_074    01-01014   503-013.tif";
    var str = x.replace(/in/, '"').replace(/ft/, "'").replace(/_/, '.');
    alert(str);
    Which displays
    001    0003    1" = 660'    CFL 154.074    01-01014   503-013.tif
    The string stuff is easy, but while you can save a file with ' and . you can't use " via js. You can't even do it using the PS UI manually.
    I've tested and verified this. Let Mr. Mgr know that it is not possible to completely comply with his requests. Unless, of course, you upgrade to OS X : )
    -X

  • Illegal Characters Newly found in RH8 Project

    Hello,
    I need some help. I opened my RH7 project in RH8 for the first time, and received error messages complaining of file names having illegal characters and I am unable to import ANYTHING (Master pages, images, HTML files, etc.) because the items have illegal characters.
    Let me say that I've never had problems like this using RH7, in fact, I believe I initially created the project using RH6. In any case, I read a similar thread on this forum and decided that perhaps my Project Title and Project Name are invalid, since they both have apostrophes ("XX YY User's Guide"). So, I renamed them (using RH8, of course) to "XX YY User Guide" and now, things are VERY SCREWED UP. I've attached the dialog box that I now receive, it's cycling through every single topic in my project (~50 topics), and I'm getting tired of clicking OK.
    Is there any quick fix for this problem, or do I need to just start anew?
    Using: RH8, Windows XP.
    Images/Topics/Master Pages: Names have underscores, but I believe those are legal; never had an issue before migrating to RH8. No spaces or other illegal characters.
    Thank you...any help would be appreciated. I've never come across this problem before, even with the apostrophes in the Project Title/Name.

    Hi there
    In addition to what my esteemed colleague Peter offered, I'll add this.
    The image shows that you have an apostrophe present. Perhaps try renaming things so the apostrophe isn't present?
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • SQL Injections and XSS - Escaping Special Characters

    Hi, hope someone can help in regards to security and SQL Injections and XSS.
    We are using APEX 4.0.2 on Oracle 11.2.0.2.
    1. It seems the special characters we have entered into normal 'Text Items' 'Text Areas' etc are not being escaped (ie <,>,&, '). If I enter them into the field (ie Surname) they are saved as is into session state and the database - no escaping. Am I missing something such as an environment setting as I thought the "smart" oracle escaping rules would cater for this.
    Surely I don't have to manually do each of then.
    Just to confirm, am I looking in the correct places to assess if the characters are escaped or not - ie should they show as '&amp;&lt;&gt;' in session state and/or the database ?
    2. Also, for the Oracle procedures such as '‘wwv_flow.accept’ , ‘wwv_flow.show’ , 'wwv_flow_utilities.show_as_popup_calendar' - do these escape special characters. If not, then they must be vulnerable to SQL Injections attacks.
    Thx
    Nigel

    Recx Ltd wrote:
    Just to pitch in, escaping values internally (either in the database or session state) is extremely problematic. Data searches, string comparison, reporting and double escaping are all areas which suffer badly when you do this.
    Stripping characters on input can also cause problems if not considered within the context of the application. Names such as "O'Niel", statistical output such as "n < 300", fields containing deliberate HTML markup can be annoying to debug. In certain situations stripping is totally ineffective and may still lead to cross-site scripting.
    Apex applications that share the database with other applications will also be affected.
    The database should contain 'raw' unfettered data and output should be escaped properly, as Joel said, at render time. Either with Apex attributes or using PLSQL functions such as htf.escape_sc() as and when required.Do not needlessly resurrect old threads. After a couple of months watches expire and the original posters are not alerted to the presence of your follow-up.
    Shameless plug: If you are in the game of needing to produce secure Apex code, you should get in touch.This crosses the line into spam: it violates the OTN Terms of Use&mdash;see 6(j).
    Promotional posts like this are liable to be removed by the moderators.

  • Illegal characters in a Sharepoint list

    I'm trying to export an Access table to SP with 20 columns and 4,500 records and I keep geting this strange error "There was an error copying data to a Sharepoint list.  Cannot update.  Database or object is read-only. "  I can export to other formats OK, just not Sharepoint.
    According to a few posts, it appears my dilemma is related to illegal characters in the table itself.  Could the problem be something else?
    What characters are not allowed in a Sharepoint list? 
    Thanks.

    Thanks for reply.  I've tried moving to Sharepoint by plain old Export and the new "Publish to Access Services."  Get the error both ways.
    In an effort to isolate the problem, made a copy of my table and deleted all but the first ID column.  
    With only one column of the ID autonumber data, it exported successfully to Sharepoint.
    When I added a 2nd column titled "Prefix" and it worked.  Then I added 3rd column titled "LastName" containing various last names, the "read only" error occurs.
    I can provide a copy the 3 column table to anyone willing to take a look.  Something in the table causing trouble!
    Thanks

  • ADF Faces Components Demo - Illegal Characters error

    Hi ,
    I downloaded the ADF Faces Components Demo for version 11.1.2.3.0 from http://www.oracle.com/technetwork/developer-tools/adf/downloads/index.html . I tried following instructions :ADF Faces Components Demo Install Instructions
    This is getting downloaded as rcf-dvt-demo.zip. I renamed it to rcf-dvt-demo.war.
    Then I tried to create a project from this war... and got following error :
    The project file "C:\rcf-dvt-demo.war!\Project.jpr" is not valid. The file name may contain illegal characters, it may be too long, or permissions for this file or one of it's parent directories may be restricted.
    Please help . Am i downloading from correct location and following the correct instructions.
    Thanks,
    Rajdeep

    Good Catch Timo ... Lot of thanks.
    Still I will put down the silly mistake of overlooking the wizard.
    I was doing the correct thing - "create a new application and inside this application workspace you add a new 'project from war'." But mistake was .. First step of wizard it is project name and path,, and then second step is war location... and in hurry I was giving the project name and war location in first step.
    Thanks,
    Rajdeep

  • Filelist illegal characters

    using LabVIEW 7.1 I want to list and read several files in a certain directory.
    I want to recursively search and read these files starting  from a root-directory,
    however the directory-path at some point contains illegal characters, probably because the data is originating from Japan.
    Now the recursive filelisting is not able to look beyond that part of the directory.
    Windows displays these chars as 3 square's, and Labview displays them as 3 question marks, and generates a error.
    I could ofcourse manually rename the illegal chars, but since intent to analyse lots of these files, doing a manual rename would be too much work.
    Does anyone know a solution for this problem ?? 
    Thanks in advance ,
    René

    ramekers wrote:
    I tried the recursive file-lister of LabVIEW 8.5 (on windows2000) and this gave me the same errors,
    not being able to read past these characters.
    Now I am trying to locate a "freeware" program to remove these characters recursively from the names,
    leaving the rest intact. Couldn't find anything yet ...
    René
    You could experiment with the command line in Windows. Not sure if the command line will support such file names at all but if it goes bad there, then you are indeed in deep trouble. Try to start a command line and do a dir command in such a directory. Then try to do a rename on such a file. It might work.
    I doubt there is a GUI application that does specifically do this task, so you may have to resort to a batch file script doing it on the command line if the above experiment shows you that this is possible at all.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Illegal characters in SOAP message

    Hi
    I consistently get the following in the server log (I'm using JAX-WS 2.1):
    Couldn't create SOAP message due to exception: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
    Message: Content is not allowed in prolog.
    com.sun.xml.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
    Message: Content is not allowed in prolog.
    at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:292)
    at com.sun.xml.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:276)
    at com.sun.xml.ws.transport.http.HttpAdapter.access$500(HttpAdapter.java:93)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:432)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:176)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    Caused by: com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
    Message: Content is not allowed in prolog.
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.wrapException(XMLStreamReaderUtil.java:267)
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:95)
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextContent(XMLStreamReaderUtil.java:110)
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextElementContent(XMLStreamReaderUtil.java:100)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:174)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:296)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:128)
    at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:287)
    ... 52 more
    Is there any way to avoid having to parse illegal characters in the HTTP SOAP request? E.g. by stripping off BOM (byte order mark) characters prior to conversion to SOAP?
    Help much appreciated,
    Lance

    Hi lance,
    Hi
    I consistently get the following in the server log (I'm using JAX-WS 2.1):
    Couldn't create SOAP message due to exception: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
    Message: Content is not allowed in prolog.
    com.sun.xml.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
    Message: Content is not allowed in prolog.
    at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:292)
    at com.sun.xml.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:276)
    at com.sun.xml.ws.transport.http.HttpAdapter.access$500(HttpAdapter.java:93)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:432)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:176)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    Caused by: com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
    Message: Content is not allowed in prolog.
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.wrapException(XMLStreamReaderUtil.java:267)
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:95)
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextContent(XMLStreamReaderUtil.java:110)
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextElementContent(XMLStreamReaderUtil.java:100)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:174)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:296)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:128)
    at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:287)
    ... 52 more
    [Look here|http://forums.java.net/jive/message.jspa?messageID=194629]
    seems trivial !!
    the same msg comes up for various issues related to SOAP requests...
    Is there any way to avoid having to parse illegal characters in the HTTP SOAP request? E.g. by stripping off BOM (byte order mark) characters prior to conversion to SOAP?
    Not sure if there is ?
    You have to ensure no illegal characters exists in the SOAP request (Rather than looking for a work around) ; )
    Help much appreciated,
    Lance

  • Illegal characters in key fields

    Hi,
    What are the illegal characters for key fields in the database for SAP ME?
    Br,
    Johan Nordebrink

    Hello Johan,
    Please refer to SAP Note #1363812.
    Regards,
    Alex.

  • Escape Latin Characters

    I need to escape latin characters in an xml doc. Example: "é" is escaped to "&amp;#233;". I thought I could use the ASCII function, but SELECT ASCII('é') FROM DUAL in Oracle gives me 50089.
    I coded this as a quick fix, but I'm sure there's a better way.
    FUNCTION escape_latin(p_str IN VARCHAR2) RETURN VARCHAR2 IS
    v_str VARCHAR2(3000) := p_str;
    BEGIN
    v_str := REPLACE(v_str, 'À', '&amp;#192;');
    v_str := REPLACE(v_str, 'Á', '&amp;#193;');
    v_str := REPLACE(v_str, 'Â', '&amp;#194;');
    v_str := REPLACE(v_str, 'Ã', '&amp;#195;');
    v_str := REPLACE(v_str, 'Ä', '&amp;#196;');
    v_str := REPLACE(v_str, 'Å', '&amp;#197;');
    v_str := REPLACE(v_str, 'Æ', '&amp;#198;');
    v_str := REPLACE(v_str, 'Ç', '&amp;#199;');
    v_str := REPLACE(v_str, 'È', '&amp;#200;');
    v_str := REPLACE(v_str, 'É', '&amp;#201;');
    v_str := REPLACE(v_str, 'Ê', '&amp;#202;');
    v_str := REPLACE(v_str, 'Ë', '&amp;#203;');
    v_str := REPLACE(v_str, 'Ì', '&amp;#204;');
    v_str := REPLACE(v_str, 'Í', '&amp;#205;');
    v_str := REPLACE(v_str, 'Î', '&amp;#206;');
    v_str := REPLACE(v_str, 'Ï', '&amp;#207;');
    v_str := REPLACE(v_str, 'Ð', '&amp;#208;');
    v_str := REPLACE(v_str, 'Ñ', '&amp;#209;');
    v_str := REPLACE(v_str, 'Ò', '&amp;#210;');
    v_str := REPLACE(v_str, 'Ó', '&amp;#211;');
    v_str := REPLACE(v_str, 'Ô', '&amp;#212;');
    v_str := REPLACE(v_str, 'Õ', '&amp;#213;');
    v_str := REPLACE(v_str, 'Ö', '&amp;#214;');
    v_str := REPLACE(v_str, '×', '&amp;#215;');
    v_str := REPLACE(v_str, 'Ø', '&amp;#216;');
    v_str := REPLACE(v_str, 'Ù', '&amp;#217;');
    v_str := REPLACE(v_str, 'Ú', '&amp;#218;');
    v_str := REPLACE(v_str, 'Û', '&amp;#219;');
    v_str := REPLACE(v_str, 'Ü', '&amp;#220;');
    v_str := REPLACE(v_str, 'Ý', '&amp;#221;');
    v_str := REPLACE(v_str, 'Þ', '&amp;#222;');
    v_str := REPLACE(v_str, 'ß', '&amp;#223;');
    v_str := REPLACE(v_str, 'à', '&amp;#224;');
    v_str := REPLACE(v_str, 'á', '&amp;#225;');
    v_str := REPLACE(v_str, 'â', '&amp;#226;');
    v_str := REPLACE(v_str, 'ã', '&amp;#227;');
    v_str := REPLACE(v_str, 'ä', '&amp;#228;');
    v_str := REPLACE(v_str, 'å', '&amp;#229;');
    v_str := REPLACE(v_str, 'æ', '&amp;#230;');
    v_str := REPLACE(v_str, 'ç', '&amp;#231;');
    v_str := REPLACE(v_str, 'è', '&amp;#232;');
    v_str := REPLACE(v_str, 'é', '&amp;#233;');
    v_str := REPLACE(v_str, 'ê', '&amp;#234;');
    v_str := REPLACE(v_str, 'ë', '&amp;#235;');
    v_str := REPLACE(v_str, 'ì', '&amp;#236;');
    v_str := REPLACE(v_str, 'í', '&amp;#237;');
    v_str := REPLACE(v_str, 'î', '&amp;#238;');
    v_str := REPLACE(v_str, 'ï', '&amp;#239;');
    v_str := REPLACE(v_str, 'ð', '&amp;#240;');
    v_str := REPLACE(v_str, 'ñ', '&amp;#241;');
    v_str := REPLACE(v_str, 'ò', '&amp;#242;');
    v_str := REPLACE(v_str, 'ó', '&amp;#243;');
    v_str := REPLACE(v_str, 'ô', '&amp;#244;');
    v_str := REPLACE(v_str, 'õ', '&amp;#245;');
    v_str := REPLACE(v_str, 'ö', '&amp;#246;');
    v_str := REPLACE(v_str, '÷', '&amp;#247;');
    v_str := REPLACE(v_str, 'ø', '&amp;#248;');
    v_str := REPLACE(v_str, 'ù', '&amp;#249;');
    v_str := REPLACE(v_str, 'ú', '&amp;#250;');
    v_str := REPLACE(v_str, 'û', '&amp;#251;');
    v_str := REPLACE(v_str, 'ü', '&amp;#252;');
    v_str := REPLACE(v_str, 'ý', '&amp;#253;');
    v_str := REPLACE(v_str, 'þ', '&amp;#254;');
    v_str := REPLACE(v_str, 'ÿ', '&amp;#255;');
    RETURN v_str;
    END escape_latin;
    Is there a built in function I can use to make this cleaner and shorter?
    Thanks for the help!

    I thought about it, but it will replace not just characters with code >= 192 but characters with code >= 128 (plus \ character).Which should be absolutely ok, since otherwise you may depend on the environment:
    C:\>echo %NLS_LANG%
    AMERICAN_AMERICA.US7ASCII
    C:\>sqlplus michael@oracle
    SQL*Plus: Release 11.1.0.7.0 - Production on Thu Oct 22 20:34:54 2009
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    SQL>select xmltype('<?xml version="1.0" encoding="WE8MSWIN1252" ?><e>' || chr(150) || '</e>') from dual;
    XMLTYPE('<?XMLVERSION="1.0"ENCODING="WE8MSWIN1252"?><E>'||CHR(150)||'</E>')
    <?xml version="1.0" encoding="US-ASCII"?>
    <e>?</e>
    SQL>exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, Oracle Label Security, OLAP, Data Mining
    and Real Application Testing options
    C:\>set NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
    C:\>sqlplus michael@oracle
    SQL*Plus: Release 11.1.0.7.0 - Production on Thu Oct 22 20:35:17 2009
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    SQL>select xmltype('<?xml version="1.0" encoding="WE8MSWIN1252" ?><e>' || chr(150) || '</e>') from dual;
    XMLTYPE('<?XMLVERSION="1.0"ENCODING="WE8MSWIN1252"?><E>'||CHR(150)||'</E>')
    <?xml version="1.0" encoding="WE8MSWIN1252" ?><e>û</e>
    SQL>

  • Illegal characters in xml configuration files

    Hi,
    We are storing user configuration details in the server.xml for use with startup classes.
    We are experiencing problems where the values of this configuration information contain characters such as < & > and we receive the following error:
    07/05/17 15:05:35 Start process
    Error initializing server: Fatal error at line 92 offset 20 in file:/home/orabpel/OraHome_2/j2ee/OC4J_BPEL
    /config/server.xml: The content of elements must consist of well-formed character data or markup.I was hoping the problem could be resolved by enclosing the values of nodes which contain illegal characters with <![CDATA[]]>, but this has not resolved the problem.
    Is there any way we can achieve this?
    The reason we are storing these characters in the server.xml is because they represent obfuscated passwords in rot39 format. Perhaps there is a more suitable obfuscation/encryption format that is very simple to implement?
    Thanks
    Toby

    Actually, specifing the values as CDATA does work, but i had a typo that was causing it to fail.
    Toby

Maybe you are looking for

  • Error in g/l account creation

    Hi all, While i'm creating g/l account centrally system asking group account number in type/description data tab, where can i maintain group account number? and without giving this i unable to create g/l accounts. If i'm giving any value in this fiel

  • IPhone 3gs - 4.3.5

    I am fed up of my text messages coming through late and my phone reverting to 2G even though there is a DECENT 3G signal present. I have to go into airplane mode and back to re-connect to 3G Is this down to the iPhone or to the network ? Anyone got a

  • Problems with a document

    I am trying to open an Excel document with Apple Works but when the Mac Link Plus is translating it the document doesn't respond. I have to force the program out. Where is the error? I need help please.

  • CF9 and Scheduled Tasks

    We recently migrated our web site to a new server running CF9 (64-bit, Windows 2003) and I had several scheduled tasks that run on a night basis. So I set up the tasks in the CF Administrator but when try and run them via the administrator I get an e

  • I have mac 10.6.8, I can't download Iwork 09? What to do?

    Hi! My name is Fanny Chase. I recently change my system to mac book 10.6.8 and I lost pretty much all my applications I had before. I lost Iwork, Iphoto and more. I would like to dowload the Iwork 09 because the version I have is too old. I need the