Static parse method taking care of payload element.
@param payloadElement
769651
public static String parseMessagePayload(Element payloadElement) {
        if (payloadElement == null) {
            return "";
        }
        
        try {
            Document payload = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
            payload.appendChild(payload.importNode(payloadElement, true));

            String payloadData = XMLUtils.serialize(payload);
            // temporary quickfix for unwanted testcase namespace in target payload
            payloadData = payloadData.replaceAll(" xmlns=\\\"http://www.citrusframework.org/schema/testcase\\\"", "");
            return payloadData.trim();
        } catch (DOMException e) {
            throw new CitrusRuntimeException("Error while constructing message payload", e);
        } catch (ParserConfigurationException e) {
            throw new CitrusRuntimeException("Error while constructing message payload", e);
        }
    }
1369948
private void validateElementProperty(String propertyName, String controlValue, String resultValue, TestContext context) {
        if (StringUtils.hasText(controlValue)) {
            String control = context.replaceDynamicContentInString(controlValue);

            if (ValidationMatcherUtils.isValidationMatcherExpression(control)) {
                ValidationMatcherUtils.resolveValidationMatcher("payload", resultValue, control, context);
            } else {
                Assert.isTrue(control.equals(resultValue), String.format("Selenium web element validation failed, %s expected '%s', but was '%s'", propertyName, control, resultValue));
            }
        }
    }
978621
private void parseCT_RElt(XMLEventReader xmlEventReader, StringBuilder buf) throws XMLStreamException {
    // Precondition: pointing to <r>;  Post condition: pointing to </r>
    XMLEvent xmlEvent;
    while((xmlEvent = xmlEventReader.nextTag()).isStartElement()) {
      switch(xmlEvent.asStartElement().getName().getLocalPart()) {
        case "t": // Text
          buf.append(xmlEventReader.getElementText());
          break;
        case "rPr": // Run Properties
          skipElement(xmlEventReader);
          break;
        default:
          throw new IllegalArgumentException(xmlEvent.asStartElement().getName().getLocalPart());
      }
    }
  }
