public final class XMLObjectSupport extends Object
| Modifier | Constructor and Description |
|---|---|
private |
XMLObjectSupport()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static XMLObject |
buildXMLObject(QName elementName)
Build an XMLObject based on the element name.
|
static XMLObject |
buildXMLObject(QName elementName,
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(QName typeOrName)
Obtain an XMLObject builder for the given QName.
|
private static Logger |
getLogger()
Get an SLF4J Logger.
|
static Marshaller |
getMarshaller(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(Element element)
Obtain an XMLObject unmarshaller for the given DOM Element.
|
static Unmarshaller |
getUnmarshaller(QName typeOrName)
Obtain an XMLObject unmarshaller for the given QName.
|
static String |
lookupNamespacePrefix(XMLObject xmlObject,
String namespaceURI)
Get the prefix bound to the specified namespace URI within the scope of the specified
XMLObject.
|
static String |
lookupNamespaceURI(XMLObject xmlObject,
String prefix)
Get the namespace URI bound to the specified prefix within the scope of the specified
XMLObject.
|
static Element |
marshall(XMLObject xmlObject)
Marshall an XMLObject.
|
static void |
marshallAttribute(QName attributeName,
List<String> attributeValues,
Element domElement,
boolean isIDAttribute)
Marshall an attribute name and value to a DOM Element.
|
static void |
marshallAttribute(QName attributeName,
String attributeValue,
Element domElement,
boolean isIDAttribute)
Marshall an attribute name and value to a DOM Element.
|
static void |
marshallAttributeMap(AttributeMap attributeMap,
Element domElement)
Marshall the attributes represented by the indicated AttributeMap into the indicated DOM Element.
|
static void |
marshallToOutputStream(XMLObject xmlObject,
OutputStream outputStream)
Marshall an XMLObject to an OutputStream.
|
static XMLObject |
unmarshallFromInputStream(net.shibboleth.utilities.java.support.xml.ParserPool parserPool,
InputStream inputStream)
Unmarshall a Document from an InputSteam.
|
static XMLObject |
unmarshallFromReader(net.shibboleth.utilities.java.support.xml.ParserPool parserPool,
Reader reader)
Unmarshall a Document from a Reader.
|
static void |
unmarshallToAttributeMap(AttributeMap attributeMap,
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, 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, 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 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, OutputStream outputStream) throws MarshallingException
xmlObject - the XMLObject to marshalloutputStream - the OutputStream to which to marshallMarshallingException - if there is a problem marshalling the objectpublic static String lookupNamespaceURI(XMLObject xmlObject, String prefix)
xmlObject - the XMLObject from which to searchprefix - the prefix to searchpublic static String lookupNamespacePrefix(XMLObject xmlObject, String namespaceURI)
xmlObject - the XMLObject from which to searchnamespaceURI - the namespace URI to searchprivate static Logger getLogger()
public static void marshallAttribute(QName attributeName, List<String> attributeValues, 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(QName attributeName, String attributeValue, 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, Element domElement)
attributeMap - the AttributeMapdomElement - the target Elementpublic static void unmarshallToAttributeMap(AttributeMap attributeMap, Attr attribute)
attributeMap - the target AttributeMapattribute - the target DOM Attrpublic static XMLObject buildXMLObject(QName elementName)
elementName - the element namepublic static XMLObject buildXMLObject(QName elementName, QName typeName)
elementName - the element nametypeName - the xsi:typepublic static XMLObjectBuilder<?> getBuilder(QName typeOrName)
typeOrName - the element name or typepublic static Marshaller getMarshaller(QName typeOrName)
typeOrName - the element name or typepublic static Marshaller getMarshaller(XMLObject xmlObject)
xmlObject - the XMLObject to be marshalledpublic static Unmarshaller getUnmarshaller(QName typeOrName)
typeOrName - the element name or typepublic static Unmarshaller getUnmarshaller(Element element)
element - the DOM elementprivate static XMLObjectProviderRegistry getProviderRegistry()
Copyright © 1999–2015. All rights reserved.