Regex Help - Parsing Names

I am receiving names from another system, and I need help parsing the data as it comes in. There are common data entry errors from the other system that I want to correct as the data is imported. I am trying to formulate a regular expression to search and replace common errors.
Example 1: A record with the last name "DE  ROSA" is imported. Note that there are two spaces between "DE" and "ROSA". I want to remove the extra spaces. This one is more straight forward.
Example 2: A record with the last name "DE  ROSA-DE  LA  CRUZ" is imported. It's the same problem, but now there are two places in which it needs to be fixed.
Example 3: A record with the last name "LYNDE-DE  ROSA" is imported. I want to correct the extra spaces in "DE ROSA" but not touch Lynde, which also contains "DE" at the end.
I can't seem to create a regular expression that will find all of the scenarios that I need without including results I don't want. These are the rules I need:
1. Search for the expression "DE" as a phrase with one or more spaces after it.
2. The item preceding "DE" must be nothing (the beginning of the line) or a character that is not a-z or A-Z.
It seems simple enough, but my expression either don't catch "DE" at the beginning of the string, or they catch the "DE" at the end of a last name. The names are converted to uppercase for simplified procession.
Any help would greatly be appreciated. I tried to explain this with the simplest examples possible, but I can provide more information if that would help.

JavaUser wrote:
936517 wrote:
I suggest you use JUnit if you don't already use it to verify every possible input condition is tested and passes.Thank you for the suggestion. I don't have JUnit set up for this project. I have a small program that I created, based off of the one provided in the regex tutorial, that allows me to type in a regular expression, a string I want to evaluate, and the results it produces. The regex expression I tried and the examples I could think of all worked. I also have some test data to try, once I finish my little program. I won't be able to anticipate every possible typo the users can make, but this will be an improvement over what we have now.I suspect you are reading more into 936517's post than he meant; I certainly don't think he expected you to cover all possible inputs since, being infinite, that is impossible. I think he probably meant to say you should cover a good selection of 'good' data and a good selection of 'bad' data plus all edge conditions you can think of.
I agree with 936517 about using JUnit. It works well even for the sort of testing you are doing.

