Program: 23239
Project: 23239
Buggy source:
private void parseChildren(String path,org.w3c.dom.Element node,Element context) throws FHIRFormatError, FHIRException, IOException, DefinitionException {
  reapComments(node,context);
  List<Property> properties=context.getProperty().getChildProperties(context.getName(),XMLUtil.getXsiType(node));
  String text=XMLUtil.getDirectText(node).trim();
  if (!Utilities.noString(text)) {
    Property property=getTextProp(properties);
    if (property != null) {
      context.getChildren().add(new Element(property.getName(),property,property.getType(),text).markLocation(line(node),col(node)));
    }
 else {
      logError(line(node),col(node),path,IssueType.STRUCTURE,"String_Node_Str",IssueSeverity.ERROR);
    }
  }
  for (int i=0; i < node.getAttributes().getLength(); i++) {
    Node attr=node.getAttributes().item(i);
    if (!(attr.getNodeName().equals("String_Node_Str") || attr.getNodeName().startsWith("String_Node_Str"))) {
      Property property=getAttrProp(properties,attr.getNodeName());
      if (property != null) {
        String av=attr.getNodeValue();
        if (ToolingExtensions.hasExtension(property.getDefinition(),"String_Node_Str"))         av=convertForDateFormat(ToolingExtensions.readStringExtension(property.getDefinition(),"String_Node_Str"),av);
        if (property.getName().equals("String_Node_Str") && context.isPrimitive())         context.setValue(av);
 else         context.getChildren().add(new Element(property.getName(),property,property.getType(),av).markLocation(line(node),col(node)));
      }
 else       if (!allowXsiLocation || !attr.getNodeName().endsWith("String_Node_Str")) {
        logError(line(node),col(node),path,IssueType.STRUCTURE,"String_Node_Str" + attr.getNodeName() + "String_Node_Str"+ node.getNodeName(),IssueSeverity.ERROR);
      }
    }
  }
  Node child=node.getFirstChild();
  while (child != null) {
    if (child.getNodeType() == Node.ELEMENT_NODE) {
      Property property=getElementProp(properties,child.getLocalName());
      if (property != null) {
        if (!property.isChoice() && "String_Node_Str".equals(property.getType())) {
          XhtmlNode xhtml=new XhtmlParser().setValidatorMode(true).parseHtmlNode((org.w3c.dom.Element)child);
          context.getChildren().add(new Element("String_Node_Str",property,"String_Node_Str",new XhtmlComposer().setXmlOnly(true).compose(xhtml)).setXhtml(xhtml).markLocation(line(child),col(child)));
        }
 else {
          String npath=path + "String_Node_Str" + pathPrefix(child.getNamespaceURI())+ child.getLocalName();
          Element n=new Element(child.getLocalName(),property).markLocation(line(child),col(child));
          checkElement((org.w3c.dom.Element)child,npath,n.getProperty());
          boolean ok=true;
          if (property.isChoice()) {
            if (property.getDefinition().hasRepresentation(PropertyRepresentation.TYPEATTR)) {
              String xsiType=((org.w3c.dom.Element)child).getAttributeNS(FormatUtilities.NS_XSI,"String_Node_Str");
              if (xsiType == null) {
                logError(line(child),col(child),path,IssueType.STRUCTURE,"String_Node_Str" + child.getLocalName() + '"',IssueSeverity.ERROR);
                ok=false;
              }
 else {
                if (xsiType.contains("String_Node_Str"))                 xsiType=xsiType.substring(xsiType.indexOf("String_Node_Str") + 1);
                n.setType(xsiType);
              }
            }
 else             n.setType(n.getType());
          }
          context.getChildren().add(n);
          if (ok) {
            if (property.isResource())             parseResource(npath,(org.w3c.dom.Element)child,n,property);
 else             parseChildren(npath,(org.w3c.dom.Element)child,n);
          }
        }
      }
 else       logError(line(child),col(child),path,IssueType.STRUCTURE,"String_Node_Str" + child.getLocalName() + '"',IssueSeverity.ERROR);
    }
 else     if (child.getNodeType() == Node.CDATA_SECTION_NODE) {
      logError(line(child),col(child),path,IssueType.STRUCTURE,"String_Node_Str",IssueSeverity.ERROR);
    }
 else     if (!Utilities.existsInList(child.getNodeType(),3,8)) {
      logError(line(child),col(child),path,IssueType.STRUCTURE,"String_Node_Str" + Integer.toString(child.getNodeType()) + "String_Node_Str",IssueSeverity.ERROR);
    }
    child=child.getNextSibling();
  }
}

