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 Details

  • Method Details

    • nullIfEmpty

      public static String nullIfEmpty(String attribute)
    • 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)
    • getDocument

      public static Document getDocument(Reader reader)
    • getDocument

      public static Document getDocument(Reader reader, String source)
    • splitAndDiscardEmpty

      public static List<String> splitAndDiscardEmpty(String field, String regex)
    • spaceSeparatedSymbols

      public static List<String> spaceSeparatedSymbols(String field)
    • 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)
    • getOptionalChildValue

      public static Optional<String> getOptionalChildValue(Element parent, String childName)