Package org.opensaml.core.xml.util

# Class XMLAttributeSupport

java.lang.Object
org.opensaml.core.xml.util.XMLAttributeSupport

public final class XMLAttributeSupport extends Object
Helper methods for working with global attributes from the XML namespace. These are namely:

1. xml:id
2. xml:lang
3. xml:base
4. xml:space

## Constructor Summary

Constructors
Modifier
Constructor
Description
`private`
`XMLAttributeSupport()`
Private constructor.

## Method Summary

Modifier and Type
Method
Description
`static void`
`addXMLBase(XMLObject xmlObject, String base)`
Adds a `xml:base` attribute to the given XML object.
`static void`
`addXMLId(XMLObject xmlObject, String id)`
Adds a `xml:id` attribute to the given XML object.
`static void`
`addXMLLang(XMLObject xmlObject, String lang)`
Adds a `xml:lang` attribute to the given XML object.
`static void`
`addXMLSpace(XMLObject xmlObject, SpaceBearing.XMLSpaceEnum space)`
Adds a `xml:space` attribute to the given XML object.
`static String`
`getXMLBase(XMLObject xmlObject)`
Gets the `xml:base` attribute from a given XML object.
`static String`
`getXMLId(XMLObject xmlObject)`
Gets the `xml:id` attribute from a given XML object.
`static String`
`getXMLLang(XMLObject xmlObject)`
Gets the `xml:lang` attribute from a given XML object.
`static SpaceBearing.XMLSpaceEnum`
`getXMLSpace(XMLObject xmlObject)`
Gets the `xml:space` attribute from a given XML object.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### XMLAttributeSupport

private XMLAttributeSupport()
Private constructor.

## Method Details

### addXMLId

public static void addXMLId(@Nonnull XMLObject xmlObject, @Nullable String id)
Adds a `xml:id` attribute to the given XML object.

Parameters:
  `xmlObject` - the XML object to which to add the attribute
  `id` - the Id value

### getXMLId

@Nullable public static String getXMLId(@Nonnull XMLObject xmlObject)
Gets the `xml:id` attribute from a given XML object.

Parameters:
  `xmlObject` - the XML object from which to extract the attribute
Returns:
  the value of the xml:id attribute, or null if not present

### addXMLLang

public static void addXMLLang(@Nonnull XMLObject xmlObject, @Nullable String lang)
Adds a `xml:lang` attribute to the given XML object.

Parameters:
  `xmlObject` - the XML object to which to add the attribute
  `lang` - the lang value

### getXMLLang

@Nullable public static String getXMLLang(@Nonnull XMLObject xmlObject)
Gets the `xml:lang` attribute from a given XML object.

Parameters:
  `xmlObject` - the XML object from which to extract the attribute
Returns:
  the value of the xml:lang attribute, or null if not present

### addXMLBase

public static void addXMLBase(@Nonnull XMLObject xmlObject, @Nullable String base)
Adds a `xml:base` attribute to the given XML object.

Parameters:
  `xmlObject` - the XML object to which to add the attribute
  `base` - the base value

### getXMLBase

@Nullable public static String getXMLBase(@Nonnull XMLObject xmlObject)
Gets the `xml:base` attribute from a given XML object.

Parameters:
  `xmlObject` - the XML object from which to extract the attribute
Returns:
  the value of the xml:base attribute, or null if not present

### addXMLSpace

public static void addXMLSpace(@Nonnull XMLObject xmlObject, @Nonnull SpaceBearing.XMLSpaceEnum space)
Adds a `xml:space` attribute to the given XML object.

Parameters:
  `xmlObject` - the XML object to which to add the attribute
  `space` - the space value

### getXMLSpace

@Nullable public static SpaceBearing.XMLSpaceEnum getXMLSpace(@Nonnull XMLObject xmlObject)
Gets the `xml:space` attribute from a given XML object.

Parameters:
  `xmlObject` - the XML object from which to extract the attribute
Returns:
  the value of the xml:space attribute, or null if not present