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

Similar Messages

  • I have created a book in ibooks author with a custom font when previewing on the ipad the special characters within the font do not appear?

    I have created a book in ibooks author with a custom font when previewing on the ipad the special characters within the font do not appear?

    'custom' font sounds like you may be working with a font that is unsupported on iOS/iPad.
    Supported fonts are found in the pull-down font menu in the toolbar. Authors are obligated (mostly) to stick to that list.

  • Runtime mapping error due to the special characters in source XML

    Hi All,
    I am facing problem with the special characters coming in the source XML message. it is failing at runtime in the mapping level. when i test with the same XML message manually in graphical message mapping it works.
    it looks like a UNICODE problem which we face noramlly in ABAP as well. but looking for a solution.
    For your reference i am giving the data which i am recivieing and the error message below.
    the problem is with the character .
    Source payload error:-
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    An invalid character was found in text content. Error processing resource 'file:///C:/WINNT/profiles/CG1009/Local Settings/Temp/a173eb8_2721HTML000003'. Line 26, Position 22
    Early response is appreciated.
    Thank you

    If your message contains special chars and the encoding is not being set, then the error is of the system which is sending the message, not XI's. The webserver should return the correct encoding.
    At adapter engine, You can set the enconding for the messages you send (for example, in Soap adapter module, set XMBWS.XMLEncoding parameter with value iso-8859-1),  but not for the messages you receive.
    As a workaround, you could try using a Java Mapping to change the encoding manually. For that, set the encoding of the OutputFormat of the XML you'll serialize. Try the following code piece for the mapping (inside a try/catch declaration):
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder documentBuilder = factory.newDocumentBuilder();
    Document input = documentBuilder.parse(in);
    OutputFormat format = new OutputFormat(XML, "ISO-8859-1", false);
    XMLSerializer serializer = new XMLSerializer(out, format);
    serializer.serialize(input);
    For that code to work, you'll need to import xercesImpl.jar and xml-apis.jar in Imported Archives of mapping objects, in Integration Repository. Both are available at http://xerces.apache.org/xerces2-j/ .
    Regards,
    Henrique.

  • Want to show the special characters in the tab page title.

    Hi,
    I am using oracle 10g forms developer and i have created the x bar chart.
    I want to give the tab page title of the x bar chart as
    x chart
    is it possible or any pjc available?
    Pls help me.
    Balaji
    Edited by: Balaji.M on Nov 15, 2008 3:54 PM

    ok, what is the special character, is the undescore above the x ?
    With standard-forms it's not possible to put multiline-labels on a tab-page. To have a look at the pjc-opportunities, i would start with Francois pjc-site:
    http://forms.pjc.bean.over-blog.com/

  • How can I put emoji from the special characters from the edit menu on to a Pages document? They will go on an email but not on Pages.  Other special characters like divination symbols will go but not emoji, i.e., smiling faces.

     

    More info on sitemap.xml:
    http://www.adobekb.com/strategies_for_seo.html#understandingsitemap
    Note that you can also exclude a page from your sitemap.xml to prevent crawlers from crawling it. Usually you don't want to do this, but if you have a good reason to the setting for that is in the page properties dialog.
    You can assign heading tags using paragraph styles. More info here:
    http://www.adobekb.com/strategies_for_seo.html#usingparagraph
    I'm able to set alt text on thumbnail images. Are you sure you have the thumbnail image selected?
    You can create a placeholder page in your plan view, then mark the page menu options as 'include page without hyperlink'. Then your menu will contain an entry for this page, but no hyperlink. If you select the menu item, you can assign a hyperlink with the hyperlink control in the control strip.

  • Special characters in the employee names is adding ASCII  to the file

    Hi Team,
    Iam working on a outbound interface which has a length of 3000. For the last name it is having some special charecters Vázquez . When downloading into application server, the special characters in the employee names is adding ASCII characters to the file Vázquez . This is increasing the record length to 3001.
    Please let me know how to remove this ASCII charecters. It is happening only for application server.
    Rgds
    Kishor

    Hi
    Please refer below link.
    [Re: Translation of special charachter like 'u00E3au00EA']
    ~~~Ganesh Kumar K.

  • Finding special characters in the column

    Hi,
    Need a help to find out the special characters in the column. since the data is loaded from external files like excel etc.., there
    are some special characters are got inserted in the column.
    how do i find out the rows in the column which has special characters, Please help ASAP...
    Thanks

    Hi,
    What do you mean by "special characters"?
    SQL> With T As(Select 'A?BC' txt from dual union all
      2            Select 'AB%C' txt from dual union all
      3            Select 'ACAA' txt from dual)
      4  Select txt from t where Regexp_Like(txt,'[[:punct:]]');
    TXT
    A?BC
    AB%C
    [:punct:]      Punctuation symbols
                    % . , " ' ? ! : # $ & ( ) * ;
                    + - / < > = @ [ ] \ ^ _ { } | ~
    {code}
    Regards,
    Christian Balz                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Reg Special Characters in The Names causing the problems EX: Bu00E1rbara u00E1u00EDu00F1u00E9

    Hi Friends,
    In the Infotype 0002 I am able to observe the Special characters   in the First Name & Last Name.
    When I run standard SAP report i.e. Birthday list and trying to save the output to the *clipboard option and paste it to the notepad*, I observed that last some characters were missed out depends on the special characters available in the First Name  Last Name.
    Assume if there are 5 special characters avialble in the Names, then 5 characters will be missed out in the output.
    Please help on this issue.
    Thanks & Regards
    Prashanth K
    Edited by: Prashanth Konda on Feb 15, 2010 5:49 PM

    Hi Binder,
    Thanks for the repsonse.
    I didn't get what do you mean by  Correct Code Page ?
    Thanks & Regards
    Prashanth

  • How to  remove the Special characters like @,#,$ ,..from field

    How to  remove the Special characters like @,#,$<,..from text  field. we nedd to remove any specila char from text field .
    ex:text  = just#fi%cation@text
    the text should be justification.

    hi check this ..
    data:char(25) value '5#4#2#&1#&',
         char1(9) .
           replace all occurrences of '#' in char with 'and' .
           replace all occurrences of '&' in char with 'num' .
         write: char.
    or use this..
    data:char(25) value 'test@ing*5#4#2#&1#&',
         char1(9) .
           replace all occurrences of '#' in char with space .
           replace all occurrences of '&' in char with space .
           replace all occurrences of '@' in char with space .
           replace all occurrences of '*' in char with space .
         write: char.
    regards,
    venkat.

  • How to find the 'special characters' window

    Hi,
    Frequently I want to access the 'special characters' window, but when I click on the 'special characters' menu item the window does not appear. Sometimes I later find it on another screen (I use nine screens in Spaces), and sometimes can I see it on another screen using Expose, but when I go there it has disappeared. It seems a very fugitive tool, and in its way displays some cute, personality........ But I would love to know how to find it or to force it to appear on the same screen as the application from which I tried to open it!
    all the best,
    Jeremy Harbinson

    Hi,
    Thanks for the reply.
    I tried what you suggest - in the International section of the System Preferences there is a tab labelled 'input menu' and there is a check box (which is checked) titled 'Show input menu in Menu bar'. Unchecking that removes a national flag from the the menu bar, checking it restores that flag. So far, so good. If a click on the flag, a drop down menu appears with 'Hide character palette' as an item - clicking this changes it state to 'Show character palette' but clicking this (several times) changes nothing else that I can see,
    all the best,
    Jeremy

  • Remove all the special characters using java.util.regex

    Hi,
    How to remove the all the special characters in a String[] using regex, i have the following:-
    public class RegExpTest {
         private static String removeSplCharactersForNumber(String[] number) {
              String number= null;
              Matcher m = null;
                   Pattern p = Pattern.compile("\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\_\\+\\-\\{\\}\\|\\;\\\\\\'////\\,\\.\\?\\<\\>\\[\\]");
                   for (int i = 0; i < number.length; i++) {
                   m = p.matcher(number);
                   if (m.find()) {
                        number= m.replaceAll("");
                   System.out.println("Final Number is:::"+number);
                   return number;
              public static void main(String args[]){
                   String[] str = {"raghav!@#$%^&*()_+"};
                   RegExpTest regExpTest = new RegExpTest();
                   regExpTest.removeSplCharactersForNumber(str);
    This code is not working and m.find() is "false", here i want the output to be raghav for the entered string array, not only that it should remove all the special characters for a entered string[]. Is there a simple way to do this to remove all the special characters for a given string[]? More importantly the "spaces" (treated as a spl. character), should be removed as well. Please do provide a solution to this.
    Thanks

    You don't need the find(). Just use the replaceAll() on each element of the String[] i.e.
    String[] values = ...
    for (int i = 0; i < values.length; i++)
        values[i] = p.matcher(values).replaceAll("");
    }I can't understand your regex since the forum software has mangled it but you just need to add a space to the set of chars to remove. When you post code, surround it with CODE tags then the forum software won't mangle it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How do you turn off the special characters for letters?

    How do you turn off the special characters for letters? Where you hold down the key and it comes up with variations of the letter. For example ï í î ò œ å ß ł û
    It is very annoying when I try to play any online games. Thanks for the help

    Thank you so much It worked Thank you

  • How to remove all special  characters

    Hi,
    I want to remove all (128-223)the special characters that come in the mapping from the URL
    http://www.danshort.com/ASCIImap/
    128-223 ,I mean if any characters that come in between these numbered characters I have to remove in mapping.
    please suggest.
    thank you,
    Sri

    HI Sri
    You can use the Java code as given above
    Other method can be XSLT
      <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
                <xsl:output  method="xml" indent="yes" omit-xml-declaration="yes"/>
                <xsl:template  match="/source node">
                      <target node>
                            <xsl:value-of  select="replace(.,'sepcial character','')"/>
                      </target node>
                </xsl:template>
          </xsl:stylesheet>
    Thanks
    Gaurav

  • How to identify the special characters

    Hi all,
    is there any way to identify all the special characters that are already in the various columns of a table,
    thanks
    db is on 8i
    Edited by: venkata_sudheer on Apr 3, 2009 8:44 AM

    Hello,
    I don't know what's your requriment is and how do you want to handle or treat these special characters but check this function, you can pass special character and it will return back the number or you can extend this function to do the reverse (chr(37) 37=%).
    CREATE OR REPLACE FUNCTION ascii_only (p_txt IN VARCHAR2)
       RETURN VARCHAR2
    IS
       v_number   NUMBER;
       v_char     VARCHAR2 (3 BYTE);
    BEGIN
       v_char := SUBSTR (p_txt, 1, 1);
       v_number := (ASCII (v_char));
       DBMS_OUTPUT.put_line (v_number || ':' || v_char);
       RETURN v_number;
    END;
    /Regards

  • Using devanagari script in the 'special characters' option in Pages

    Using the special characters menu in Pages how can I produce double consonances?  Any help would be gratefully received

    That should be double consonants if you have been searching.
    What keyboard are you using?
    Devanāgarī Typing & Keyboard Layouts (Mac & Windows)
    http://www.indiantypefoundry.com/help/technical-issues/devanagari-keyboard/
    https://discussions.apple.com/thread/3548952?start=0&tstart=0
    Peter

Maybe you are looking for