public final class XMLObjectSupport
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
XMLObjectSupport()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static XMLObject |
buildXMLObject(javax.xml.namespace.QName elementName)
Build an XMLObject based on the element name.
|
static XMLObject |
buildXMLObject(javax.xml.namespace.QName elementName,
javax.xml.namespace.QName typeName)
Build an XMLObject based on the element nane and xsi:type.
|
static <T extends XMLObject> |
cloneXMLObject(T originalXMLObject)
Clone an XMLObject by brute force:
|
static <T extends XMLObject> |
cloneXMLObject(T originalXMLObject,
boolean rootInNewDocument)
Clone an XMLObject by brute force:
|
static XMLObjectBuilder<?> |
getBuilder(javax.xml.namespace.QName typeOrName)
Obtain an XMLObject builder for the given QName.
|
private static org.slf4j.Logger |
getLogger()
Get an SLF4J Logger.
|
static Marshaller |
getMarshaller(javax.xml.namespace.QName typeOrName)
Obtain an XMLObject marshaller for the given QName.
|
static Marshaller |
getMarshaller(XMLObject xmlObject)
Obtain an XMLObject marshaller for the given XMLObject.
|
private static XMLObjectProviderRegistry |
getProviderRegistry()
Obtain the XMLObject provider registry.
|
static Unmarshaller |
getUnmarshaller(org.w3c.dom.Element element)
Obtain an XMLObject unmarshaller for the given DOM Element.
|
static Unmarshaller |
getUnmarshaller(javax.xml.namespace.QName typeOrName)
Obtain an XMLObject unmarshaller for the given QName.
|
static java.lang.String |
lookupNamespacePrefix(XMLObject xmlObject,
java.lang.String namespaceURI)
Get the prefix bound to the specified namespace URI within the scope of the specified
XMLObject.
|
static java.lang.String |
lookupNamespaceURI(XMLObject xmlObject,
java.lang.String prefix)
Get the namespace URI bound to the specified prefix within the scope of the specified
XMLObject.
|
static org.w3c.dom.Element |
marshall(XMLObject xmlObject)
Marshall an XMLObject.
|
static void |
marshallAttribute(javax.xml.namespace.QName attributeName,
java.util.List<java.lang.String> attributeValues,
org.w3c.dom.Element domElement,
boolean isIDAttribute)
Marshall an attribute name and value to a DOM Element.
|
static void |
marshallAttribute(javax.xml.namespace.QName attributeName,
java.lang.String attributeValue,
org.w3c.dom.Element domElement,
boolean isIDAttribute)
Marshall an attribute name and value to a DOM Element.
|
static void |
marshallAttributeMap(AttributeMap attributeMap,
org.w3c.dom.Element domElement)
Marshall the attributes represented by the indicated AttributeMap into the indicated DOM Element.
|
static void |
marshallToOutputStream(XMLObject xmlObject,
java.io.OutputStream outputStream)
Marshall an XMLObject to an OutputStream.
|
static XMLObject |
unmarshallFromInputStream(net.shibboleth.utilities.java.support.xml.ParserPool parserPool,
java.io.InputStream inputStream)
Unmarshall a Document from an InputSteam.
|
static XMLObject |
unmarshallFromReader(net.shibboleth.utilities.java.support.xml.ParserPool parserPool,
java.io.Reader reader)
Unmarshall a Document from a Reader.
|
static void |
unmarshallToAttributeMap(AttributeMap attributeMap,
org.w3c.dom.Attr attribute)
Unmarshall a DOM Attr to an AttributeMap.
|
public static <T extends XMLObject> T cloneXMLObject(T originalXMLObject) throws MarshallingException, UnmarshallingException
1) Marshall the original object if necessary 2) Clone the resulting DOM Element 3) Unmarshall a new XMLObject tree around it.
This method variant is equivalent to cloneXMLObject(originalXMLObject, false).
T - the type of object being clonedoriginalXMLObject - the object to be clonedMarshallingException - if original object can not be marshalledUnmarshallingException - if cloned object tree can not be unmarshalled@Nullable public static <T extends XMLObject> T cloneXMLObject(@Nullable T originalXMLObject, boolean rootInNewDocument) throws MarshallingException, UnmarshallingException
1) Marshall the original object if necessary 2) Clone the resulting DOM Element 3) Unmarshall a new XMLObject tree around it.
T - the type of object being clonedoriginalXMLObject - the object to be clonedrootInNewDocument - if true the cloned object's cached DOM will be rooted
in a new Document; if false, the original object's underlying DOM is cloned,
but the cloned copy remains unrooted and owned by the original DocumentMarshallingException - if original object can not be marshalledUnmarshallingException - if cloned object tree can not be unmarshalledpublic static XMLObject unmarshallFromInputStream(net.shibboleth.utilities.java.support.xml.ParserPool parserPool, java.io.InputStream inputStream) throws net.shibboleth.utilities.java.support.xml.XMLParserException, UnmarshallingException
parserPool - the ParserPool instance to useinputStream - the InputStream to unmarshallnet.shibboleth.utilities.java.support.xml.XMLParserException - if there is a problem parsing the input dataUnmarshallingException - if there is a problem unmarshalling the parsed DOMpublic static XMLObject unmarshallFromReader(net.shibboleth.utilities.java.support.xml.ParserPool parserPool, java.io.Reader reader) throws net.shibboleth.utilities.java.support.xml.XMLParserException, UnmarshallingException
parserPool - the ParserPool instance to usereader - the Reader to unmarshallnet.shibboleth.utilities.java.support.xml.XMLParserException - if there is a problem parsing the input dataUnmarshallingException - if there is a problem unmarshalling the parsed DOM@Nonnull
public static org.w3c.dom.Element marshall(@Nonnull
XMLObject xmlObject)
throws MarshallingException
XMLObject.getDOM(),
that Element will be returned. Otherwise the object will be fully marshalled and that Element returned.xmlObject - the XMLObject to marshallMarshallingException - if there is a problem marshalling the XMLObjectpublic static void marshallToOutputStream(XMLObject xmlObject, java.io.OutputStream outputStream) throws MarshallingException
xmlObject - the XMLObject to marshalloutputStream - the OutputStream to which to marshallMarshallingException - if there is a problem marshalling the objectpublic static java.lang.String lookupNamespaceURI(XMLObject xmlObject, java.lang.String prefix)
xmlObject - the XMLObject from which to searchprefix - the prefix to searchpublic static java.lang.String lookupNamespacePrefix(XMLObject xmlObject, java.lang.String namespaceURI)
xmlObject - the XMLObject from which to searchnamespaceURI - the namespace URI to searchprivate static org.slf4j.Logger getLogger()
public static void marshallAttribute(javax.xml.namespace.QName attributeName,
java.util.List<java.lang.String> attributeValues,
org.w3c.dom.Element domElement,
boolean isIDAttribute)
attributeName - the attribute name in QName formattributeValues - the attribute valuesdomElement - the target element to which to marshallisIDAttribute - flag indicating whether the attribute being marshalled should be handled as an ID-typed
attributepublic static void marshallAttribute(javax.xml.namespace.QName attributeName,
java.lang.String attributeValue,
org.w3c.dom.Element domElement,
boolean isIDAttribute)
attributeName - the attribute name in QName formattributeValue - the attribute valuedomElement - the target element to which to marshallisIDAttribute - flag indicating whether the attribute being marshalled should be handled as an ID-typed
attributepublic static void marshallAttributeMap(AttributeMap attributeMap, org.w3c.dom.Element domElement)
attributeMap - the AttributeMapdomElement - the target Elementpublic static void unmarshallToAttributeMap(AttributeMap attributeMap, org.w3c.dom.Attr attribute)
attributeMap - the target AttributeMapattribute - the target DOM Attrpublic static XMLObject buildXMLObject(javax.xml.namespace.QName elementName)
elementName - the element namepublic static XMLObject buildXMLObject(javax.xml.namespace.QName elementName, javax.xml.namespace.QName typeName)
elementName - the element nametypeName - the xsi:typepublic static XMLObjectBuilder<?> getBuilder(javax.xml.namespace.QName typeOrName)
typeOrName - the element name or typepublic static Marshaller getMarshaller(javax.xml.namespace.QName typeOrName)
typeOrName - the element name or typepublic static Marshaller getMarshaller(XMLObject xmlObject)
xmlObject - the XMLObject to be marshalledpublic static Unmarshaller getUnmarshaller(javax.xml.namespace.QName typeOrName)
typeOrName - the element name or typepublic static Unmarshaller getUnmarshaller(org.w3c.dom.Element element)
element - the DOM elementprivate static XMLObjectProviderRegistry getProviderRegistry()