1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.saml1.core.impl;
18
19 import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
20 import org.opensaml.saml1.core.NameIdentifier;
21 import org.opensaml.xml.XMLObject;
22 import org.opensaml.xml.io.MarshallingException;
23 import org.opensaml.xml.util.XMLHelper;
24 import org.w3c.dom.Element;
25
26
27
28
29 public class NameIdentifierMarshaller extends AbstractSAMLObjectMarshaller {
30
31
32 protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
33 NameIdentifier nameIdentifier = (NameIdentifier) samlElement;
34
35 if (nameIdentifier.getNameQualifier() != null) {
36 domElement
37 .setAttributeNS(null, NameIdentifier.NAMEQUALIFIER_ATTRIB_NAME, nameIdentifier.getNameQualifier());
38 }
39
40 if (nameIdentifier.getFormat() != null) {
41 domElement.setAttributeNS(null, NameIdentifier.FORMAT_ATTRIB_NAME, nameIdentifier.getFormat());
42 }
43 }
44
45
46 protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
47 NameIdentifier nameIdentifier = (NameIdentifier) samlObject;
48
49 if (nameIdentifier.getNameIdentifier() != null) {
50 XMLHelper.appendTextContent(domElement, nameIdentifier.getNameIdentifier());
51 }
52 }
53 }