544773
function parseInLine(inLineElement) {
  var childNodes = inLineElement.childNodes;
  var ad = new Ad();
  ad.id = inLineElement.getAttribute('id') || null;
  ad.sequence = inLineElement.getAttribute('sequence') || null;

  for (var nodeKey in childNodes) {
    var node = childNodes[nodeKey];

    switch (node.nodeName) {
      case 'Error':
        ad.errorURLTemplates.push(parserUtils.parseNodeText(node));
        break;

      case 'Impression':
        ad.impressionURLTemplates.push(parserUtils.parseNodeText(node));
        break;

      case 'Creatives':
        parserUtils.childrenByName(node, 'Creative').forEach(function (creativeElement) {
          var creativeAttributes = {
            id: creativeElement.getAttribute('id') || null,
            adId: parseCreativeAdIdAttribute(creativeElement),
            sequence: creativeElement.getAttribute('sequence') || null,
            apiFramework: creativeElement.getAttribute('apiFramework') || null
          };

          for (var creativeTypeElementKey in creativeElement.childNodes) {
            var creativeTypeElement = creativeElement.childNodes[creativeTypeElementKey];
            var parsedCreative = void 0;

            switch (creativeTypeElement.nodeName) {
              case 'Linear':
                parsedCreative = parseCreativeLinear(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
              case 'NonLinearAds':
                parsedCreative = parseCreativeNonLinear(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
              case 'CompanionAds':
                parsedCreative = parseCreativeCompanion(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
            }
          }
        });
        break;

      case 'Extensions':
        parseExtensions(ad.extensions, parserUtils.childrenByName(node, 'Extension'));
        break;

      case 'AdSystem':
        ad.system = {
          value: parserUtils.parseNodeText(node),
          version: node.getAttribute('version') || null
        };
        break;

      case 'AdTitle':
        ad.title = parserUtils.parseNodeText(node);
        break;

      case 'Description':
        ad.description = parserUtils.parseNodeText(node);
        break;

      case 'Advertiser':
        ad.advertiser = parserUtils.parseNodeText(node);
        break;

      case 'Pricing':
        ad.pricing = {
          value: parserUtils.parseNodeText(node),
          model: node.getAttribute('model') || null,
          currency: node.getAttribute('currency') || null
        };
        break;

      case 'Survey':
        ad.survey = parserUtils.parseNodeText(node);
        break;
    }
  }

  return ad;
}
1287285
@Override
    public Module parse(final Element element, final Locale locale) {
        if (element.getChild("treatAs", NS) == null) {
            return null;
        }

        final SimpleListExtension sle = new SimpleListExtensionImpl();
        sle.setTreatAs(element.getChildText("treatAs", NS));

        final Element listInfo = element.getChild("listinfo", NS);
        ArrayList<Object> values = new ArrayList<Object>();
        for (final Element ge : listInfo.getChildren("group", NS)) {
            final Namespace ns = ge.getAttribute("ns") == null ? element.getNamespace() : Namespace.getNamespace(ge.getAttributeValue("ns"));
            final String elementName = ge.getAttributeValue("element");
            final String label = ge.getAttributeValue("label");
            values.add(new Group(ns, elementName, label));
        }

        sle.setGroupFields(values.toArray(new Group[values.size()]));
        values = values.size() == 0 ? values : new ArrayList<Object>();

        for (final Element se : listInfo.getChildren("sort", NS)) {
            LOG.debug("Parse cf:sort {}{}", se.getAttributeValue("element"), se.getAttributeValue("data-type"));
            final Namespace ns = se.getAttributeValue("ns") == null ? element.getNamespace() : Namespace.getNamespace(se.getAttributeValue("ns"));
            final String elementName = se.getAttributeValue("element");
            final String label = se.getAttributeValue("label");
            final String dataType = se.getAttributeValue("data-type");
            final boolean defaultOrder = se.getAttributeValue("default") == null ? false : new Boolean(se.getAttributeValue("default")).booleanValue();
            values.add(new Sort(ns, elementName, dataType, label, defaultOrder));
        }

        sle.setSortFields(values.toArray(new Sort[values.size()]));
        insertValues(sle, element.getChildren());

        return sle;
    }
639249
def parse(cls, payload):
        
        try:
            method, args, ref = payload
        except Exception as exception:
            raise RequestParseError(exception)
        else:
            return method, args, ref
82725
private static void parseListeners(final Element rootElement,
									   final WebApp webApp) {
		final Element[] elements = getChildren(rootElement, "listener");
		Arrays.stream(elements).forEach(element ->
				addWebListener(webApp, getTextContent(getChild(element, "listener-class"))));
	}
904349
protected
  void parseCategory (Element loggerElement) {
    // Create a new org.apache.log4j.Category object from the <category> element.
    String catName = subst(loggerElement.getAttribute(NAME_ATTR));

    Logger cat;    

    String className = subst(loggerElement.getAttribute(CLASS_ATTR));


    if(EMPTY_STR.equals(className)) {
      LogLog.debug("Retreiving an instance of org.apache.log4j.Logger.");
      cat = (catFactory == null) ? repository.getLogger(catName) : repository.getLogger(catName, catFactory);
    }
    else {
      LogLog.debug("Desired logger sub-class: ["+className+']');
       try {	 
	 Class clazz = Loader.loadClass(className);
	 Method getInstanceMethod = clazz.getMethod("getLogger", 
						    ONE_STRING_PARAM);
	 cat = (Logger) getInstanceMethod.invoke(null, new Object[] {catName});
       } catch (Exception oops) {
	 LogLog.error("Could not retrieve category ["+catName+
		      "]. Reported error follows.", oops);
	 return;
       }
    }

    // Setting up a category needs to be an atomic operation, in order
    // to protect potential log operations while category
    // configuration is in progress.
    synchronized(cat) {
      boolean additivity = OptionConverter.toBoolean(
                           subst(loggerElement.getAttribute(ADDITIVITY_ATTR)),
			   true);
    
      LogLog.debug("Setting ["+cat.getName()+"] additivity to ["+additivity+"].");
      cat.setAdditivity(additivity);
      parseChildrenOfLoggerElement(loggerElement, cat, false);
    }
  }
991148
public List<ADStructure> parse(byte[] payload)
    {
        if (payload == null)
        {
            return null;
        }

        return parse(payload, 0, payload.length);
    }
81415
protected void parseChildElements(String elementName, BaseElement parentElement, BpmnModel model, XMLStreamReader xtr) throws Exception {
    parseChildElements(elementName, parentElement, null, model, xtr);
  }
191038
protected static String getElement(JWTPayload payload, String element) {
        String output = null;
        if (payload != null) {
            Object outObj = payload.get(element);
            if (outObj instanceof String) {
                output = (String) outObj;
            } else if (outObj instanceof List) {
                if (((List<String>) outObj).size() == 1) {
                    output = ((List<String>) outObj).get(0);
                }
                // if there are multiple values, return null.
            }
        }
        return output;
    }
266491
public static void parseOutputParameterElement(Element outputParameterElement, IoMapping ioMapping) {
    String nameAttribute = outputParameterElement.attribute("name");
    if(nameAttribute == null || nameAttribute.isEmpty()) {
      throw new BpmnParseException("Missing attribute 'name' for outputParameter", outputParameterElement);
    }

    ParameterValueProvider valueProvider = parseNestedParamValueProvider(outputParameterElement);

    // add parameter
    ioMapping.addOutputParameter(new OutputParameter(nameAttribute, valueProvider));
  }
673435
public void startElement(String namespaceURI, String localName,
                             String qName, Attributes atts) throws SAXException {
        trace("startElement:" + localName + "~" + qName);
        Element newElement = createElement(namespaceURI, qName, atts);
        appendNode(newElement);
        currentElement = newElement;
    }
1297105
public void sendPayload(String payload) {
		MessageEnvelope envelope = new MessageEnvelope();
		Postback postback = new Postback();

		postback.setPayload(payload);
		envelope.setPostback(postback);
		envelope.setSender(new User(facebookMockId));

		System.out.println("Sending payload: [" + payload + "] as user : ["
				+ facebookMockId + "].");
		forward(envelope);
		System.out.println("Sent!");
	}
791667
@Override
    public void startElement(String namespace, String localName, String qName, Attributes attributes) throws SAXException {

        if (skipElementUntil != null) {
            elementStack.push(skippableElement);
            return;
        }

        boolean mixedContent = detectMixedContent();

        if (builder.xsiTypeSupport && attributes.getValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
            String type = attributes.getValue("http://www.w3.org/2001/XMLSchema-instance", "type");

            if (type.contains(":")) {
                String[] split = type.split(":");
                namespace = prefixUriMap.get(split[0]);
                localName = split[1];
            } else {
                localName = type;
            }
        }

        Element<ResourceType, Datatype> element = new Element<>(this, builder);
        element.index = index++;

        namespace = calculateNamespace(namespace);

        element.setType(namespace + localName);

        if (builder.skipElementMap != null && builder.skipElementMap.containsKey(element.getType())) {
            skipElementUntil = element;
            elementStack.push(element);
            return;
        }


        Element<ResourceType, Datatype> parent = null;

        if (!elementStack.isEmpty()) {
            parent = elementStack.peek();
            if (builder.addIndex) {
                element.elementIndex = parent.indexMap.plusPlus(element.getType());
            }
            parent.hasChild.add(element);
            if(builder.useHashmapForChildren){
                parent.hasChildMap.put(element.getType(), element);
            }
            if (mixedContent) {
                parent.addMixedContent(element);
            }

        }

        element.parent = parent;

        renameElement(namespace, localName, element);

        if (builder.forcedMixedContentMap != null &&
            builder.forcedMixedContentMap.containsKey(element.getType())) {

            element.containsMixedContent = true;
        }


        if (builder.compositeIdMap != null) {

            CompositeId compositeId = builder.compositeIdMap.get(element.getType());
            if (compositeId == null) {
                calculateNodeId(element);
            } else {
                element.compositeId = compositeId.simpleClone();
                if(element.compositeId.elementIndex){
                    element.compositeId.reolveElementIndex(XmlToRdfVocabulary.index, element.index);
                    element.compositeId.reolveElementIndex(XmlToRdfVocabulary.elementIndex, element.elementIndex);
                }

            }

        } else {
            calculateNodeId(element);
        }

        handleAttributes(namespace, attributes, element);

        if (builder.useElementAsPredicateMap != null && builder.useElementAsPredicateMap.containsKey(element.getType())) {
            element.useElementAsPredicate = true;
        }

        builder.doComplexTransformElementAtStartOfElement(element);


        elementStack.push(element);

    }
458826
protected
  Appender parseAppender (Element appenderElement) {
    String className = subst(appenderElement.getAttribute(CLASS_ATTR));
    LogLog.debug("Class name: [" + className+']');    
    try {
      Object instance 	= Loader.loadClass(className).newInstance();
      Appender appender	= (Appender)instance;
      PropertySetter propSetter = new PropertySetter(appender);

      appender.setName(subst(appenderElement.getAttribute(NAME_ATTR)));
      
      NodeList children	= appenderElement.getChildNodes();
      final int length 	= children.getLength();

      for (int loop = 0; loop < length; loop++) {
	Node currentNode = children.item(loop);

	/* We're only interested in Elements */
	if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
	  Element currentElement = (Element)currentNode;

	  // Parse appender parameters 
	  if (currentElement.getTagName().equals(PARAM_TAG)) {
            setParameter(currentElement, propSetter);
	  }
	  // Set appender layout
	  else if (currentElement.getTagName().equals(LAYOUT_TAG)) {
	    appender.setLayout(parseLayout(currentElement));
	  }
	  // Add filters
	  else if (currentElement.getTagName().equals(FILTER_TAG)) {
	    parseFilters(currentElement, appender);
	  }
	  else if (currentElement.getTagName().equals(ERROR_HANDLER_TAG)) {
	    parseErrorHandler(currentElement, appender);
	  }
	  else if (currentElement.getTagName().equals(APPENDER_REF_TAG)) {
	    String refName = subst(currentElement.getAttribute(REF_ATTR));
	    if(appender instanceof AppenderAttachable) {
	      AppenderAttachable aa = (AppenderAttachable) appender;
	      LogLog.debug("Attaching appender named ["+ refName+
			   "] to appender named ["+ appender.getName()+"].");
	      aa.addAppender(findAppenderByReference(currentElement));
	    } else {
	      LogLog.error("Requesting attachment of appender named ["+
			   refName+ "] to appender named ["+ appender.getName()+
                "] which does not implement org.apache.log4j.spi.AppenderAttachable.");
	    }
	  } else {
          parseUnrecognizedElement(instance, currentElement, props);
      }
	}
      }
      propSetter.activate();
      return appender;
    }
    /* Yes, it's ugly.  But all of these exceptions point to the same
       problem: we can't create an Appender */
    catch (Exception oops) {
      LogLog.error("Could not create an Appender. Reported error follows.",
		   oops);
      return null;
    }
  }
942248
private void parseFault(BeanDefinitionBuilder builder, Element faultElement) {
        if (faultElement != null) {
            Element faultCodeElement = DomUtils.getChildElementByTagName(faultElement, "fault-code");
            if (faultCodeElement != null) {
                builder.addPropertyValue("faultCode", DomUtils.getTextValue(faultCodeElement).trim());
            }

            Element faultStringElement = DomUtils.getChildElementByTagName(faultElement, "fault-string");
            if (faultStringElement != null) {
                builder.addPropertyValue("faultString", DomUtils.getTextValue(faultStringElement).trim());
            }

            Element faultActorElement = DomUtils.getChildElementByTagName(faultElement, "fault-actor");
            if (faultActorElement != null) {
                builder.addPropertyValue("faultActor", DomUtils.getTextValue(faultActorElement).trim());
            }

            parseFaultDetail(builder, faultElement);
        }
    }