Similar Messages

  • Parsing name field in Dataright IQ

    Using DataRight IQ 7.70, I have one field which can contain either a person or business name.  The problem comes in when trying to parse names like Wisconsin Roof Masters, the result is a person's name of Roof Master.  There are names like Ted Roof and Alan Rooffener which do result in correct names.
    I've tried modifying the dictionary, but I cannot get it to work.  I'm not sure if I'm doing something wrong, or if it's not the best solution to use.
    There are other examples with key words other than roof I am trying to parse as well.
    Thanks in adavance for the help.

    Hello Dennis,
    The method you used to modify the parsing dictionary is the recommended solution if firms are parsed as names (and vice versa). If you should need assistance with the other parsing anomolies you mentioned, please feel free to open a support incident within Service Marketplace and use component EIM-COR. A member of the DataRight IQ support team will be happy to assist you in more detail regarding any further questions you have on modifying the parsing dictionary.  Additionally, when you open an incident, you will have an opportunity to search our extensive knowledge base which may answer many of the questions you have on this subject.
    We we look forward to working with you again.
    Best Regards,
    Shelly Corcoran
    Support Engineer u2013 EIM / Postalsoft
    AGS Primary Support
    SDN WIKI/Forum Active Contributor:  http://wiki.sdn.sap.com/wiki/x/fwxXDw
                               http://forums.sdn.sap.com/forum.jspa?forumID=479

  • Regex help... Need to improve regex skills

    Hi everyone
    I m new to java.
    currently I om working an a project that requires regex for parsing.
    I am able to parse the string but I feel that regex I wrote is not efficient.
    please help me.
    String: "Oct.8, 9, 15, 16, 22, 23, 29, 30Nov.5, 6, 12, 13, 19, 20, 26, 27"
    I want to parse Oct 8 and Nov 27 (start and end of the period)
    This is the regex that i wrote.
    regex: "([a-zA-Z]+)\..*,\s*(\d+)([a-zA-Z]+).*,\s*(\d+)"

    Found this on google, maybe it will help.
    try {
            // Some examples
            DateFormat formatter = new SimpleDateFormat("MM/dd/yy");
            Date date = (Date)formatter.parse("01/29/02");
            formatter = new SimpleDateFormat("dd-MMM-yy");
            date = (Date)formatter.parse("29-Jan-02");
            // Parse a date and time; see also
            // e317 Parsing the Time Using a Custom Format
            formatter = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
            date = (Date)formatter.parse("2002.01.29.08.36.33");
            formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
            date = (Date)formatter.parse("Tue, 29 Jan 2002 22:14:02 -0500");
        } catch (ParseException e) {
        }

  • Xml regex help - can't use xml parser

    Hi,
    I receive xmls from a legacy system and use JAXB to parse these xml's into java objects.
    The xml looks roughly like this:
    <root-Tag>
       <general-Info-Tag-1>blah</<general-Info-Tag-1>
       <general-Info-Tag-2>blah</<general-Info-Tag-2>
       <general-Info-Tag-3>blah</<general-Info-Tag-3>
       <entry-Tag>
          <entry-info-Tag-1>info</entry-info-Tag-1>
          <entry-info-Tag-2>info</entry-info-Tag-2>
           etc...
       </entry-Tag>
       <entry-Tag>
          <entry-info-Tag-1>info</entry-info-Tag-1>
          <entry-info-Tag-2>info</entry-info-Tag-2>
           etc...
       </entry-Tag>
    </root-Tag>The xml contains a root tag.
    The root element contains some general info tags and entry tags.
    The entry elements contain some entry relevant info inside nested tags.
    It's important to note that this the xml is not nested anymore than the entry-info tags.
    My Problem:
    The info in the entry-info-tags sometimes contains illegal chars like <,>,& and is not wrapped
    properly by a CDATA section.
    So I need to find these elements and wrap them with <![CDATA[info]]> before using JAXB.
    How can I achieve this using Pattern/Matcher? I've been unsuccessful so far...
    Edited by: Samuelz on Jul 1, 2010 1:58 AM

    Heres what i've got so far:
    A helpful function to print out matches for regex on an input string:
    private static void printMathces(final String regex, final String input) {
         Pattern p = Pattern.compile(regex, Pattern.DOTALL);
         Matcher m = p.matcher(input);
         while (m.find()){
              System.out.println("found:");
              for (int i = 0; i < m.groupCount(); i++)
                   System.out.println(i + ":" + m.group(i));
    }My input string for testing:
    String s =
    "<entries>\n"+
         "<entry>\n" +
              "<TagName>sam&max</TagName>\n" +
         "</entry>\n" +
         "<entry>\n" +
              "<TagName><![CDATA[sam&max]]></TagName>\n" +
         "</entry>\n" +
    "</entries>\n";regex to get contents of TagName:
    printMatches("<(TagName)>((.*?))</\\1>+", s);
    found:
    0:<TagName>sam&max</TagName>
    1:TagName
    2:sam&max
    found:
    0:<TagName><![CDATA[sam&max]]></TagName>
    1:TagName
    2:<![CDATA[sam&max]]>regex to get content of TagName when its wrapped by CDATA
    printMathces("<(TagName)><!\\[CDATA\\[((.*?))\\]\\]></\\1>", s);
    found:
    0:<TagName><![CDATA[sam&max]]></TagName>
    1:TagName
    2:sam&maxI'm trying to build a regex that will find the contents of TagName without knowing if its already wrapped by CDATA and then replace these matches by something like <$1><![CDATA[$2]]</$1>
    How do I "combine" these 2 regular expressions?

  • Need help using Regex to parse street addresses

    Let me start off by stating three things:
    I suck at regex,
    I've googled this and didn't come up with an answer, and
    I'm on ColdFusion 10
    I have a form with an autocomplete input that allows a user to enter street addresses (either in full like "123 Main St, Mayberry" or in part like "123 Main St" or "Main St" or "Main St, Mayberry".  I need to tell if the user has provided a street number or not at the beginning of the value they enter into the input.  I'm trying to test the input value with this code:
    <cfif ReFind("^([0-9]{1-5})",q)>
         <!--- address starts with a number --->
    <cfelse>
         <!--- address doesn't start with a number --->
    </cfelse>
    q is the input value being passed into my code from the autocomplete function.
    x should be either 0 (if the input value doesn't start with a number) or a positive integer (if the input value does start with a number).
    Basically, I just need to know if the input value starts with one to five digits.
    I suppose I could just do something like:
    <cfif Val(q)>
    Am I better off using a regex, and if so, what am I doing wrong with the one I've tried?
    -Carl V.

    Oh man do I feel stupid!  I read the Adobe docs several times, and understood I needed a comma there, but I had a brain fart when I actually typed my code.  Thanks for the minor *headslap*!
    I had tried it without the parantheses before, and had added them when trying to troubleshoot.  I'll remove them from my working code.
    And I will check out your blog series on Regex.
    -Carl V.

  • In need of Regex help

    Hi,
    I've never used Regex before, and since I currently need to use it for a command-line parser in my server application I thought that I should try to see if anyone feels kind enough to take a couple of minutes and help me out (The regex tutorial is way complicated to get down and study for this tiny purpose).
    I need a regex that will be used with String.split to chop up an input string.
    If the string looks like: get 2.worm from bag
    the result should be:
    get
    2.worm
    from
    bag
    If the string looks like: cast "magic missile" 3.turtle
    the result should look like:
    cast
    magic missile
    3.turtle
    In short, it should never return any whitespace if it is not delimitered with ":s.
    Does it make any sense?
    Grateful for any help I can get.
    Sincerely
    /Viktor Klang

    Try this:
    import java.io.IOException;
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class Parser {     
         private static String REGEX          = "([^\\s\"]+)|(\"[^\"]+\")";
        private static String INPUT          = "cast \"magic missile\" 3.turtle";
        private Pattern pattern;
        private Matcher matcher;
        private List lineParts = new LinkedList();
         public void processString(String input) {
            String token = null;
              Integer value = null;
            while ( matcher.find() ) {
                 token = input.substring( matcher.start(), matcher.end() );
                 token = token.replaceAll( "\"", "" );
                 lineParts.add( token );
         public void printResults() {
              Object token = null;
              Integer value = null;
              for (Iterator iter = lineParts.iterator(); iter.hasNext();) {
                   String element = (String) iter.next();
                   System.out.println( element );
         public void doIt() throws IOException {
              pattern = Pattern.compile( REGEX );          
              matcher = pattern.matcher( INPUT );
              processString( INPUT );
              printResults();
         public static void main(String[] args) throws IOException {
              Parser parser = new Parser();
              parser.doIt();
    }

  • RegEx help requested.

    Hello, All.
    I am new to Java and I am not much familiar with Java regExp package as well. I am looking into it though. I have a specific question related to Reg Exp creation.
    We are in need of parsing a string like "XXX > 6 && YYY> 10" [Meaning variable XXX is greater than 6 and variable YYY is greater than 10 ] please note that this string/condition is dynamic and we need to support the normal operators and AND and OR operator for clubbing the condition.
    We are just thinking that whether regex will solve our problem? if so how it can be recommended used and what would be the sample of regex grammer?
    Thanks a lot in advance for your help.
    Best Regards,
    Prasanna.

    novice_questions wrote:
    Thanks for your reply. It may not have brackets in side the expression.
    LHS = will contain alphabets/digits and . [xxx.a1]
    RHS = [0-9]
    Operator can be [>,<]
    But this expression can be combined [AND,OR]
    like [exp]+[AND,OR][exp] ..some thing like this.
    Thanks,
    Prasanna.As already mentioned: you can't use regex for this. You either have to write your own parser or, if the expression stay as simple as you posted, use the existing script engine from Java 1.6.
    Here's a small demo:
    import javax.script.*;
    public class Test {
        public static void main(String[] args) throws Exception {
            ScriptEngine engine = new ScriptEngineManager().getEngineByName("js");
            String expression = "a > 2 && b < 2";
            engine.put("a", 3);
            engine.put("b", 1);
            System.out.println(engine.eval(expression));
    }

  • Flex Regex Help

    Hi there,
    I have a regular expression that is used to validate names in my application. It's intended to only allow alphanumeric names and spaces. My trouble started when I tried to modify it to also accept other unicode characters (umlauts and whatnot) On the java side of my app the following regex works great:
    "^(\\p{L}+\\p{M}*|\\d+)+\\s*((\\s+\\p{L}+\\p{M}*)*|(\\s+\\d+))*$"
    But due to, I'm guessing, lack of support for \p in AS3's regex engine this doesn't work. Does anyone know how to modify this regular expression to allow flex to recognize valid unicode characters?
    Here's one that I also thought would work but didn't maybe this will be helpful as a starting point.
    "^(\\w+|\\d+|[\\x00-\\x80]+)+\\s*((\\s+\\w+)*|(\\s+\\d+)|(\\s+[\\x00-\\x80]+)*)*$"
    Thanks in advance for any help.

    http://examples.adobe.com/flex3/componentexplorer/explorer.html
    http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExplorer.html#

  • Need Help Parsing JSON String using PLJSON

    Hello,
    I have JSON stored in a database field:
    --Query
    select data1 from table1 where id= 339207152427;
    --Results:
    [{"name":"Home"},{"code":"JPNWC74ZKW9"},{"start date":"01\/02\/2014"},{"person name":"hhh, RamS"}]
    I need to parse the above results into 3 fields in a separate table. For now, i'm just trying to parse the results using PLJSON, but am getting the ORA-20101: JSON Parser exception - no { start found error when running the following pl/sql block:
    declare
    VIN_JSON varchar2(4000);
    jsonObj json;
    listOfValues json_list;
    listElement json_value;
    begin
    select data1 into VIN_JSON from table1 where id= 339207152427;
    jsonObj := new json(VIN_JSON);
    listOfValues := jsonObj.get_values();
    for i in 1..listOfValues.count loop
    listElement := listOfValues.get(i);
    end loop;
    end;
    I believe my syntax is close, but was hoping for some further instruction.
    Thanks in advance!
    John

    I have no idea what you are trying to do or in what version so help, at this point, is not possible.
    Let's start with this:
    I need to parse the above results into 3 fields in a separate tableAnd the parsing rules?
    And what the result should be?
    You apparently want us to guess. Which is something most of us do not like to do. (and don't forget your full version number if you want help).
    PS: This forum has a FAQ: I recommend you read it as you didn't even put your listing into tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help parsing XML file

    Hi All,
    I have some troubles trying to load and parse a simple xml file like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <entry>
         <id>1</id>
    </entry>
    <entry>
         <id>2</id>
    </entry>
    With this few lines of code:
                var url:URLRequest = new URLRequest("myXML.xml");
                var xml:XML;
                var rss:URLLoader = new URLLoader();
                rss.load(url);
                rss.addEventListener(Event.COMPLETE, readRss);
                function readRss(e:Event):void{
                    xml = XML(rss.data);               
                    var ns:Namespace=xml.namespace();
                    txt_field.text=xml..ns::entry[0].ns::id;           
    I get this error: A conflict exists with inherited definition spark.components:Application.url in namespace public.
    in: var url:URLRequest = new URLRequest("myXML.xml");
    Please help me ...  thank you in advance.
    Michele

    Hi Michele,
    Try to use different name for your URLRequest object...It seems that there is conflict existing with the inherited url property of the Application and the one you declared so do the following..
    var _url:URLRequest = new URLRequest("myXML.xml");
    var xml:XML;
    var rss:URLLoader = new URLLoader();
    rss.load(_url);
    Thanks,
    Bhasker

  • Regex help please...need to grab a part of a string...

    Hi there,
    I have a dynamic form with dynamic fields and dynamic data types.
    What I want to do is check the data-type by grabbing it from the field name.
    For example, I have a field name called "formEmail[email]"
    The whole string is the field name, but I want to also extract the string between the square brackets. This will help me validate the field when it comes to submission. I will then compare it to a last of valid possibilities.
    How can I do this? I know it must require some regex but I have never looked into REGEX....my bad I know...but I promise I will in future!
    Mnay thanks,
    Mikey.

    Mikey,
    One question: Is the string 'formEmail[email]' the actual string (as opposed to being a variable that will get evaluated)?
    There are a lot of ways to go about this sort of task with regular expressions. If 'formEmail[email]' is an example of the type of strings you are searching, a regular expression along the lines of the following might be useful:
    <cfscript>
         mystring = "formEmail[email]";
         results = ReMatch( "[(\w*)]+", mystring );
    </cfscript>
    <cfdump var="#results#">
    <cfoutput>
         First match: #results[1]#<br />
         Second match: #results[2]#<br />
    </cfoutput>
    This regular expression finds all words in a string but does not match the brackets. \w is a special character that matches any word character -- including alphanumeric chars and underscores.
    The brackets used in the regular expression are also special characters for groupingt, which you can learn more about in the section of the CF WACK book mentioned JR's reply.
    If you run this snippet, you'll notice you get an array back. The first element of the array is the first match of the regexp, or the string 'formEmail', and the second element of the array is the second match of the regexp, or the string 'email'.
    This regular expression might be helpful if you don't have consistent text before the brackets but you know the string you'll search is formatted as: string[string].
    For example, the ReMatch expression above works the same for either of the strings below:
    formPhoneNumber[phone] (would return two strings: formPhoneNumber and phone)
    formEmail[email] (would return two strings: formEmail and email)
    As you delve into the world of Regular Expressions, be sure to grab RegExr, an Adobe AIR application for testing regular expressions. Very handy, especially coupled with a reading of the RegExp section in Forta's CF WACK book!
    http://gskinner.com/RegExr/desktop/

  • Please help parse XML

    First, the a sample XML to be parsed:
    <item name='HTMLContent_3'><richtext>
    <pardef id='1' leftmargin='1in' rightmargin='100%' tabs='L0.5000in L1in L1.5000in L2in L2.5000in L3in L3.5000in L4in'/>
    <par def='1'><p class="MsoBodyText">N.A.</p></par></richtext></item>This code is exported from a Lotus Domino database and represents a richtext field. I just want to export the text; in this case, that is the "N.A." and keep the line-breaks. Text formatting, bolding, etc. does not matter.
    Some <item> nodes are very long, with multiple <pardef> and <par def='1'> elements. Also, in my text editor greater than and less than symbols around the paragraph tag is listed as "<" and ">" (but I doubt that's a factor in the parsing).
    The <item> element is passed into the code sample below as Element e. I can get down to the <richtext> element with:
    Node child = e.getFirstChild();Then I can get the <pardef> and <par> nodes with:
    NodeList paragraphs = child.getChildNodes();But anything I try to get the text out of those nodes fails with a cast exception, prints out the XML, or doesn't do anything at all. Here is my current attempt:
    public static String getLongCharDataFromRichtext(Element e) {
         String answer = "";
         Node child = e.getFirstChild();     // Should be the <richtext> element.
         NodeList paragraphs = child.getChildNodes();
         for (int i=0; i<paragraphs.getLength(); i++) {
    //          String txt = paragraphs.item(i).toString();
    //          System.out.println(txt);
    //          answer += txt;
              Node paragraph = (Node)paragraphs.item(i);
              System.out.println(paragraph.toString());
    //          if (paragraph.getNodeType() == 3) {   // node type 3 is text node.
    //               String txt = paragraph.getNodeValue();
    //               String txt = getCharacterDataFromElement(paragraph);
    //               answer += txt;
         return answer;
    }I've been stumped on this for a while so I really, really appreciate your help!.
    -Jeff

    OK. I get what you're saying (including the hint that maybe this should have gone in the "New to Java" forum <G>). But now I'm having a second problem. The XML parser does not recognize the paragraph tags as an extra node on the tree.
    First, here is my current code:
    public static String getLongCharDataFromElement(Element e) {
         String answer = "";
         Node child = e.getFirstChild();     // Should be the <richtext> element.
         NodeList paragraphs = child.getChildNodes();
         for (int i=0; i<paragraphs.getLength(); i++) {
              Node paragraph = (Node)paragraphs.item(i);
              if (paragraph.getNodeName().equalsIgnoreCase("par")) {
                   Node theText = paragraph.getFirstChild();
                   String val = theText.getNodeValue();
                   System.out.println(val);
    }When I print out val, it prints the entire text of the paragraph tag (including the tag). I can't get a child node and I can't cast it to an Element or do anything.
    The XML parser I'm using is as follows:
    File file = new File("Answers.dxl");
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document doc = builder.parse(file);Why won't the parser recognize the paragraph tags as a new Node?
    Thanks,
    -Jeff

  • Help Parsing XML Mesage using PeopleCode

    Hi all,
    I'm new to web services and XML but was able to consume a WSDL and call the web service successfully.
    I'm now trying to parse the XML message I’m getting as a response and to extract values i need and having issues Parsing the response. Below is what I have done and the code from my Test AE. Basically I’m trying to navigate to the "Results" element in the response and then use GetChildNode to get child nodes and then use FindNode to find elements and their values.
    Here is the WSLD I consumed to create the web service in PS. I only need WSDL operation doSearch_3_15
    [https://www.epls.gov/epls/services/EPLSSearchWebService?wsdl ]
    My PC below calls the web service and passes last name “ZERMENO” as a search parameter and this should return 3 results back.
    I’m grabbing the reply back and parse it to extract the values I need.
    +&inXMLDoc = CreateXmlDoc("");+
    +&ret = &inXMLDoc.ParseXmlString(&reply.GenXMLString());+
    The issue I’m having is being able to get “inside” the results node (there are 3 of them) and loop through the child nodes and get my values.
    Code from Test AE:
    Local string &payload, &responseStr, &last;
    Local Message &msg, &reply;
    Local XmlDoc &xml, &inXMLDoc;
    Local array of XmlNode &GetElements, &RecordList, &field1List, &aResultsNode;
    Local XmlNode &RecordNode, &ClassificationNode;
    Local File &MYFILE;
    +&FilePath = "/psoft/fin9/fpsdv1/prod/ap/files/";+
    +&FileName = "uhc_report.xml";+
    +&MYFILE = GetFile(&FilePath | &FileName, "W", %FilePath_Absolute);+
    +&payload = "<?xml version='1.0'?> <doSearch xmlns='https://www.epls.gov/epls/services/EPLSSearchWebService'>";+
    +&first = "";+
    +&last = "ZERMENO";+
    +&payload = &payload | "<query><first>" | &first | "</first><last>" | &last | "</last></query> </doSearch>";+
    +&xml = CreateXmlDoc(&payload);+
    +&msg = CreateMessage(Operation.DOSEARCH_3_15, %IntBroker_Request);+
    +&msg.SetXmlDoc(&xml);+
    +&reply = %IntBroker.SyncRequest(&msg);+
    If All(&reply) Then
    If &MYFILE.IsOpen Then
    +&MYFILE.WriteString(&reply.GenXMLString());+
    Else
    MessageBox(0, "", 0, 0, "Can't Open File.");
    End-If;
    +&inXMLDoc = CreateXmlDoc("");+
    +&ret = &inXMLDoc.ParseXmlString(&reply.GenXMLString());+
    If &ret Then
    +&field1List = &inXMLDoc.GetElementsByTagName("results");+
    If &field1List.Len = 0 Then
    MessageBox(0, "", 0, 0, "GetElementsByTagName Node not found");
    Error ("GetElementsByTagName Node not found");
    +/* do error processing */+
    Else
    For &j = 1 To &field1List.Len
    If &j > 1 Then
    +MessageBox(0, "", 0, 0, &field1List [&j].NodeName | " = " | &field1List [&j].NodeValue);+
    +&RecordNode = &inXMLDoc.DocumentElement.GetChildNode(&j);+
    If &RecordNode.IsNull Then
    MessageBox(0, "", 0, 0, "GetChildNode not found");
    Else
    +&ClassificationNode = &RecordNode.FindNode("classification");+
    If &ClassificationNode.IsNull Then
    MessageBox(0, "", 0, 0, "FindNode not found");
    Else
    +&SDN_TYPE = Substring(&ClassificationNode.NodeValue, 1, 50);+
    MessageBox(0, "", 0, 0, "&SDN_TYPE = " | &SDN_TYPE);
    End-If;
    End-If;
    End-If;
    End-For;
    End-If;
    MessageBox(0, "", 0, 0, &inXMLDoc.DocumentElement.NodeName);
    Else
    +/* do error processing */+
    MessageBox(0, "", 0, 0, "Error. ParseXml");
    End-If;
    Else
    MessageBox(0, "", 0, 0, "Error. No reply");
    End-If;
    see link below for the XML reply web service message with some Notes. Also link for the response as an XML doc (had to add .txt to the xml extension to be able to upload it).  I appreciate your help and feedback.
    http://compshack.com/files/XML-Message.png
    http://compshack.com/files/uhc_report.xml_.txt
    And here is the output from my Test AE. I'm able to find 3 count of results, which i expected since I have 3 records coming back from the web service, but for what ever reason, GetChildNode is failing.
    results = (0,0)
    GetChildNode not found (0,0)
    results = (0,0)
    GetChildNode not found (0,0)
    results = (0,0)
    GetChildNode not found (0,0)
    Edited by: Maher on Mar 12, 2012 10:21 AM
    Edited by: Maher on Mar 12, 2012 10:41 AM

    Hi,
    I just took a closer look at the code and the looping using childnodes and findnode is not correct a bit overkill.
    You should really use the one or the other.
    I have created two other loops
    Loop 1, loop through all elements using Childnodes:
    Local string &payload, &responseStr, &last;
    Local Message &msg, &reply;
    Local XmlDoc &xml, &inXMLDoc;
    Local array of XmlNode &GetElements, &RecordList, &field1List, &aResultsNode;
    Local XmlNode &RecordNode, &ClassificationNode;
    Local File &MYFILE;
    &inXMLDoc = CreateXmlDoc("");
    &ret = &inXMLDoc.ParseXmlFromURL("c:\temp\test.xml");
    If &ret Then
       &field1List = &inXMLDoc.GetElementsByTagName("results");
       If &field1List.Len = 0 Then
          MessageBox(0, "", 0, 0, "GetElementsByTagName Node NOT found");
          Error ("GetElementsByTagName Node NOT found"); /* do error processing */
       Else
          For &j = 1 To &field1List.Len
             If &j > 1 Then
                MessageBox(0, "", 0, 0, &field1List [&j].NodeName | " = " | &field1List [&j].NodeValue);
                &RecordNode = &field1List [&j];
                &RecordChildNode = &RecordNode.GetChildNode(&j);
                If &RecordChildNode.IsNull Then
                   MessageBox(0, "", 0, 0, "GetChildNode NOT found");
                Else
                   MessageBox(0, "", 0, 0, "&RecordChildNode name:" | &RecordChildNode.NodeName);
                   If &RecordChildNode.NodeName = "classification" Then
                      MessageBox(0, "", 0, 0, "NodeName = " | &RecordChildNode.NodeName);
                      &SDN_TYPE = Substring(&RecordChildNode.NodeValue, 1, 50);
                      MessageBox(0, "", 0, 0, "&SDN_TYPE = " | &SDN_TYPE);
                   End-If;
                End-If;
             End-If;
          End-For;
       End-If;
       MessageBox(0, "", 0, 0, &inXMLDoc.DocumentElement.NodeName);
    Else /* do error processing */
       MessageBox(0, "", 0, 0, "Error. ParseXml");
    End-If;results = (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: results = (0,0) (0,0)
    &RecordChildNode name:address (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: &RecordChildNode name:address (0,0) (0,0)
    results = (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: results = (0,0) (0,0)
    &RecordChildNode name:agencyUID (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: &RecordChildNode name:agencyUID (0,0) (0,0)
    results = (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: results = (0,0) (0,0)
    &RecordChildNode name:classification (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: &RecordChildNode name:classification (0,0) (0,0)
    NodeName = classification (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: NodeName = classification (0,0) (0,0)
    &SDN_TYPE =
    Individual (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: &SDN_TYPE =
    Individual (0,0) (0,0)
    soapenv:Envelope (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: soapenv:Envelope (0,0) (0,0)
    Loop 2, look for classification node, using FindNode:
    Local string &payload, &responseStr, &last;
    Local Message &msg, &reply;
    Local XmlDoc &xml, &inXMLDoc;
    Local array of XmlNode &GetElements, &RecordList, &field1List, &aResultsNode;
    Local XmlNode &RecordNode, &ClassificationNode;
    Local File &MYFILE;
    &inXMLDoc = CreateXmlDoc("");
    &ret = &inXMLDoc.ParseXmlFromURL("c:\temp\test.xml");
    If &ret Then
       &field1List = &inXMLDoc.GetElementsByTagName("results");
       If &field1List.Len = 0 Then
          MessageBox(0, "", 0, 0, "GetElementsByTagName Node NOT found");
          Error ("GetElementsByTagName Node NOT found"); /* do error processing */
       Else
          For &j = 1 To &field1List.Len
             If &j > 1 Then
                &RecordNode = &field1List [&j];
                &ClassificationNode = &RecordNode.FindNode("classification");
                If &ClassificationNode.IsNull Then
                   MessageBox(0, "", 0, 0, "FindNode not found");
                Else
                   &SDN_TYPE = Substring(&ClassificationNode.NodeValue, 1, 50);
                   MessageBox(0, "", 0, 0, "&SDN_TYPE = " | &SDN_TYPE);
                End-If;
             End-If;
          End-For;
       End-If;
       MessageBox(0, "", 0, 0, &inXMLDoc.DocumentElement.NodeName);
    Else /* do error processing */
       MessageBox(0, "", 0, 0, "Error. ParseXml");
    End-If;&SDN_TYPE =
    Individual (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: &SDN_TYPE =
    Individual (0,0) (0,0)
    &SDN_TYPE =
    Individual (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: &SDN_TYPE =
    Individual (0,0) (0,0)
    &SDN_TYPE =
    Individual (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: &SDN_TYPE =
    Individual (0,0) (0,0)
    soapenv:Envelope (0,0)
    Message Set Number: 0
    Message Number: 0
    Message Reason: soapenv:Envelope (0,0) (0,0)
    As you can see, several possible solutions are possible.
    Hope this helps.
    Hakan

  • Help - Class name and descriptions for a function location.

    Hi Guys
    i have to write a report that displays the class and class descriptions for a function location. the user passes in either the function location(TPLNR) or the class name and  the report should display the the class characteristics and resp. values. Is there a FM that i coud use?
    please help.
    many thanks.
    seelan.

    sadiepu1 wrote:
    When I set up Words with Friends on my Fire it asked for my username and password which from a previous reply to my inquiry above stated that the S 3 doesn't store due to privacy issues. I have tried all my usual combinations of usernames and passwords and my Fire won't let me access the game as it keeps telling me that one or the other is not correct. I have deleted the app from my Fire and re-downloaded it but have the same error comes up. I have accessed the Words with Friends support both on my phone and their website but there is no live chat. I might have to take both to a Verizon store. Also, my Fire won't let me access the game without a correct username and password. To say that I am frustrated would be an understatement as well I have tried everything I can think of with no luck! Thanks for any help you can give!
    Did you use facebook to log in? 
    Verizon will not be able to help you retrieve any of the information you need.  You will have to contact Zynga.

  • Instrument I/O Assistant Help - Parsing Errors

    Hello All - 
    I am having trouble working with a TSI DustTrak DRX - which does not have its own driver so I had to make one.  At this point, all I want to do is send a command to the instrument and get an indicator to repeat what the output is.  So far no luck.
    1) I think my driver works. The instrument is connected via ethernet. The instrument has a static IP.  In MAX when I look under "Network -Devices" it appears there. "Validate" results in a successful connection. If I click on "Open VISA Test Panel/Input/Output" I am able to enter commands (e.g., rdmn\r returns the instrument number) and "Query" and the correct answer comes up. It should be noted that the number of bytes returned for different commands are different, and also that the measurement data is always of variable length, so I often get the "Timeout expired before operation completed" error.  For a simple read instrument number command, the number of bytes is predictable, but for the measurement data, it is not, unfortunately.
    2) When I put an "Instrument I/O assistant" on the block diagram of a new VI, and add a "Query and Parse" step with the same command (rdmn - no \r this time), I again get the expected value (or when I query the measurement, rmmeas, I get the expected output string). Again, it should be noted I get the "Timeout expired before operation completed.   VISA Status code : bfff0015" error. Once I close then reopen the Instrument I/O Assistant configuration window (though not before) I can parse the data, and the token appears as a potential output of the VI. Here I can declare the output as either String or Number.
    a) If I declare the output as a string and create a string idicator, an empty string is returned.
    b) If I declare the output as a number (it is "8533", so this should be OK), I get the following error (even without creating an indicator before running): "Error 1 occurred at Scan From String (arg 1) in Untitled 5:Instance:0->Untitled 5 Possible reason(s): LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @."  I know from MAX that the returned value is actuall 8 bytes: \r\n8533\r\n . So, there are no unallowed characters here. And there are no paths involved - no read/write.
    Some other info:
    1) If I send start or stop commands to the instrument in MAX or the Instrument IO Assistant, I can get the instrument to turn on/off as it should, so I'm clearly comunicating to the instrument correctly.
    2) I get the same behavior if I parse the returned measurement string  - \r\n385,0.013,0.014,0.015,0.020,0.035,\r\n from MAX - as a set of numbers (that is, with "Error 1 occurred at Scan From String (arg 1) in Untitled 5:Instance:0->Untitled 5 Possible reason(s): LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.")
    Any help would be appreciated!
    Thanks.

    Hi James -  Thank you very much.  I actually found the problem and was able to fix by changing how the output text was parsed - the \r\n in front and back was confusing it - and making sure that I flushed the read buffer after reading, just in case. I also had to modify so that the first character was read and discarded before reading (and using) the rest of the output string.
    Now for a rookie question:  I've got it set up as a working VI now - how do I declare which variables are inputs and outputs when I put it in another vi?
    Thanks.

Maybe you are looking for

  • Can't open old PDF's

    We recently got new updated computers but we kept some of our old files. I downloaded the adobe reader x and everything, I still can't open old PDF's (saved and unsaved ones like from my email). Something with Microsoft Word comes up, and all funny w

  • How can I fix my Ipod Touch thats been disabled and isnt detected in ITunes?

    My son gave me his 8GB Ipod Touch that he locked or disabled and it says to connect to ITunes but It dosnt show up on my computer or ITunes.Iv done everything suggested by Itunes support but still cant get it to work. Can someone tell me how to solve

  • Why can't I right-click and set desktop picture?

    Greetings. I am having a lot of trouble changing my desktop picture. From what I understand, you right-click the image and click on 'set as desktop picture'. I click it and nothing changes. I have tried to download the image and set it manually throu

  • Buggy Scroll Buttons in slideshow app

    I have no prior programming experience, and I am trying to build a slideshow program for my site. I am simultaneously amazed at how easy it is to do things I think are complex in Flex, and frustrated at how difficult it is to do some things I think s

  • Oracle connection is very slow

    Hello, I install oracle enterprise 5 and oracle 11g R2 and when i connect oracle from plsql developer connectoion is very very slow. What do you think about this problem ? i don't want to install oracle 11g on windows server !