Static parse method taking care of basic message element parsing.

@param messageElement
5087
public AbstractMessageContentBuilder constructMessageBuilder(Element messageElement) {
        AbstractMessageContentBuilder messageBuilder = null;
        
        if (messageElement != null) {
            messageBuilder = parsePayloadTemplateBuilder(messageElement);
            
            if (messageBuilder == null) {
                messageBuilder = parseScriptBuilder(messageElement);
            }
        }

        if (messageBuilder == null) {
            messageBuilder = new PayloadTemplateMessageBuilder();
        }

        if (messageElement != null && messageElement.hasAttribute("name")) {
            messageBuilder.setMessageName(messageElement.getAttribute("name"));
        }

        return messageBuilder;
    }
1073575
@Override
	public boolean process(Set<? extends TypeElement> elements,
			RoundEnvironment environment) {
		Messager messager = processingEnv.getMessager();
		
		for (TypeElement element : elements) {
			Set<? extends Element> elementsAnnotatedWith = environment.getElementsAnnotatedWith(element);
			
			for (Element elementAnnotatedWith : elementsAnnotatedWith) {
				TypeElement typeElement = (TypeElement) elementAnnotatedWith;
				EntityValidator validator = new EntityValidator(processingEnv.getTypeUtils());
				List<Problem> problems = validator.validate(typeElement);
				
//				for (Problem problem : problems) {
//					System.out.println(problem);
//				}
				
				boolean error = false;
				
				for (Problem problem : problems) {
					if (problem.kind() == Kind.ERROR) {
						error = true;
					}
					
					messager.printMessage(problem.kind(), problem.message(), problem.element());
				}
				
				if (!error) {
					MetamodelSource source = new MetamodelSource(typeElement, processingEnv);
					
					try {
						source.save();
					} catch (Exception e) {
						messager.printMessage(Kind.ERROR, "Metamodel ["
								+ source.toMetamodelName(typeElement.getQualifiedName().toString())
								+ "] cannot be saved due to [" + e + "]",
								typeElement);
						e.printStackTrace();
					}
				}
			}
		}
		
		return true;
	}
489428
@Override
    public void addComment(XmlElement xmlElement) {
        xmlElement.addElement(new TextElement("<!--"));
        StringBuilder sb = new StringBuilder();
        sb.append("  WARNING - ");
        sb.append(MergeConstants.NEW_ELEMENT_TAG);
        xmlElement.addElement(new TextElement(sb.toString()));
        xmlElement.addElement(new TextElement("-->"));
    }
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);
    }
  }
192623
void asPresentationML(XmlPrintStream out) {
    out.openElement(getMessageMLTag(), getAttributes());

    for (Element child : getChildren()) {
      child.asPresentationML(out);
    }

    out.closeElement();
  }
213500
private void initMessageKeyHandler(Element element) {

        String className = element.attributeValue(APPINFO_ATTR_CLASS);
        String configuration = element.attributeValue(APPINFO_ATTR_CONFIGURATION);
        try {
            Object messageKeyHandler = Class.forName(className).getConstructor(String.class).newInstance(configuration);
            m_messageKeyHandler = (CmsMultiMessages.I_KeyFallbackHandler)messageKeyHandler;
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
    }
906407
public static void w(String msg, Element element) {
		messager.printMessage(Diagnostic.Kind.WARNING, msg, element);
	}
1266577
private function assertElementText($condition, $message, Element $element)
    {
        if ($condition) {
            return;
        }

        throw new ElementTextException($message, $this->session->getDriver(), $element);
    }
130536
public static void ensureChildElement(DomXmlElement parentElement, DomXmlElement childElement) {
    Node parent = childElement.unwrap().getParentNode();
    if (parent == null || !parentElement.unwrap().isEqualNode(parent)) {
      throw LOG.elementIsNotChildOfThisElement(childElement, parentElement);
    }
  }
31855
private JsonPathMessageValidationContext getJsonPathMessageValidationContext(Element messageElement) {
        JsonPathMessageValidationContext context = new JsonPathMessageValidationContext();

        //check for validate elements, these elements can either have script, jsonPath or namespace validation information
        //for now we only handle jsonPath validation
        Map<String, Object> validateJsonPathExpressions = new HashMap<>();
        List<?> validateElements = DomUtils.getChildElementsByTagName(messageElement, "validate");
        if (validateElements.size() > 0) {
            for (Iterator<?> iter = validateElements.iterator(); iter.hasNext();) {
                Element validateElement = (Element) iter.next();
                extractJsonPathValidateExpressions(validateElement, validateJsonPathExpressions);
            }

            context.setJsonPathExpressions(validateJsonPathExpressions);
        }

        return context;
    }
568571
@Override
    public Module parse(final Element elem, final Locale locale) {
        final AppModule m = new AppModuleImpl();
        final Element control = elem.getChild("control", getContentNamespace());
        if (control != null) {
            final Element draftElem = control.getChild("draft", getContentNamespace());
            if (draftElem != null) {
                if ("yes".equals(draftElem.getText())) {
                    m.setDraft(Boolean.TRUE);
                }
                if ("no".equals(draftElem.getText())) {
                    m.setDraft(Boolean.FALSE);
                }
            }
        }
        final Element edited = elem.getChild("edited", getContentNamespace());
        if (edited != null) {
            try {
                m.setEdited(DateParser.parseW3CDateTime(edited.getTextTrim(), locale));
            } catch (final Exception ignored) {
            }
        }
        return m;
    }
355529
protected final void warning(Element e, String msg, Object... args) {
        if (messager == null) {
            illegalState();
        }
        messager.printMessage(Diagnostic.Kind.WARNING, String.format(msg, args), e);
    }
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"))));
	}
700610
private void parse()
    {
        this.elements = new ArrayList<>();

        try {
            for (Tokenizer tokenizer = new Tokenizer(this.rawVersion); tokenizer.next();) {
                Element element = new Element(tokenizer);
                this.elements.add(element);
                if (element.getVersionType() != Type.STABLE) {
                    this.type = element.getVersionType();
                }
            }

            trimPadding(this.elements);
        } catch (Exception e) {
            // Make sure to never fail no matter what
            LOGGER.error("Failed to parse version [" + this.rawVersion + "]", e);
            this.elements.add(new Element(this.rawVersion));
        }
    }
173266
private String getElementText(Element element) {
        Node node = element.getFirstChild();
        if (node == null || node.getNodeType() != Node.TEXT_NODE) {
            return null;
        }
        return node.getNodeValue().trim();
    }
825416
private String parseXmlElement(Element element) {
        if(element.getFirstChild() instanceof Text) {
            Text text = (Text) element.getFirstChild();
            return text.getData();
        }
       
        return toXml(element);
    }
1323803
public static void e(String msg, Element element) {
		messager.printMessage(Diagnostic.Kind.ERROR, msg, element);
	}