Parsing Special Characters

Hi,
I'm parsing XML files using a DOM parser but I'm having trouble parsing superscripts. If a XML tag contains a value like 6 cm� the whole parser bombs. It reads the file then throws an error that says:
org.xml.sax.SAXException: Fatal Error: URI=file:D:/Project1/DomParser/d2kfw0ya.xml Line=543: The element type "Observation_Value" must be terminated by the matching end-tag "</Observation_Value>".
I tried using a replaceAll statement, strB.replaceAll("&#178", "cm2");, but that didn't work either.
If I take out the superscript then everything works fine. I can't change how the XML is created because it is generated at another machineAny ideas on how to get around this?
Thanks,
-Matt

Mmm, I just read your original post that said you aren't the one producing the XML. It is unfortunately common for people to produce XML files that don't declare their encodings correctly. In that case there are two things you need to do:
1. Harass the producer of the XML to produce well-formed XML.
And when that doesn't work,
2. Write a small preprocessing program that fixes the encoding. Read the file in using an InputStreamReader that uses the actual encoding of the file, and rewrite it with an OutputStreamWriter that uses the encoding declared in the file, or UTF-8 if there is no encoding declaration.

Similar Messages

  • Error in parsing special characters

    We are getting the following error when we parse a clob with special characters like \226(- special dash char), \231(the "TM"-Trademark logo), \256(the "R"-Registered logo )
    "Invalid char in text" when the parser is loaded in the db.
    But when we tried to parse this xml file as a file input (parser is now outside the db), it parses the file fine and inserts the data into the db.
    We are wondering if there is a difference in parser parsing special characters between inside and outside the db.
    We are running xml parser version 2.0.2.7 and if this is a bug and being fixed in later version, is there a workaround for this version

    Please try our latest 9.0.1 version

  • Parsing Special Characters in XML

    Hi,
    I have an incoming XML snippet that has the special characters already escaped.
    If the Title is something like kkkkk ?& [] ]]> XML comes back escaped for & and >
    <title><kkkkk ? & [] ]]></title>
    Now I would like parse this ESCAPED Title correctly that should result in
    <![CDATA[kkkkk ?& [] ]]>]]>
    BUT INSTEAD I just get
    <![CDATA[>]]>
    What is it that I am missing?
    Thank you so much.
    Meena

    A CDATA section can not contain the string "]]>" because that string is used to identify the end of CDATA section. Try removing the additional "]]>" and try if it works good for the rest of the data within the CDATA section.

  • Bpel parsing issue with special characters...

    Hi All,
    We are integrating Oracle Sales Order information with OTM as Order Releases.
    For this we are sending the Sales Order in the form of clob from the procedure to the Bpel process.
    1. A PL/SQL procedure would send the Sales order XML as a CLOB.
    2.In the BPEL process , we are performing ora:parseXML() function on the clob obtained.
    3.A patch was installed on the BPEL SOA server:
    10.1.3.3.1 MLR#8, Patch#6906880 which was supposed to handle all the parsing activities at run time.
    4. But when ever any special character viz..; #,UNIT¿S etc the BPEL process is failing with a fault string due to Parsing error.
    5. Could you please provide us a workaround for solving this issue ASAP with all the special characters.
    I have provided a sample xml tag due to which the parsing is failing in the bpel process. here it is failing because it is not able to parse : UNIT¿S successfully...
    <SHIPPING_INSTRUCTIONS>
    **San Dieg UNIT¿S contact name is Jenny Haden 858-609-1170** 12/12/08
    **Updated Contact is ASHTON REYES 72-696-1525, hours are 830-5 only, N/S. Millyz DELIVERY
    CONTACT: ELLEN HILGER @ 248-932-9000: LINE 4.1 -TRIAL CONVERSION FROM ORDER # 25766204
    </SHIPPING_INSTRUCTIONS>
    is there some other bpel patch or some other workaround using which whatever input value comes in , the bpel is able
    to successully parse that through..
    we are stuck with this special character parsing issue as of now and go live is very near ...your help/inputs would be highly appreciated
    thanks

    Guys,
    I am new to OTM and SOA/BPEL architecture.
    Could you please suggest me in detail as how to integrate OTM with outside world using BPEL.
    Thanks,
    Kamleshwar

  • XML Parsing Base64 Content - Special Characters Umlaut etc

    Hello!
    I am currently parsing an XML file which has it's content encoded in Base64. My application parses the XML file (from a provider) and pass on the content to a GUI where the user can change the value of the nodes and store the same back in a new XML (which is then to be sent back to the provider). The Application uses only "UTF-8" . I am currently using the Base64 class provided at http://iharder.net/base64
    The problem I have is that the special characters like �, � etc, are being depicted as (?) i.e. unreadable. Only when I control the decoding process i.e. String resoolt = new String (result.getBytes(), "UTF-8") do I get the correct content, and the same can be posted on the GUI.
    The application produces an XML file (The application in question is a translation app), which when re-opened in the application for retranslation has the same problem... it is shown with teh special characters with (?).
    After a lot of debugging I found that the XML produced by the application does not need the forcing of content into UTF-8 using the code above, it is read automatically correctly (with all the content correct), but due to the coding I have done... String resoolt = new String (result.getBytes(), "UTF-8") the nodes are decoded with the earlier problem umlauts et al missing.
    Now I could use a test to differntiate between the two cases XML from the provider or the XML which is produced by my own app, and doesn"t work on the Provider and treat them differently, but I don't want this solution since the XML which my app produces is not accepted as input at the providers.
    So my query.. what is the best way to go about it now... I am quite stymied >(
    Thanks!
    Tim

    Amazingly enough some other user has the identical problem to yours and has expressed it in exactly the same words. Has the same name as you too.
    http://forum.java.sun.com/thread.jspa?threadID=606929&tstart=0
    (Cross-posting is frowned on here.)

  • FindNode returning Null And XML Not Accepting Special Characters

    Hi All,
    i am trying the get the attribute value in the element "ns4:InfoCFDi" using FindNode method, but the method is returning NULL. I used the same code for other sample as well and was successfull. but for this specific XML file(which is below) I am getting a Null.
    i can get till S:Body, but when i try to use FindNode for ":Body/s4:ResponseGeneraCFDi" I get Null value.
    And I used "S:Body/*[local-name()=" | "ns4:ResponseGeneraCFDi" | "]";
    as mentioned in other post but still no success.
    ==>I Have one more question relating to special characters. I need to use characters such as - ó in my XML to read as well as write. When I try to read i am getting XML parse error and when writing, i cannot open the file properly.
    Your help is much appreciated.
    My code is here:
    Local XmlDoc &inXMLDoc, &reqxmldoc;
    Local XmlNode &RecordNode;
    &inXMLDoc = CreateXmlDoc();
    &ret = &inXMLDoc.ParseXmlFromURL("D:\Agnel\Mexico Debit Memo\REALRESPONSE.xml");
    If &ret Then
    &RecordNode = &inXMLDoc.DocumentElement.FindNode("" );
    If &RecordNode.IsNull Then
    Warning MsgGet(0, 0, "Agnel FindNode not found.");
    rem MessageBox(0, "", 0, 0, "FindNode not found");
    Else
    &qrValue = &RecordNode.GetAttributeValue("asignaFolio ");
    Warning MsgGet(0, 0, "asignaFolio." | &qrValue);
    End-If;
    Else
    Warning MsgGet(0, 0, "Error. ParseXmlString");
    End-If;
    XML File:
    - <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    - <S:Body>
    - <ns4:ResponseGeneraCFDi xmlns="http://www.xxl.com/ns/xsd/bf/rxx/52" xmlns:ns2="http://www.sat.gob.mx/cfd/3" xmlns:ns3="http://www.xx/ns/bf/conector/1&quo t; xmlns:ns4="http://www.xx/ns/xsd/bfxx/xx/32&qu ot; xmlns:ns5="http://www.xxcom/ns/xsd/bf/xxxxx&q uot; xmlns:ns6="http://wwwxx.com/ns/referenceID/v1">
    - <ns3:Result version="1">
    <ns3:Message message="Proceso realizado con exito." code="0" />
    </ns3:Result>
    - <ns4:InfoCFDi noCertificadoSAT="20001000000100003992" refId="STORFAC20121022085611" fechaTimbrado="2012-10-22T08:56:45" qr=" "
    uuid="a37a7d92-a17e-49f4-8e4d-51c983587acb" version="3.2" tipo="XML" archivo="xxx" sello="B8WjuhYLouSZJ6LU2EjxZ0a4IKyIENZNBx4Lb4 jkcAk6wA+EM477yz91/iDdsON0jm8xibBfom5hvHsH7ZK1ps3NnAXWr1LW 7ctmGsvYKAMvkCx/yOVzJTKFM2hN+OqCTE0WVfgv690vVy2CDQWKlMxbK+3idwG4t OKCMelrN9c=" fecha="2012-10-22T08:56:44" folio="281" serie="IICC">
    <InfoEspecial valor="Este documento es una representacin impresa de un CFDI." atributo="leyendaImpresion" />
    <InfoEspecial valor="||1.0|a37a7d92-a17e-49f4-8e4d-51c983587acb|2012-10-22T08:56:45|B8WjuhYLouSZJ6LU2EjxZ0a4IKyIENZNBx4Lb4 jkcAk6wA+EM477yz91/iDdsON0jm8xibBfom5hvHsH7ZK1ps3NnAXWr1LW 7ctmGsvYKAMvkCx/yOVzJTKFM2hN+OqCTE0WVfgv690vVy2CDQWKlMxbK+3idwG4t OKCMelrN9c=|20001000000100003992||" atributo="cadenaOriginal" />
    <InfoEspecial valor="Doscientos dieciocho mil cuatrocientos setenta y cinco pesos 00/100 M.N." atributo="totalConLetra" />
    </ns4:InfoCFDi>
    </ns4:ResponseGeneraCFDi>
    </S:Body>
    </S:Envelope>
    TIA

    First of all you have to supply a value you want to search for and this has to be the complete path to the value. You're saying you already tried that, but can you paste the code which you used for that? I don't see the path mentioned in the code you posted.
    *FindNode*
    Syntax
    FindNode(Path)
    Description
    Use the FindNode method to return a reference to an XmlNode.
    The path is specified as the list of tag names, to the node that you want to find, each separated by a slash (/).
    Parameters
    Path
    Specify the tag names up to and including the name of the node that you want returned, starting with a slash and each separated by a slash (/). This is known as the XPath query language.>
    Another option would be this snippet of code:
    &InfoCFDiArray = GetElementsByTagName("ns4:InfoCFDi");
    &InfoCFDiNode = &InfoCFDiArray [1];
    &attValue = &InfoCFDiNode.GetAttributeValue("noCertificadoSAT")
    Warning(&attValue);
    It creates an array of XML Nodes which match the name "ns4:InfoCFDi". Since there's only one in the XML it's safe to assume it will be the one and only node in the array. I've assigned that node to the variable &InfoCFDiNode and use that to retrieve the attribute "noCertificadoSAT" value. The warning message should display the value supplied there.
    Concering the special characters; you will have to change the encoding of the XML. Peoplecode sets this to UTF-8 by default, but doesn't include this in the header. There's a little hack for that somewhere on the web, I'll see if I can find it.

  • HTML special characters in form input

    In my site I store form input in my database. Before I store
    the data, I parse out smart quotes, en dashes, and other extended
    special characters and convert them into HTHML quivalents such as
    &#8217;
    All is well and good until the user goes to edit their info.
    In my form these characters show up in my <input> tags as
    their long-winded HTML equivalents, such as &#8217; instead of
    a smart apostrophe.
    Is there any way to convert these back to the special
    characters from the HTML on the form input text fields so that
    users can edit them without being confused?
    Thanks.

    Hmmm, well I ran the MX 6.1 updater and installed the two hot
    fixes that had to do with null pointer exceptions and it still does
    not work.
    Here is the detailed error I'm getting, if it helps. Any more
    ideas? Thanks again for the help, I'm really stuck on this one...
    The system has attempted to use an undefined value, which
    usually indicates a programming error, either in your code or some
    system code.
    Null Pointers are another name for undefined values.
    The error occurred in C:\Inetpub\wwwroot\store\index.cfm:
    line 1
    1 : <cfquery name="getBooks" datasource="#dsn#">
    2 : SELECT *
    3 : FROM products
    Please try the following:
    * Check the ColdFusion documentation to verify that you are
    using the correct syntax.
    * Search the Knowledge Base to find a solution to your
    problem.
    Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
    rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
    Remote Address 127.0.0.1
    Referrer
    Date/Time 09-Oct-07 02:20 PM
    Stack Trace
    at
    cfindex2ecfm1770128649.runPage(C:\Inetpub\wwwroot\store\index.cfm:1)
    java.lang.NullPointerException
    at coldfusion.sql.QueryTable.populate(QueryTable.java:260)
    at coldfusion.sql.QueryTable.populate(QueryTable.java:159)
    at coldfusion.sql.Executive.getRowSet(Executive.java:505)
    at coldfusion.sql.Executive.executeQuery(Executive.java:974)
    at coldfusion.sql.Executive.executeQuery(Executive.java:886)
    at coldfusion.sql.SqlImpl.execute(SqlImpl.java:236)
    at
    coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:447)
    at
    cfindex2ecfm1770128649.runPage(C:\Inetpub\wwwroot\store\index.cfm:1)
    at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:147)
    at
    coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:357)
    at
    coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:62)
    at
    coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:107)
    at coldfusion.filter.PathFilter.invoke(PathFilter.java:80)
    at
    coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:24)
    at
    coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:47)
    at
    coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:52)
    at
    coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:2 8)
    at
    coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:35)
    at
    coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:43)
    at
    coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
    at coldfusion.CfmServlet.service(CfmServlet.java:105)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:249)
    at
    jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
    at
    jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:192)
    at
    jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348)
    at
    jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
    at
    jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

  • How to enter Special Characters in JSP

    Is there any way to enter special characters such as ºC ? i am using J2EE and Oracle 9 i.
    When i try to enter 2ºC after updating the datbase it is converted to 2ºC. All special characters are prefixed with Â. Pls suggest some better way ..

    This normally relates to your unicode set you are using. For example the database is using a different way of storing data than how it's being parsed.
    One quick/dirty fix is to save the data using HTML encoded elements, for example &copy;
    You will also find that &pound; £ will cause problems. If your web app is only for one country then I would not worry about it however if you need multi language support then you need to read up a little
    [Unicode Support|http://www.alanwood.net/unicode/]

  • 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

  • A problem with regex and special characters

    Hello,
    I am using regex in my application but i have a problem with special characters. Here is the explanation of what i am doing:
    I have a certain piece of text that i want to parse and replace every occurrence of a given word with some sort of a tag which have the word found inside it.
    so that: go Going Go to gOschool by bus and to learn and to play GO Go
    and i need to replace the word "go" (case insensitive and only at word boundaries) should be:
    *<start>go<end> Going <start>Go<end> to gOschool by bus and to learn and to play <start>GO<end> <start>Go<end>*
    Consider the following code and call the method with the parameter"go?"
    The Matcher finds a weird match at the word "G?oing" with only the letter G !!!
    It also ignores the "?" in the pattern completely.
    Any clue of what is happening i would be very grateful...
    private static String replaceMatches(String strToFind)
            String resultArticle="";
            String article = " "+"go? G?oing Go? to gOschool by bus and to learn and to play GO? Go?*"+" ";
            strToFind = "\\b"+ strToFind +"\\b";
            String linkPart1= "<start>";
            String linkPart2 = "<end>";
            Pattern p = null;
            try{
                p=Pattern.compile(strToFind, Pattern.CASE_INSENSITIVE);
            Matcher m = p.matcher(article);
            String[] res = p.split(article);
            int i=0;
            //System.out.println("result of split: "+res.length );
            while(m.find())
                resultArticle+=(res[i]+" ");
                resultArticle+=linkPart1;
                resultArticle+=m.group().trim();
                resultArticle+=(linkPart2+" ");
                i++;
            if(i<res.length)
                resultArticle+=res;
    //System.out.println("result of match: " + i);
    System.out.println(article);
    //System.out.println(resultArticle.trim()+scripts);
    catch(PatternSyntaxException ex){}
    return resultArticle.trim();
    }Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    tarek.mamdouh wrote:
    because split will not work when trying to replace the first word if i don't append a space at the beginning.Split doesn't work anyway. And my question wasn't why do you add spaces (which you really don't need to do), but why do you do them with " " + "go" rather than just " go"
    replaceAll will replace all the occurrences in the text with only one word. without taking into consideration the case of the word i need to replace.No.
    >
    If i use replacaAll(article, strToFind) the output will be:
    <start>go?<end> G?oing <start>go?<end> to gOschool by bus and to learn and to play <start>go?<end> <start>go?<end>No. I showed you the actual output of an actual replaceAll.
    which is not what i want as i need to keep the case of the words i am replacingThe replaceAll I showed you does that.
    Please study the examples given and read the docs carefully rather than making claims based on inaccurate guesses.

  • Special characters in XML document

    I have a Flash file saved as version 8 with the following script calling an xml file:
    //init TextArea component
    myText.html = true;
    myText.wordWrap = false;
    myText.multiline = false;
    myText.label.condenseWhite=true;
    //load in XML
    xml = new XML();
    xml.ignoreWhite = true;
    xml.onLoad = function(success){
        if(success){
            myText.text = xml;
    xml.load("titletext.xml");
    My xml file contains the following:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <![CDATA[Smith's dog & cat are "crazy"]]>
    When posted online my flash file displays the encoding tag in the xml file.
    AND the apostrophe, ampersand and quote marks display as html code instead of the actual character.
    I can take the encoding tag out of the xml file but my characters still don't display correctly.
    My dynamic text field in flash (myText) does have special characters embedded, plus I have them entered manually in the field for 'include these characters'.
    Does anyone have suggestions for me?
    You can view this test file at http://wilddezign.com/preshomes_name2.html
    TIA

    Perhaps you need a slightly different approach to loading the XML. Instead of loading the entire XML file, what if you loaded only the child you were looking for? This is what I usually do:
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    xml.load("some.xml");
    xml.onLoad = parse;
    function parse(success){
    if (success){
      root = xml.firstChild;
      _global.numberItems = root.attributes.items;
      itemNode = root.firstChild;
      var i:Number = 0;
      while(itemNode != null){
         myText.text = itemNode.attributes.description;
         itemNode = itemNode.nextSibling;
         i++;
      else {
      trace("XML Bad!!");
    And your XML would be structured like this:
    <?xml version="1.0" encoding="utf-8"?>
    <sample>
    <item description="This is the text that I want to appear on this MC!" />
    </sample>

  • 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

  • Use special characters in a DTD

    Hello,
    I created a DTD amd want to use some special characters in this DTD. E.G. I want to define:
    <!ATTLIST element value (val1|val 2|<val3>|%val4) #REQUIRED>
    I tried the following but the parser does not accept without errors:
    <!ATTLIST element value (val1|val&#xxx;2|&#yyy;val3&#zzz;....
    Of course I replaced the xxx, yyy and zzz with the unicode number of the special sign.
    So what do I do wrong? Or is it in general not possible to use special characters ?
    Thank you very much,
    Findus

    Hi,
    one thing I did which does not work is:
    <!ATTLIST element values (&|<|val1) #REQUIRED>
    The XML parser (XMLSpy) alway requires me for entering a '%' which is as far as I know only used for parameter entities. But & and the rest are general entities, aren't they ??
    I played arround a little bit and found a solution which still does not completly solve my problem: In order to use special characters I declare parameter entities:
    <!ENTITY percent "&#37;">
    <!ENTITY lower "&#60;">
    <!ATTLIST element values (%lower;|val1|%percent;) #REQUIRED>
    This works so far so good but if I want to embed the special characters (which is what I need to do!) the parser still gives me errors:
    <!ATTLIST element values (text%lower;moreText|val1|%percent;) #REQUIRED>
    I would be really glad if anybody could test this on his own and post me about the results. For any other kind of avice I'm very thankful, too.
    Thank you very much,
    Findus

  • Special Characters in a Node Value

    Hi,
    I have a node value which contains special characters (ex: it contains degree *°* between the text). When I am adding this text value to a node i am using the following code,
    elementVariable.appendChild(documentObject.createTextNode("*node text value with different special characters*"));
    How to handle these special characters, because when I open the generated XML file in Web Browser it is displaying an error when parsing this text value which contains the degree symbol.
    Does anybody know how to handle this type of text values. If any one had links related to this, please send me.
    Thank You.

    Thanks for your reply DrClap. What you said regarding posting the query without understanding the code is correct. But I am not expert in XML and I didn't worked on it previously. I suddenly got the request to implement this in our application and i don't have time to learn, so i did some search and found the below code and used that in my program.
    It worked for all the types of data, but it is failing only for the degree character (*°*). Could you please check the below code and tell me where I am doing wrong. I really appreciate your help.
    * @Program to create a DOM XML tree and then print the XML.
    * Xmltree.java
    * Author:-RoseIndia Team
    * Date:-10-Jun-2008
    import java.io.*;
    import org.w3c.dom.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    public class Xmltree {
    public static void main(String[] args) throws Exception {
    DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = builderFactory.newDocumentBuilder();
    //creating a new instance of a DOM to build a DOM tree.
    Document doc = docBuilder.newDocument();
    new Xmltree().createXmlTree(doc);
    public void createXmlTree(Document doc) throws Exception {
    //This method creates an element node
    Element root = doc.createElement("Company");
    //adding a node after the last child node of the specified node.
    doc.appendChild(root);
    Element child = doc.createElement("Location");
    root.appendChild(child);
    Element child1 = doc.createElement("Companyname");
    child.appendChild(child1);
    Text text = doc.createTextNode("Roseindia .Net");
    child1.appendChild(text);
    Comment comment = doc.createComment("Employee in roseindia");
    child.appendChild(comment);
    Element element = doc.createElement("Employee");
    child.appendChild(element);
    Text text1 = doc.createTextNode("Girish Tewari");
    element.appendChild(text1);
    Element chilE = doc.createElement("Id");
    chilE.setAttribute("name", "Girish");
    root.appendChild(chilE);
    // adding a text element to the child
    Text text12 = doc.createTextNode("status");
    chilE.appendChild(text12);
    //TransformerFactory instance is used to create Transformer objects.
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    // create string from xml tree
    StringWriter sw = new StringWriter();
    StreamResult result = new StreamResult(sw);
    DOMSource source = new DOMSource(doc);
    transformer.transform(source, result);
    String xmlString = sw.toString();
    File file = new File("newxml.xml");
    BufferedWriter bw = new BufferedWriter
    (new OutputStreamWriter(new FileOutputStream(file)));
    bw.write(xmlString);
    bw.flush();
    bw.close();
    // print xml
    System.out.println("Xml file created is :\n" + xmlString);
    Edited by: Ramesh_Pappala on Oct 13, 2008 7:07 AM

  • Handling special characters through proxy

    Hi Gurus,
    we hvae a scenario sap to file, sending material information from SAP through outbound prpxy and palcing that detaisl in FTP loation using file adapter.
    Here probelm is one of the fields desc and text we are passing material Description and basic text which may have special characters like # @  µ while these cahractrs coming to XI itselfthey are convering as #0 and giving soem fatal error in XI whaich is unabel to parse in XI mapping and end up with mapping error.
    One more thing the if i use test the interface in dev and qa with the same characters these are working fine only failing in prod.
    please suggest how to procedd furthur.. whhetehr there is any place to check this special charatcres ecoding, uncode maintned at r/3 side or side side.
    here is the error
    Root Cause: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser : #0 not allowed in Character data sections(:main:, row:1, col:1607794) at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:157) at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:73) at java.lang.Thread.run(Thread.java:770) Root Cause: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser : #0 not allowed in Character data sections(:main:, row:1, col:1607794)(:main:, row=1, col=1607794) ->
    Edited by: Jitender Devunuri on Oct 26, 2009 3:33 PM

    Hi all .... any idea

Maybe you are looking for

  • Time effect problem with adjusment layer

    Hi, I made an adjustment layer above two footages. Everything is working (color, levels etc.) with that except time effects. When I drag twixtor to it the video turns to red. The original picture: The twixtored one: And when I use timewarp effect thi

  • IBM, JMS 1.1

    When will IBM support Java Message Service (JMS) version 1.1 ? Specifically: When will IBM Websphere MQ (MQSeries) support JMS 1.1 ? When will the IBM Websphere app server support JMS 1.1 ? Has IBM published a roadmap ? Where can I obtain IBM's produ

  • Error FND-00728 while trying to update a valuset

    We are migrating from 10.7 NCA to 11.5.2. We had a value set which was accessing a column that no longer exists in 11i. When we try to update the value set (in 11i) with the new table/column information, we get the following error - [APP:FND-728] A %

  • JSP Basics query

    Hello friends, I had asked few questions in my last post of init parameters in jsp, which must have got overlooked, but the questions are still not solved. Please help me. 1) How to override jspInit() ? I tried one sample program, but the kind of out

  • Regular signal fail both network and 3g

    Hi My iphone keeps losing signal regularly (I'm with orange). Sometimes it come back after a few moments, sometimes the wifi of 3G signal disappears along with it and sometimes the phone gives up completely and goes tot he apple screen. Lots of texts