List of utility methods to do XML Attribute Parse
void | mapOptionalBeanRefAttributes(Element element, BeanDefinitionBuilder builder, ParserContext parserContext, String... attrs) map Optional Bean Ref Attributes for (String attr : attrs) { String value = element.getAttribute(attr); if (StringUtils.hasText(value)) { String propertyName = Conventions.attributeNameToPropertyName(attr); if (validateProperty(element, parserContext, propertyName, attr)) { builder.addPropertyReference(propertyName, value); |
void | mapRequiredBeanRefAttributes(Element element, ParserContext parserContext, BeanDefinitionBuilder builder, String... attrs) map Required Bean Ref Attributes for (String attr : attrs) { String value = element.getAttribute(attr); if (!validateRequiredAttribute(element, parserContext, attr)) { return; String propertyName = Conventions.attributeNameToPropertyName(attr); if (validateProperty(element, parserContext, propertyName, attr)) { builder.addPropertyReference(propertyName, value); ... |
Map | parseAttributeValuePairTags(Node parentNode) parse Attribute Value Pair Tags NodeList avList = parentNode.getChildNodes(); Map map = null; int numAVPairs = avList.getLength(); if (numAVPairs <= 0) { return EMPTY_MAP; for (int l = 0; l < numAVPairs; l++) { Node avPair = avList.item(l); ... |
Boolean | parseBoolean(String xmlAttributeValue, Boolean invalidValue) parse Boolean if (xmlAttributeValue == null) return invalidValue; if (xmlAttributeValue.equals(Boolean.TRUE.toString())) { return Boolean.TRUE; } else if (xmlAttributeValue.equals(Boolean.FALSE.toString())) { return Boolean.FALSE; } else { return invalidValue; ... |
String[] | parseConfigAttr(NamedNodeMap attributes) parse Config Attr String key = attributes.getNamedItem("key").getTextContent(); String value = attributes.getNamedItem("value").getTextContent(); return new String[] { key, value }; |
String | parseElementAttributes(Element element) Aggregates all attributes from the given element, formats then into the proper key="value" XML format and returns them as one String if (element.hasAttributes() == false) { return null; StringBuffer buffer = new StringBuffer(); NamedNodeMap attributeMap = element.getAttributes(); for (int i = 0; i < attributeMap.getLength(); i++) { Node node = attributeMap.item(i); if (node.getNodeType() == Node.ATTRIBUTE_NODE) { ... |
float | parseFloat(Node xmlAttribute, float invalidValue) parse Float if (xmlAttribute == null) return invalidValue; return parseFloat(xmlAttribute.getNodeValue(), invalidValue); |
float | parseFloat(String attributeName, NamedNodeMap map) Parses the value of the given attribute as a float. org.w3c.dom.Node attr = map.getNamedItem(attributeName); try { return attr != null ? Float.parseFloat(attr.getTextContent()) : 0f; } catch (NumberFormatException ex) { return 0.0f; |
void | parseProtoypes(Node module, Node iFace, PrintWriter out, boolean onlyAttributes) Parse and write an interface with prototypes String outline = ""; Node child = null; writeDescription(out, iFace, " "); String interFaceName = getAttributeValue(iFace, "name"); out.println(" " + interFaceName + " = function () {"); out.println(" //TODO implement constructor logic if needed!"); out.println(); ArrayList<Node> attributes = getNodesByName("Attribute", iFace.getChildNodes()); ... |
String | parseString(final Element parent, final String attrName) Return the string value of an attribute, or null if the attribute is missing if (parent.hasAttribute(attrName)) { return parent.getAttribute(attrName); } else { return null; |