public final class XmlElement extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_NAMESPACE_PREFIX |
public static final String DEFAULT_NAMESPACE_PREFIX
public static XmlElement fromDomElement(Element e)
public static XmlElement fromDomDocument(Document xml)
public static XmlElement fromString(String s) throws DocumentedException
DocumentedException
public static XmlElement fromDomElementWithExpected(Element element, String expectedName) throws DocumentedException
DocumentedException
public static XmlElement fromDomElementWithExpected(Element element, String expectedName, String expectedNamespace) throws DocumentedException
DocumentedException
public void checkName(String expectedName) throws UnexpectedElementException
UnexpectedElementException
public void checkNamespaceAttribute(String expectedNamespace) throws UnexpectedNamespaceException, MissingNameSpaceException
public void checkNamespace(String expectedNamespace) throws UnexpectedNamespaceException, MissingNameSpaceException
public String getName()
public void appendChild(Element element)
public Element getDomElement()
public List<XmlElement> getChildElements()
public List<XmlElement> getChildElementsWithinNamespace(String childName, String namespace)
public List<XmlElement> getChildElementsWithinNamespace(String namespace)
public List<XmlElement> getChildElements(String tagName)
tagName
- tag name without prefixpublic XmlElement getOnlyChildElement(String childName) throws DocumentedException
DocumentedException
public com.google.common.base.Optional<XmlElement> getOnlyChildElementOptionally(String childName)
public com.google.common.base.Optional<XmlElement> getOnlyChildElementOptionally(String childName, String namespace)
public XmlElement getOnlyChildElementWithSameNamespace(String childName) throws DocumentedException
DocumentedException
public com.google.common.base.Optional<XmlElement> getOnlyChildElementWithSameNamespaceOptionally(String childName)
public XmlElement getOnlyChildElementWithSameNamespace() throws DocumentedException
DocumentedException
public com.google.common.base.Optional<XmlElement> getOnlyChildElementWithSameNamespaceOptionally()
public XmlElement getOnlyChildElement(String childName, String namespace) throws DocumentedException
DocumentedException
public XmlElement getOnlyChildElement() throws DocumentedException
DocumentedException
public com.google.common.base.Optional<XmlElement> getOnlyChildElementOptionally()
public String getTextContent() throws DocumentedException
DocumentedException
public com.google.common.base.Optional<String> getOnlyTextContentOptionally()
public String getNamespaceAttribute() throws MissingNameSpaceException
MissingNameSpaceException
public com.google.common.base.Optional<String> getNamespaceAttributeOptionally()
public com.google.common.base.Optional<String> getNamespaceOptionally()
public String getNamespace() throws MissingNameSpaceException
MissingNameSpaceException
public Map.Entry<String,String> findNamespaceOfTextContent() throws DocumentedException
<type xmlns:th-java="urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl">th-java:threadfactory-naming</type>returns {"th-java","urn:.."}. If no prefix is matched, then default namespace is returned with empty string as key. If no default namespace is found value will be null.
DocumentedException
public List<XmlElement> getChildElementsWithSameNamespace(String childName) throws MissingNameSpaceException
MissingNameSpaceException
public void checkUnrecognisedElements(List<XmlElement> recognisedElements, XmlElement... additionalRecognisedElements) throws DocumentedException
DocumentedException
public void checkUnrecognisedElements(XmlElement... additionalRecognisedElements) throws DocumentedException
DocumentedException
public boolean hasNamespace()
Copyright © 2019 OpenDaylight. All rights reserved.