Class XmlHelper
- java.lang.Object
-
- com.yahoo.config.model.builder.xml.XmlHelper
-
public final class XmlHelper extends Object
Static methods for helping dom building- Author:
- bratseth
-
-
Field Summary
Fields Modifier and Type Field Description static DocumentBuilderFactory
factory
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Document
getDocument(Reader reader)
static DocumentBuilder
getDocumentBuilder()
Creates a new XML document builder.static com.yahoo.component.ComponentId
getId(Element element)
static com.yahoo.component.ComponentSpecification
getIdRef(Element element)
static String
getIdString(Element element)
For searchers inside search chains, the id may be both a reference and an id at once, or just a reference.static Optional<String>
getOptionalAttribute(Element element, String name)
static Optional<Element>
getOptionalChild(Element parent, String childName)
static Optional<String>
getOptionalChildValue(Element parent, String childName)
static boolean
isReference(Element element)
static String
nullIfEmpty(String attribute)
static List<String>
spaceSeparatedSymbols(String field)
static Collection<String>
spaceSeparatedSymbolsFromAttribute(Element spec, String name)
static List<String>
splitAndDiscardEmpty(String field, String regex)
static Collection<String>
valuesFromElements(Element parent, String elementName)
-
-
-
Field Detail
-
factory
public static final DocumentBuilderFactory factory
-
-
Method Detail
-
getIdString
public static String getIdString(Element element)
For searchers inside search chains, the id may be both a reference and an id at once, or just a reference. In other cases, it is clear which one it is from context, so I think the difference is not worth bothering users with, unless they are XML purists in which case they will have the option of writing this correctly. - Jon
-
getId
public static com.yahoo.component.ComponentId getId(Element element)
-
getIdRef
public static com.yahoo.component.ComponentSpecification getIdRef(Element element)
-
spaceSeparatedSymbolsFromAttribute
public static Collection<String> spaceSeparatedSymbolsFromAttribute(Element spec, String name)
-
valuesFromElements
public static Collection<String> valuesFromElements(Element parent, String elementName)
-
isReference
public static boolean isReference(Element element)
-
getDocumentBuilder
public static DocumentBuilder getDocumentBuilder()
Creates a new XML document builder.- Returns:
- A new DocumentBuilder instance, or null if we fail to get one.
-
getOptionalAttribute
public static Optional<String> getOptionalAttribute(Element element, String name)
-
getOptionalChild
public static Optional<Element> getOptionalChild(Element parent, String childName)
-
-