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;

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.                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to parse xml string using JSTL

    Suppose this is my string:-----
    <books>
    <book>
    <title id=1>Book Title A</title>
    <author>A. B. C.</author>
    <price>17.95</price>
    </book>
    <book>
    <title id=2>Book Title B</title>
    <author>X. Y. Z.</author>
    <price>24.99</price>
    </book>
    </books>
    and I want to read title id = 1 then, how to parse it, I found tutorials regarding parsing simple xml document but how to parse attributes of a given XML

    But both of them either parse a file or data from an input source. I don't think they handle strings.An InputSource can be constructed with a Reader as input. One useful subclass of Reader is StringReader, so you'd use something likeDocument doc = documentBuilder.parse(new InputSource(new StringReader(myXMLString)));

  • How to parse xml string

    Hi! I'm having problems parsing an xml string. I've done DOM and SAX parsing before. But both of them either parse a file or data from an input source. I don't think they handle strings. I also don't want to write the string into a file just so I can use DOM or SAX.
    I'm looking for something where I could simply do:
    Document doc = documentBuilder.parse( myXMLString );
    So the heirarchy is automatically established for me. Then I could just do
    Element elem = doc.getElement();
    String name = elem.getTagName();
    These aren't the only methods I would want to use. Again, my main problem is how to parse xml if it is stored in a string, not a file, nor comming from a stream.
    thanks!

    But both of them either parse a file or data from an input source. I don't think they handle strings.An InputSource can be constructed with a Reader as input. One useful subclass of Reader is StringReader, so you'd use something likeDocument doc = documentBuilder.parse(new InputSource(new StringReader(myXMLString)));

  • 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

  • How to parse a String help

    I'm trying to find an easy way to parse a string like this
    String, brand,model, number;
    String toParse=(Sony)(VZ-12324)(1);Is there a simple way of parsing the string to the "(" and ")" are omitted and brand=Sony;
    model=VZ-12324);
    number="1";
    ???

    String toParse = "(Sony)(VZ-12324)(1)";
    String[] parts = toParse.split("[()]");
    String brand = parts[1];
    String model = parts[3];
    int number = Integer.parseInt(parts[5]);
    System.out.println(brand);
    System.out.println(model);
    System.out.println(number);

  • DOM problem: How to parse a string

    Hey i am developing a distributed application in which servers pass on a request in XML format.....However this request is passed in the form of a string....I am using DOM to parse the xml. It is a fairly small string with like 7-9 lines of code. However the problem with DOM is that it allows me to parse the files not the strings......anyidea how to do that.....i cannot create temp files.....because there will be a huge number of requests so ..............or should i use another parse........if yes then tell me which is the easiest approach......i just wanna add or remove some tags at each server and then pass the request to the next

    thanx but the problem is not solved.........i am importing java.xml.parsers.sax.InputSource..........
    Now when i use this thingy..........i get a SAX based exception saying that there is no root node..........however for the same file if i put the file name i get the code working

  • How to parse XML string fetched from the database

    i want to parse the XML string which is fetched from the oracle database.
    i have inserted the string in xml format in the database. The type of the field in which it is inserted is varchart2.
    I am successfully getting it using jdbc, storing it in a String.
    Now it is appended with xml version 1.0 and string is ready for parsing.
    Now i am making following programming.
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = Builder.parse(xmlString);
    Element root = doc.getDocumentElement();
    NodeList node = root.getElementsByTagName("product");
    But i am getting IOException at the statement
    Document doc = Builder.parse(xmlString);
    there fore i request u to kindly help me in solving this error.
    -regards
    pujan

    DocumentBuilder does not have a method parse with xml string as aparameter. The string should be a xml document uri.
    Convert xml string to StringReader.
    parse(new InputSource(new StringReader(xmlString)));

  • Help: How to parse XML string into Node Context

    Hi Experts,
    I am trying to work with a web dynpro for java application which calls a Web Service. I can call the web service successfully, however I have a problem on interpreting the response result into table. The response result is in (XML) string format, like this:
    I followed this , but it resulted to an error:
    com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Name expected: 0x20(:main:, row:158, col:59)(:main:, row=158, col=59) -> com.sap.engine.lib.xml.parser.ParserException: Name expected: 0x20(:main:, row:158, col:59)
    do anyone of you had a similar experience and were able to resolve it, please post it here. it will be highly appreciated. thanks in advance.

    Try this :
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(new org.xml.sax.InputSource(new StringReader(strXml)));Hope this helps.

  • How to parse a string?

    Hi everyone,
    I would like to get only small parts from the whole string. For example, I have "x y", and I would like to put x in a variable, and y in another one, by giving x and y their type (integer).
    Thank you for your answer.

    Thanks for your reply, it was helpful!
    I could do it simply with split, and it looks like that:
    String []splits = line.split("\t");
         System.out.println(splits[0]); --> takes the first part of the string, which is x
         System.out.println(splits[1]); --> takes the second part of the string, which is y

  • 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);
    }

  • How to Break this String and put into a Table

    Hi all,
    Currently i working on the Reading of Csv file.THe Csv file wil be stored as BLOB in one table.
    The Format of the Csv file is
    EMPCODE :DATEOFBIRTH
    312089 ,12/01/1984
    321456 ,03/05/1980
    120212 ,04/08/1987
    312456 ,23/12/1977
    311110 ,12/04/1998
    323232 ,20/06/1990
    UPLOAD_BLOB
    column     Datatype
    UploadId Number
    File_details BLOB
    And i reading the BLOB in one procedure and i m getting the String as like this ---->
    "312089 ,12/01/1984
    321456 ,03/05/1980
    120212 ,04/08/1987
    312456 ,23/12/1977
    311110 ,12/04/1998
    323232 ,20/06/1990"
    I am Dont know how to Parse this String and put in table
    While 1<STRING.LENGTH
    LOOP
    EMPCODE=SUBSTRING();
    DATEOFBIRTH=SUBSTRING();
    INSERT INTO TABLE VALID_EMPCODE(EMPCODE,DATEOFBIRTH)VALUES(......);END LOOP
    VALID_EMPCODE
    EMPCODE VARCHAR2(30)
    DATEOFBIRTH VARCHAR2(15)
    Can any one tell me how to parse this whole string and break them

    Duplicate post
    How to Break this String and put into a Table

  • Date contructor deprecation : Parsing a String to Date

    Hi All,
    In Java 1.5 the Date() constructor Date(String s) is deprecated. As per the API Documentation DateFormat.Parse() method is used.
    The following code from Java 1.4 version has to be upgraded to Java 1.5.
    Existing Code:
    Date dDate = new Date(sDate);
    Modified Code:
    DateFormat df = DateFormat.getDateInstance();
    Date dDate = df.parse(sDate);
    Here the DateFormat accepts a default formatting style as "Feb 01, 2007" and parses the String.
    If the String sDate belongs to any other formatting style such as "01 Feb, 2007" or "01 Feb, 07" the code piece throws unparsable date error.
    Please give your thougts on this issue to parse the string of any format..
    Thanks,
    Rajesh.

    Hi All,
    In Java 1.5 the Date() constructor Date(String s) is
    deprecated. As per the API Documentation
    DateFormat.Parse() method is used.
    The following code from Java 1.4 version has to be
    upgraded to Java 1.5.
    Existing Code:
    Date dDate = new Date(sDate);
    Modified Code:
    DateFormat df = DateFormat.getDateInstance();
    Date dDate = df.parse(sDate);
    Here the DateFormat accepts a default formatting
    style as "Feb 01, 2007" and parses the String.
    If the String sDate belongs to any other formatting
    style such as "01 Feb, 2007" or "01 Feb, 07" the code
    piece throws unparsable date error.
    Please give your thougts on this issue to parse the
    string of any format..You can't. What date is this: "08/04/24"? 8 April, 1924? 4 August, 2024?
    >
    Thanks,
    Rajesh.

  • How to Parse XML into String in BPEL?

    Hi,
    Can anyone tell me, how can I parse XML into String?
    I am taking input from File Adapter, File adapter is reading that XML.
    Then in assign activity i am using XPath expression(built functions) using XMLParser(),doTranslateToNative() etc.. many functions I have tried but XML is not getting parsed into String Variable.
    Please help me asap.
    Thanks
    Shikha

    Thanks a lot Eric.
    I am trying this, oraext:get-content-as-string('receiveInput_Read_InputVariable','body','/ns3:orders')
    but getting this error
    <bpelFault><faultType>0</faultType><subLanguageExecutionFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>XPath expression failed to execute. An error occurs while processing the XPath expression; the expression is oraext:get-content-as-string('receiveInput_Read_InputVariable','body','/ns3:orders'). The XPath expression failed to execute; the reason was: internal xpath error. Check the detailed root cause described in the exception message text and verify that the XPath query is correct. </summary></part><part name="code"><code>XPathExecutionError</code></part></subLanguageExecutionFault></bpelFault>

  • How to parse characters non ascii in a string

    i am stucked in this crictical problem and i don't know how to cater this. I sometimes receive this String ����&#9658;&#9787;&#9786; and sometimes these are non US-ASCII characters. These ����&#9658;&#9787;&#9786; characters are replaced by ????? and is represented as it is. I sometime receive this character �� too. These characters are in ANSI list but i want to receive only US-ASCII. Please help me out that how to identify these characters in the string.

    Basically i am getting that string from the user in an sms. The text of the sms is saved in the database.I get that sms from database in string form. now i want to parse the string to identify the non us-ascii characters in the string. This parsing is important because when i try to post data on the url i get the http response code 400 which creates an exception and i get stucked in an infinite while loop.
    HttpURLConnection urlcon =null;
    String postingdata="&message="+ URLEncoder.encode(ob.getmessage(),"UTF-8")
    System.out.println(postingdata);
    URL url = new URL("http://someurl");
    urlcon = (HttpURLConnection)url.openConnection();
    urlcon.setDoOutput(true);
    urlcon.setRequestMethod("POST");
    OutputStreamWriter wr = new OutputStreamWrite(urlcon.getOutputStream());
    wr.write(postingdata);
    wr.flush();
    BufferedReader rd = new BufferedReader(new InputStreamReader(urlcon.getInputStream()));
    rd.close();
    wr.close();

Maybe you are looking for

  • How to pass the universal workitem to other portal by webservice in BPM?

    hi,gurus: Our scenario is this: Push all the universal workitem to BEA portal by calling a web service in BPM? Can we call web service and retrieve the workitems in BPM? Or can we do that in relavant user interface--webdynpro,for as far as I know,we

  • How to add new value in Classification under General tab via MM02.

    Hello Experts, I've a requirement where I need to add a new material variant configuration value via MM02 as highlighted below. I've also attached the screen shot of CL02, the two characteristics which I need to add (highlighted in red). Can please a

  • Dell 948 printer won't work!

    I have a Dell 948 all in one printer and I tried plugging it in but OS X says there are no drivers at all for it. It's kind of disappointing because I just switched from a PC and was told that everything would just work with a mac but that does not s

  • Region Free dvd player NEED HELP

    Is the dvd player that comes in my powerbook g4 region free? as in it can play dvds from anywhere such as england or germany if its an american computer

  • Create a new header+item after sync the item some informations are deleted

    Hi All, I have a DO with a backend adapter and 3 bapi wrapper (GetList, GetDetail, Create). When I create a new instance (header+item) on client side the data are correct in the database. After a sync the instance is also on the client and the Backen