Fixed version (ground truth):
private void parseChildren(String path,org.w3c.dom.Element node,Element context) throws FHIRFormatError, FHIRException, IOException, DefinitionException {
  reapComments(node,context);
  List<Property> properties=context.getProperty().getChildProperties(context.getName(),XMLUtil.getXsiType(node));
  String text=XMLUtil.getDirectText(node).trim();
  if (!Utilities.noString(text)) {
    Property property=getTextProp(properties);
    if (property != null) {
      context.getChildren().add(new Element(property.getName(),property,property.getType(),text).markLocation(line(node),col(node)));
    }
 else {
      logError(line(node),col(node),path,IssueType.STRUCTURE,"String_Node_Str",IssueSeverity.ERROR);
    }
  }
  for (int i=0; i < node.getAttributes().getLength(); i++) {
    Node attr=node.getAttributes().item(i);
    if (!(attr.getNodeName().equals("String_Node_Str") || attr.getNodeName().startsWith("String_Node_Str"))) {
      Property property=getAttrProp(properties,attr.getNodeName());
      if (property != null) {
        String av=attr.getNodeValue();
        if (ToolingExtensions.hasExtension(property.getDefinition(),"String_Node_Str"))         av=convertForDateFormat(ToolingExtensions.readStringExtension(property.getDefinition(),"String_Node_Str"),av);
        if (property.getName().equals("String_Node_Str") && context.isPrimitive())         context.setValue(av);
 else         context.getChildren().add(new Element(property.getName(),property,property.getType(),av).markLocation(line(node),col(node)));
      }
 else       if (!allowXsiLocation || !attr.getNodeName().endsWith("String_Node_Str")) {
        logError(line(node),col(node),path,IssueType.STRUCTURE,"String_Node_Str" + attr.getNodeName() + "String_Node_Str"+ node.getNodeName(),IssueSeverity.ERROR);
      }
    }
  }
  Node child=node.getFirstChild();
  while (child != null) {
    if (child.getNodeType() == Node.ELEMENT_NODE) {
      Property property=getElementProp(properties,child.getLocalName());
      if (property != null) {
        if (!property.isChoice() && "String_Node_Str".equals(property.getType())) {
          XhtmlNode xhtml=new XhtmlParser().setValidatorMode(true).parseHtmlNode((org.w3c.dom.Element)child);
          context.getChildren().add(new Element("String_Node_Str",property,"String_Node_Str",new XhtmlComposer().setXmlOnly(true).compose(xhtml)).setXhtml(xhtml).markLocation(line(child),col(child)));
        }
 else {
          String npath=path + "String_Node_Str" + pathPrefix(child.getNamespaceURI())+ child.getLocalName();
          Element n=new Element(child.getLocalName(),property).markLocation(line(child),col(child));
          checkElement((org.w3c.dom.Element)child,npath,n.getProperty());
          boolean ok=true;
          if (property.isChoice()) {
            if (property.getDefinition().hasRepresentation(PropertyRepresentation.TYPEATTR)) {
              String xsiType=((org.w3c.dom.Element)child).getAttributeNS(FormatUtilities.NS_XSI,"String_Node_Str");
              if (xsiType == null) {
                logError(line(child),col(child),path,IssueType.STRUCTURE,"String_Node_Str" + child.getLocalName() + '"',IssueSeverity.ERROR);
                ok=false;
              }
 else {
                if (xsiType.contains("String_Node_Str"))                 xsiType=xsiType.substring(xsiType.indexOf("String_Node_Str") + 1);
                n.setType(xsiType);
              }
            }
 else             n.setType(n.getType());
          }
          context.getChildren().add(n);
          if (ok) {
            if (property.isResource())             parseResource(npath,(org.w3c.dom.Element)child,n,property);
 else             parseChildren(npath,(org.w3c.dom.Element)child,n);
          }
        }
      }
 else       logError(line(child),col(child),path,IssueType.STRUCTURE,"String_Node_Str" + child.getLocalName() + "String_Node_Str",IssueSeverity.ERROR);
    }
 else     if (child.getNodeType() == Node.CDATA_SECTION_NODE) {
      logError(line(child),col(child),path,IssueType.STRUCTURE,"String_Node_Str",IssueSeverity.ERROR);
    }
 else     if (!Utilities.existsInList(child.getNodeType(),3,8)) {
      logError(line(child),col(child),path,IssueType.STRUCTURE,"String_Node_Str" + Integer.toString(child.getNodeType()) + "String_Node_Str",IssueSeverity.ERROR);
    }
    child=child.getNextSibling();
  }
}