Parsing a string of values in an expression

I have a string being passed into my report (SSRS 2008R2) That I need to parse for display purposes.
O know that I can do it with a SWITCH Statement, however there are enough different possible combinations of the string that It would become cumbersome and potentially slow down the processing.
An example of the possible length of the string is as follows:
;#None;#Awareness;#Desire;#Knowledge;#Abilities;#Reinforcement;#
Any one or a combination of the parts can be selected in a sharepoint site, which then concatenates into this type of list value. I simply need to split it apart for
readability.
Any helpful hints?

You don't need GetValue, you can just specify the indexer (1).
Split produces an array of values. You cannot directly display an array in a report so you need to specify the indexer of the element to display. I think the issue you may have is that you do not know in advance how many elements will be passed in, is that
correct? So if you try to retrieve
Split(Fields!Resistance_Areas.Value, ";#")(4) but
only 3 elements were passed in you get #Error.
If you know or can safely assume an upper limit to the number of elements then you could work around that issue. If you know that you will not have more than 10 elements passed in then you can prevent #Error by ensuring that you always have a minimum of
10 elements:
=Split(Fields!Resistance_Areas.Value+"#;#;#;#;#;#;#;#;#;",
";#")(10)
Note that I add 9 separators to the end of the passed
value. If Fields!Resistance.Value is empty string then I will get 10 empty string elements in my array, but there will be an element so you won't get #Error when you try to display it. If you get 10 elements in the field then the array will be 20 elements
long with the last 10 being empty. We don't care about them though since we are not trying to display anything past 10. You just need to append one less separator than the max number of elements you expect.
If you cannot determine safely a max number of elements
then the solution gets more complex. How are you trying to use these parsed values? 
If they will all be displayed together but you want a more readable format, try something like:
=Replace(Trim(Replace(Fields!Resistance_Areas.Value,",#"," "))," ",", ")
This replaces the separator strings with space first, then trims the leading and trailing spaces (eliminates the leading and trailing separators) then replaces the remaining spaces with ", " so ";#None;#Awareness;#Desire;#Knowledge;#Abilities;#Reinforcement;#"
becomes "None, Awareness, Desire, Knowledge, Abilities, Reinforcement". You can make the last ", " "and " with a little
more work. See this thread (http://social.msdn.microsoft.com/Forums/sqlserver/en-US/7839c15c-1ffa-4a2d-b3f0-1e5d7399607f/replace-last-delimeter-with-and-in-a-string-in-ssrs?forum=sqlreportingservices)
for more info on that.
"You will find a fortune, though it will not be the one you seek." -
Blind Seer, O Brother Where Art Thou
Please Mark posts as answers or helpful so that others may find the fortune they seek.

Similar Messages

  • How to parse a string containing xml data

    Hi,
    Is it possible to parse a string containing xml data into a array list?
    my string contains xml data as <blood_group>
         <choice id ='1' value='A +ve'/>
         <choice id ='2' value='B +ve'/>
             <choice id ='3' value='O +ve'/>
    </blood_group>how can i get "value" into array list?

    There are lot of Java XML parsing API's available, e.g. JAXP, DOM4J, JXPath, etc.
    Of course you can also write it yourself. Look which methods the String API offers you, e.g. substring and *indexOf.                                                                                                                                                                                                                                                                                                                                                                                                               

  • Passing / parsing XML String IN / OUT from PL / SQL package

    Hello, People !
    I am wondering where can I find exact info (with code sample) about following :
    We use Oracle 8.1.6 and 8.1.7. I need to pass an XML String (could be from VARCHAR2 to CLOB) from VB 6.0 to PL/SQL package. Then I need to use built in PL/SQL XML parser to parse given string (could be large hierarchy of nodes)
    and the return some kind of cursor thru I can loop and insert data into
    different db Tables. (The return value may have complex parent/child data relationship - so I am not sure If this should be a cursor)
    I looked online many site for related info - can't find what I am looking
    for - seems like should be a common question.
    Thanx a lot !

    Hello, People !
    I am wondering where can I find exact info (with code sample) about following :
    We use Oracle 8.1.6 and 8.1.7. I need to pass an XML String (could be from VARCHAR2 to CLOB) from VB 6.0 to PL/SQL package. Then I need to use built in PL/SQL XML parser to parse given string (could be large hierarchy of nodes)
    and the return some kind of cursor thru I can loop and insert data into
    different db Tables. (The return value may have complex parent/child data relationship - so I am not sure If this should be a cursor)
    I looked online many site for related info - can't find what I am looking
    for - seems like should be a common question.
    Thanx a lot !

  • How to parse a string in CVP 7.0(1). Is there a built-in java class, other?

    Hi,
    I need to parse,in CVP 7.0(1), the BAAccountNumber variable passed by the ICM dialer.  Is there a built-in java class or other function that would help me do this?
    Our BAAccountNumber variable looks something like this: 321|XXX12345678|1901|M. In IP IVR I use the "Get ICM Data" object to read the BAAccountNumber variable from ICM and then I use the "token index" feature to parse the variable (picture below).
    Alternately, IP IVR also has a Java class that allows me to do this; the class is "java.lang.String" and the method is "public int indexOf(String,int)"
    Is there something equivalent in CVP 7.0(1)?
    thanks

    Thanks again for your help.  This is what I ended up doing:
    This configurable action element takes a string seperated by two "|" (123|123456789|12)
    and returns 3 string variables.
    you can add more output variables by adding to the Setting array below.
    // These classes are used by custom configurable elements.
    import com.audium.server.session.ActionElementData;
    import com.audium.server.voiceElement.ActionElementBase;
    import com.audium.server.voiceElement.ElementData;
    import com.audium.server.voiceElement.ElementException;
    import com.audium.server.voiceElement.ElementInterface;
    import com.audium.server.voiceElement.Setting;
    import com.audium.server.xml.ActionElementConfig;
    public class SOMENAMEHERE extends ActionElementBase implements ElementInterface
         * This method is run when the action is visited. From the ActionElementData
         * object, the configuration can be obtained.
        public void doAction(String name, ActionElementData actionData) throws ElementException
            try {
                // Get the configuration
                ActionElementConfig config = actionData.getActionElementConfig();
                //now retrieve each setting value using its 'real' name as defined in the getSettings method above
                //each setting is returned as a String type, but can be converted.
                String input = config.getSettingValue("input",actionData);
                String resultType = config.getSettingValue("resultType",actionData);
                String resultEntityID = config.getSettingValue("resultEntityID",actionData);
                String resultMemberID = config.getSettingValue("resultMemberID",actionData);
                String resultTFNType = config.getSettingValue("resultTFNType",actionData);
                //get the substring
                //String sub = input.substring(startPos,startPos+numChars);
                String[] BAAcctresults = input.split("\\|");
                //Now store the substring into either Element or Session data as requested
                //and store it into the variable name requested by the Studio developer
                if(resultType.equals("Element")){
                    actionData.setElementData(resultEntityID,BAAcctresults[0]);
                    actionData.setElementData(resultMemberID,BAAcctresults[1]);
                    actionData.setElementData(resultTFNType,BAAcctresults[2]);
                } else {
                    actionData.setSessionData(resultEntityID,BAAcctresults[0]);
                    actionData.setSessionData(resultMemberID,BAAcctresults[1]);
                    actionData.setSessionData(resultTFNType,BAAcctresults[2]);
                actionData.setElementData("status","success");
            } catch (Exception e) {
                //If anything goes wrong, create Element data 'status' with the value 'failure'
                //and return an empty string into the variable requested by the caller
                e.printStackTrace();
                actionData.setElementData("status","failure");
        public String getElementName()
            return "MEDDOC PARSER";
        public String getDisplayFolderName()
            return "SSC Custom";
        public String getDescription()
            return "This class breaks down the BAAccountNumber";
        public Setting[] getSettings() throws ElementException
             //You must define the number of settings here
             Setting[] settingArray = new Setting[5];
              //each setting must specify: real name, display name, description,
              //is it required?, can it only appear once?, does it allow substitution?,
              //and the type of entry allowed
            settingArray[0] = new Setting("input", "Original String",
                       "This is the string from which to grab a substring.",
                       true,   // It is required
                       true,   // It appears only once
                       true,   // It allows substitution
                       Setting.STRING);
            settingArray[1] = new Setting("resultType", "Result Type",
                    "Choose where to store result \n" +
                    "into Element or Session data",
                    true,   // It is required
                    true,   // It appears only once
                    false,  // It does NOT allow substitution
                    new String[]{"Element","Session"});//pull-down menu
            settingArray[1].setDefaultValue("Session");
            settingArray[2] = new Setting("resultEntityID", "EntityID",
              "Name of variable to hold the result.",
              true,   // It is required
              true,   // It appears only once
              true,   // It allows substitution
              Setting.STRING);  
            settingArray[2].setDefaultValue("EntityID");
            settingArray[3] = new Setting("resultMemberID", "MemberID",
                    "Name of variable to hold the result.",
                    true,   // It is required
                    true,   // It appears only once
                    true,   // It allows substitution
                    Setting.STRING);  
            settingArray[3].setDefaultValue("MemberID");
            settingArray[4] = new Setting("resultTFNType", "TFNType",
                      "Name of variable to hold the result.",
                      true,   // It is required
                      true,   // It appears only once
                      true,   // It allows substitution
                      Setting.STRING);  
            settingArray[4].setDefaultValue("TFNType");    
    return settingArray;
        public ElementData[] getElementData() throws ElementException
            return null;

  • Parsing a string in a sproc

    I have a Java class that calls a stored proc and passes a stringbuffer object to it. The sproc should parse the string to retrieve the different ids that are concatenated in the stringbuffer and for each id retrieve a row from a table and in the end return a cursor containing the returned rows.Can anyone help me out with the parsing logic for a pipe delimited string.
    Tathagata

    This might help you. If you want to handle the cursor in java, then convert the below into a function which returns the cursor.
    SQL> CREATE TABLE EMP(ENAME VARCHAR2(100),ENO NUMBER(5),DEPT NUMBER(5))
      2  /
    Table created.
    SQL> INSERT INTO EMP VALUES('SCOTT',1,2);
    1 row created.
    SQL> INSERT INTO EMP VALUES('TIGER',2,5);
    1 row created.
    SQL> INSERT INTO EMP VALUES('THOMAS',3,10);
    1 row created.
    SQL> INSERT INTO EMP VALUES('PETER',4,10);
    1 row created.
    SQL> INSERT INTO EMP VALUES('HARRY',7,10);
    1 row created.
    SQL> CREATE OR REPLACE PROCEDURE PARSE_STRING(STR VARCHAR2)
      2  AS
      3  TYPE EmpCurTyp IS REF CURSOR;
      4  emp_cv EmpCurTyp;
      5  STRING VARCHAR2(1000);
      6  type emp_t is table of emp%rowtype;
      7  emp_tab emp_t;
      8  BEGIN
      9  STRING := REPLACE(STR,'|',',');
    10  OPEN emp_cv FOR 'SELECT ENAME,ENO,DEPT FROM EMP WHERE ENO IN('||string||')';
    11  FETCH emp_cv BULK COLLECT INTO EMP_TAB;
    12  CLOSE emp_cv;
    13  FOR I IN 1..EMP_TAB.LAST
    14  LOOP
    15  DBMS_OUTPUT.PUT_LINE(EMP_TAB(I).ENAME);
    16  END LOOP;
    17  EXCEPTION
    18  WHEN OTHERS THEN
    19  DBMS_OUTPUT.PUT_LINE('ERROR OCCURED ' || SQLCODE ||' ' || SQLERRM);
    20  END;
    21  /
    Procedure created.
    SQL> set serveroutput on;
    SQL> BEGIN
      2  PARSE_STRING('1|2|3|4');
      3  END;
      4  /
    SCOTT
    TIGER
    THOMAS
    PETER
    PL/SQL procedure successfully completed.
    SQL>Regards,
    Mohana

  • Parse a String to boolean

    How do you parse a String to boolean, isn't like this? I get this inconertible types error, that require boolean
    boolean all = (boolean)tokens.nextToken();
    Thanks!

    What string means true, and what string means false? The string "true" or "false"? In that case, you can simply use the Boolean.valueOf(String) method:
    public static Boolean valueOf(String s)
        Returns a Boolean with a value represented by the specified String. The Boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string "true".
        Example: Boolean.valueOf("True") returns true.
        Example: Boolean.valueOf("yes") returns false.
        Parameters:
            s - a string.
        Returns:
            the Boolean value represented by the string.Otherwise, you can use something like:
      boolean b = string.equals("true");or if string can be null to also mean false:
      boolean b = "true".equals(string);

  • StringListToXML not parsing a string list with quote

    Hi,
    I've been trying to parse this string out to XML but not successful due to the quotes.
    Sample string:
    A Test,N/A,N/A,-,N/A,N/A,-,N/A,N/A,-,"1,454","1,604",10%,100.0%,69.0%,(31%),375,302,(19%),375,208,(44%), 25.34 , 40.79 ,(61%),10,-
    I've leaving the properties as they are and also tried to set the StripQuotes to 0. And it is still returning the value "1,454" as 2 row items, 1 and 454.
    Is this a bug? If it is, is there any other way to tokenize the string?
    Cheers,
    Yin San

    Hi Sascha,
    I'm using 11.5.3. StringListToXML does not treat "1,234" as one item. With StripQuotes set to True, return items are 1 and 234. With StripQuotes set to False, return items are "1 and 234".
    So, I'm going to try Rick's suggestion to use a WebScrapper and Regex.
    Yin San

  • Help regarding parsing the string

    I wanted to display diffrent colored strings in the Textarea which is not possible. But from somewhere I came to know that it is possible by parsing the strings comming frm various sources and then display them with diffrent colors. can anyone help me out regarding this. The format is something like:
    &x100100100This is a colored string!&n
    the &x100100100 means that the text after it should use RGB value of 100,100,100. &n meant that the colors should stop and return to default.
    Well... this makes the client need to parse strings and set colors etc
    Can anyone explain me with some small code without using the swing class. thanks in advance.

    Here is my code I am trying to do...Pls see to it and tell me the mistake....
    import java.net.*;
    import java.applet.*;
    import java.awt.*;
    import java.io.*;
    import java.awt.event.*;
    import java.util.*;
    import java.lang.*;
    public class client extends Applet
         //implements KeyListener
              TextArea display;
              //TextField send;
              TextArea send;
              Label status;
              Color color;
              mypanel p1;
              boolean connected=false;
              private Socket sock;
               protected BufferedReader instream;
              private DataOutputStream out;
              private String IP;
              private int port;
              Thread reader;
              private String fontName;
              private int fontSize;
              private String company;
              private String userName;
              private String userID;
              private String compName;
         public void start()
                   String param;
                   String mStr ;
                   IP=getParameter("IP");
                   userID=getParameter("userID");
                   userName=getParameter("userName");
                   fontName=getParameter("fontName");
                   company=getParameter("company");
                   mStr=userID+"#"+userName+"#US#"+company+"#1#A";
                   param=getParameter("fontSize");
                   try{
                        if (param!=null)
                             fontSize=Integer.parseInt(param);
                        else
                             fontSize=0;
                        } catch (NumberFormatException e){
                             fontSize=-1;                    
                   param=getParameter("port");
                   try{
                        if (param!=null)
                             port=Integer.parseInt(param);
                        else
                             port=2;
                        } catch (NumberFormatException e){
                             port=-1;     
                        //display.append(sock.getURL());
                        connect(IP,port,mStr);
         public void init()
                   setBackground(Color.white);
                   //color = new Color(221,240,255);
                   setForeground(Color.black);
                   p1=new mypanel();
                   add(p1);
                   reader = new readMessage(this);
                reader.setPriority(1);
                   //send.addKeyListener(this);
         public void paint(Graphics g){
              String s;
              double p;
              int i;
              //status.setBackground(Color.blue);
              g.setColor(color);
              display.setEditable(false);
              status.setForeground(Color.black);
              display.setBackground(Color.white);
              p1.cmdSend.setBackground(Color.white);
              p1.cmdSend.setForeground(Color.black);
              display.setFont(new Font("Arial", Font.PLAIN, 11));
              //status.setBackground(Color.blue);
              display.setForeground(Color.blue);
         public void connect(String host,int p,String mStr)
               try{
                   sock=new Socket(host,p);
                   instream = new BufferedReader( new InputStreamReader(sock.getInputStream()));
                   out = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
                   out.writeBytes(mStr);
                   connected=true;
                   out.flush();
                   reader.start();
                   setStatus("You are Connected Successfully. ");
                   display.append("Welcome to "+company+" chat . A Customer Support Executive will assist you shortly.\n");
                   catch (UnknownHostException a) {
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append(company+" live support service fails due to some technical reason.");
                            //status.setText("Intelecorp Live Suport service fails due to some technical reasions.");
                   catch (IOException b) {
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append(company+" live support service fails due to some technical reason.");
                            //status.setText("Intelecorp Live Suport service fails due to some technical reasions.");
                   catch (SecurityException c ) {
                        connected = false;
                        display.append("Error");
              public void setStatus(String mstr)
                   status.setText(mstr);
              public boolean action (Event e, Object arg)
                   if(e.target instanceof Button)
                        if (e.target==p1.cmdSend)
                             sendMessage(send.getText());
                             send.setText("");
                             return true;
                   return false;
    public boolean keyUp(Event e, int key)
            if(key==Event.ENTER)
                   sendMessage(send.getText());
                  send.setText("");
                   return true;
            return false;
         public void keyPressed(KeyEvent e)
              switch (e.getKeyCode()) {
                   case KeyEvent.VK_ENTER:
                        sendMessage(send.getText());
                        send.setText("");
                        break;
                   default:
                        break;
              return ;
         public void keyReleased(KeyEvent e) {} ;
         public void keyTyped(KeyEvent e) {} ;
         public void sendMessage(String mStr)
                   int mflag;
                   try{
                        mflag=mStr.lastIndexOf('\n');
                        mStr.trim();
                        if ((connected==true) && (mStr.length()>0))
                             if (mflag<0)
                                  mStr=mStr+"\n";
                             display.append(userName+" : "+"&x100100100"+mStr+"!&n");
                             out.writeBytes(mStr);
                             out.flush();
                             send.setText("");
                   }catch (IOException e){
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append("Unable to send the message, you may be disconnected from the server.");
                             //status.setText("Unable to send the message, you may disconnected from the server.");
    public void destroy(){
              try{
                   sock.close();
                   }catch (IOException e){
                             status.setText(e.toString());
    class readMessage extends Thread{
              client mClient;
              private String mStr;
             public readMessage(client c){
                        super("Client Reader");
                        this.mClient = c;
    public void run()
              mStr=null;
         try{
                        if (connected==true)
                             while(true)
                               mStr = instream.readLine();
                               display.append("&x200200200"+mStr+"!&n"+"\n");
                               //display.setText(display.getText()+"\n"+mStr);
                                    if (mStr==null)
                                  break;
              }catch (IOException e){
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append("Unable to read the messages, you may be disconnected from the server.");
                             //status.setText("Unable to read the messages, you may disconnected from the server.");
    class mypanel extends Panel 
                   Label l1,l2,l3;
                   Button cmdSend;
                   mypanel()
                        setLayout(new BorderLayout());
                        add("North",display=new TextArea("",12,50,TextArea.SCROLLBARS_VERTICAL_ONLY));
                        add("West",send=new TextArea("",2,50,TextArea.SCROLLBARS_VERTICAL_ONLY));
                        //add("West",send=new TextField());
                        add("East",cmdSend=new Button("  Send  "));
                        add("South",status=new Label(""));
    }

  • Parsing a string using StringTokenizer

    Hi,
    I want to parse a string such as
    String input = ab{cd}:"abc""de"{
    and the extracted tokens should be as follows
    ab
    cd
    "abc""de"
    As a result, I used the StringTokenizer class with deilmeter {,},:
    StringTokenizer tokenizer = new StringTokenizer(input,"{}:", true);
    In this was, I can separate the tokens and also can get the delimeters. The problem is I don't know how to parse the string that has double quote on it. If a single quote " is taken as a delimeter then
    ", abc, ",", de," all of them will be taken as a separate token. My intention is to get the whole string inside the double quote as a token including the quotes on it. Moreover, if there is any escape character "", it should be also included in the token. Help please.
    Thanks

    A bit of a "sticky tape"-solution...
    import java.util.StringTokenizer;
    public class Test {
        public static void main(String[] args) {
            String input = "ab{cd}:\"abc\"\"de\"";
            StringTokenizer st = new StringTokenizer(input, "{}:", true);
            while(st.hasMoreTokens()) {
            String token = st.nextToken();
            if(token.startsWith("\"") && token.endsWith("\"")) {
            token = token.substring(1,token.length()-1);
                System.out.println(token);
    }

  • Convert String variable value  to an Object referece type

    Hi all,
    I want to know that if there any possible way to convert String variable value to a Object reference type in java. I'll explain by example if this is not clear.
    Let's think that there is a string variable name like,
    String name="HelloWorld";
    and there is a class name same to the variable value.
    class HelloWorld
    I am passing this string variable value to a method which is going to make a object of helloworld;
    new convertobj().convert("HelloWorld");
    class convertobj{
    public void convert(String name){
    // in hert it is going to create the object of HelloWorld;
    // HelloWorld hello=new HelloWorld(); just like this.
    now i want to do this from the name variable value.( name na=new name()) like wise.
    please let me know if there any possible way to do that.
    I am just passing the name of class by string variable then i wanted to make a instance of the class which come through the variable value.
    thanx.

    Either cast the object to a HelloWorld or use the reflection API (Google it) - with the reflection API you can discover what methods are available.
    Note: if you are planning to pass in various string arguments and instantiate a class which you expect to have a certain method... you should define an interface and have all of your classes that you will call in this way implement the interface (that way you're sure the class has a method of that name). You can then just cast the object to the interface type and call the method.
    John

  • Read Query String Parameter Value in SSRS

    Hi,
    We have Project Server 2010 and Sharepoint Server 2010 env and using SSRS 2008 R2 for reporting purpose in Native mode.
    Here I am displaying the SSRS Project report in Project Server page using Report Viewer web part like below.
    Here I want to read projuid query string parameter value (Highlighthed above in URL ) in SSRS by using any way, so that I can pass that
    projuid value in my SSRS report parameter to filter and make this report dynamic.
    Right now I have to select the ProjectName (Label) which passes ProjUID
    as value from the Parameter, but I want it should read the projuid
    from URL so that this reports will display the project the data for the opened Project automatically
    Thanks and let me know in case we can achive this using OOTB or some custom functions.

    Hi,
    For the report parameter, you can get the value from database query or some embedded funcitons etc. or even some customerized function.
    You may consider to create your own code for the report to read the projuid from application or URL. The customer code can be used to get the values from the applicaiton or from the url etc. Then report can call the customer code function to get the value.
    refer link
    https://technet.microsoft.com/en-us/library/ms155798(v=SQL.100).aspx
    https://support.microsoft.com/kb/920769?wa=wsignin1.0
    Thanks,

  • Can't change string variable values in Flash CS4 Debugger

    I'm using the Flash CS4 debugger, and while I can change numeric variable values in the Variables panel, I can't change string variable values. The only characters the fields accept are the numbers 1-9 and the characters "d" and "j".
    I can  paste strings  into the value fields, but that's a bit of a pain. I've tried this on a couple of different Flash CS4 installations and get the same results.
    Does anyone know if it's possible to change string values in the Variables panel of the Flash CS4 Debugger?

    See:
    http://forum.java.sun.com/thread.jspa?threadID=591012&tstart=15

  • How to Parse a string into an XML DOM ?

    Hi,
    I want to parse a String into an XML DOM. Not able to locate any parser which supports that. Any pointers to this?

    Download Xerces from xml.apache.org. Place the relevant JAR's on your classpath. Here is sample code to get a DOM document reference.
    - Saish
    public final class DomParser extends Object {
         // Class Variables //
         private static final DocumentBuilder builder;
         private static final String JAXP_SCHEMA_LANGUAGE =
             "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
         /** W3C schema definitions */
         private static final String W3C_XML_SCHEMA =
             "http://www.w3.org/2001/XMLSchema";
         // Constructors //
         static {
              try {
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   factory.setNamespaceAware(true);
                   factory.setValidating(true);
                   factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
                   builder = factory.newDocumentBuilder();
                   builder.setErrorHandler(new ErrorHandler() {
                       public void warning(SAXParseException e) throws SAXException {
                           System.err.println("[warning] "+e.getMessage());
                       public void error(SAXParseException e) throws SAXException {
                           System.err.println("[error] "+e.getMessage());
                       public void fatalError(SAXParseException e) throws SAXException {
                           System.err.println("[fatal error] "+e.getMessage());
                           throw new XmlParsingError("Fatal validation error", e);
              catch (ParserConfigurationException fatal) {
                   throw new ConfigurationError("Unable to create XML DOM document parser", fatal);
              catch (FactoryConfigurationError fatal) {
                   throw new ConfigurationError("Unable to create XML DOM document factory", fatal);
         private DomParser() {
              super();
         // Public Methods //
         public static final Document newDocument() {
              return builder.newDocument();
         public static final Document parseDocument(final InputStream in) {
              try {
                   return builder.parse(in);
              catch (SAXException e) {
                   throw new XmlParsingError("SAX exception during parsing.  Document is not well-formed or contains " +
                        "illegal characters", e);
              catch (IOException e) {
                   throw new XmlParsingError("Encountered I/O exception during parsing", e);
    }- Saish

  • Parsing formatted String to Int

    How can I parse formatted string to Integer ?
    I have a formated string like this $900,000 and I need to convert it to 900000 so I could do calculations with it.
    I tried something like this
    NumberFormat nf = NumberFormat.getIntegerInstance(request.getLocale());
    ttlMargin=nf.parse(screenVal);I got this exception
    "java.lang.NumberFormatException: For input string: "$1,050,000""

    I am working on the JSP file that provides
    margins,sales etc. I am reading this data off the
    screen where it is beeing displayed according to the
    accounting practices.
    That's why I get it as a formatted string and why I
    am trying covert that string to the numberScreen-scraping is a problematic, bad design. It sounds like what you really want is to call a web service which returns its results as data that a program can understand (XML, for example), not HTML (which is meant more for humans to read). I know, you probably can't change the design at this point... just food for thought. In the meantime, you'll probably have to manually parse those strings yourself by stripping out the '$' and ',' characters and then use parseInt on the result.

  • Exchange BPA Errors (Exchange server is a virtual machine but the additional tools are not installed and The 'Services' string type value located in 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v14\Setup\Services' registry key is missing)

    Hi,
    I am running BPA on My Exchange 2010 VM (Server 2008 R2 VM on Hyper-V) and get the following errors:
    The 'Services' string type value located in 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v14\Setup\Services' registry key is missing or inaccessible. The Microsoft Exchange Information Store service won't start. As a result, all services that depend
    on this service won't be able to start
    Exchange server [Exchange Server FQDN] is a virtual machine but the additional tools are not installed. This configuration is not supported. Install Virtual Machine Additions for this guest.
    Problem is that, for the first, that Key exists and the service is actually running fine. And for the second my VM tools are already installed.
    Hopefully someone out there has had the same issue and can assist.
    Pete

    Hi Pete,
    For the first error message, please try the following steps:
    Make sure the Information Store service is in Starting status,
    Automatic startup type and works well, as a test we can try to
    restart the Infroamtion Store service and verify the service works well.
    Start
    Registry Editor, find the registry key “Services” under “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v14\Setup”, its value is “C:\Program
    files\Microsoft\Exchange Server\v14”(default install location), please check your registry, make sure the key “Services” exist and value is the Exchange Server install location and the
    location is accessible;
    Start
    Registry Editor, and locate the following registry key:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Exchange\Setup
    Use the
    Permission option under the Security tab to check the permission setting on this key. Make sure
    System is in the list with Full Control permissions if the service account is Local System. If you are not using Local System as the service account, check the existence of the corresponding account in the list and ensure that
    it has Full Control permissions. Please refer to this article:
    Title: Exchange Store Does Not Start: Errors 7024, 1026, 9542, and 5000
    Link:
    http://support.microsoft.com/kb/285116
    Start
    ADSI Edit, and then browse to the following location:
    Domain.com/Configuration/Services/Microsoft Exchange/Org/Administrative Groups/AdminGroup/Servers/Server Name
    Right-click the
    server name, and then click Properties.
    Click the
    Security tab, make sure this own server’s server object have
    full control permission on its own server.
    If not or the object is missing, please modify the permission or click
    Add, locate the computer account for the Exchange Server computer, add it to the Permissions list with full control.
    Click OK, and then close ADSI Edit.
    Use
    Active Directory Users and Computers to add the current affected
    Exchange Server computer account to the Exchange Servers(previous version should be “Exchange Domain Servers”) group in the
    Microsoft Exchange Security Groups( or Users) OU. Refer to this article:
    http://support.microsoft.com/kb/297295.
    Restart the Exchange Server computer, then rerun the ExBPA.
    For the second error message, Microsoft don’t recommend to install Exchange Server on virtual machine without additional tools, so the error message occurs. We can just ignore
    this message, it will not affect the Exchange servers.
    Regards, Eric Zou

Maybe you are looking for

  • Long load times and poor application performance

    We have packaged and deployed Adobe CC using SCCM within my school division. It pushed out fine, but now when we attempt to open Photoshop (or any other CC app) it has unusually long load times. 2-4 minutes. It seems to be hanging at the "Reading pre

  • Can't start FM 9 on Windows 7: "cannot initialize dictionaries"

    I am trying to move a copy of FM 9 from an old laptop to a new one running Windows 7 Enterprise. My IT guy reinstalled the software from CD and applied my license key. When I try to start FM, it gives this error during the "Core" startup: "FrameMaker

  • Are these Seagate 2TB drives compatible in my Mac Pro Quad Core 2.66 GHz?

    I still have an Apple Mac Pro "Quad Core" 2.66 that was introduced August 7, 2006. I currently have 4 of the following Seagate internal hard drives installed: ST3750640AS SEAGATE BARRACUDA 7200.10 - HARD DRIVE - 750 GB - INTERNAL - 3.5" - SATA-300 -

  • Methods not found in class !  HELP !

    Dear java People, I am trying to draw, move, and erase balls in a ArrayList. I get an error message that says: "BallDemo.java": Error #: 300 : method draw() not found in class java.lang.Object at line 126, "BallDemo.java": Error #: 300 : method move(

  • I can't install flash player on my mac

    Operating system: OS X 10.5.8 Processor: 2.1 GHz Intel Core 2 Duo Browser: Safari 5.0.6 (have also tried on latest version of firefox) I have tried so many times to install flash player and each time the download stope (usually at 0%) and doesn't giv