#85 Error parsing ADT_A17 XML message

closed-fixed
nobody
None
7
2009-06-13
2008-10-13
No

When I parse the attached ADT_A17 XML file using the 0.5.1 Message Tester, the ER7 that is generated incorrectly duplicates the PID and PVI segments and adds "22" to the segment names.

Discussion

  • Gerald Bortis

    Gerald Bortis - 2008-10-13

    ADT_A17 XML

     
  • Gerald Bortis

    Gerald Bortis - 2008-10-13
    • priority: 5 --> 7
     
  • alberto Sáez

    alberto Sáez - 2009-04-05

    This can be solved by changing some lines in the parseReps method at ca.uhn.hl7v2.parser.DefaultXMLParser

    if (reps.size() > 1) {
    String newIndexName = "";
    int i=1;
    try{
    for (i = 1; i < reps.size(); i++) {
    newIndexName=childName+(i+1);
    Structure st=groupObject.get(newIndexName);
    parseRep((Element) reps.get(i), st);
    }
    }catch(Throwable t){
    log.info("Issue Parsing: "+t);
    newIndexName = groupObject.addNonstandardSegment(childName);
    for (int j = i; j < reps.size(); j++) {
    parseRep((Element) reps.get(j), groupObject.get(newIndexName, j-i));
    }
    }
    }

    Instead of:

    if (reps.size() > 1) {
    String newIndexName = groupObject.addNonstandardSegment(childName);
    for (int i = 1; i < reps.size(); i++) {
    parseRep((Element) reps.get(i), groupObject.get(newIndexName, i-1));
    }
    }

     
  • Nobody/Anonymous

    With the previous code, it's needed to change one more line in the parse method of he same class:

    The next lines:

    for (int i = 0; i < childNames.length; i++) {
    unparsedElementList.remove(childNames[i]);
    parseReps(groupElement, groupObject, messageName, childNames[i], childNames[i]);
    }

    Should be changed to:

    for (int i = 0; i < childNames.length; i++) {
    unparsedElementList.remove(childNames[i]);
    if (childNames[i].length()!=4) parseReps(groupElement, groupObject, messageName, childNames[i], childNames[i]);
    }

     
  • James Agnew

    James Agnew - 2009-06-13

    Thank you both for your patches, these have been applied.

    Cheers!

     
  • James Agnew

    James Agnew - 2009-06-13
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks