コード例 #1
0
 /**
  * Setup the ID attribute into <code>destElement</code> depending on the <code>isId</code> flag of
  * an attribute of <code>sourceNode</code>.
  *
  * @param sourceNode
  * @param destDocElement
  */
 public static void propagateIDAttributeSetup(Node sourceNode, Element destElement) {
   NamedNodeMap nnm = sourceNode.getAttributes();
   for (int i = 0; i < nnm.getLength(); i++) {
     Attr attr = (Attr) nnm.item(i);
     if (attr.isId()) {
       destElement.setIdAttribute(attr.getName(), true);
       break;
     }
   }
 }
コード例 #2
0
 public String getAttributeType(int i) {
   Attr attr = getAttribute(i);
   if (attr.isId()) {
     return "ID";
   }
   TypeInfo schemaType = null;
   try {
     schemaType = attr.getSchemaTypeInfo();
   } catch (Throwable t) {
     // DOM level 2?
     schemaType = null;
   }
   return (schemaType == null)
       ? "CDATA"
       : schemaType.getTypeName() == null ? "CDATA" : schemaType.getTypeName();
 }
コード例 #3
0
  /**
   * Process attribute.
   *
   * @param samlObject the SAML object
   * @param attribute the attribute
   * @throws UnmarshallingException the unmarshalling exception
   */
  protected final void processAttribute(final XMLObject samlObject, final Attr attribute)
      throws UnmarshallingException {

    final RequestedAttribute requestedAttr = (RequestedAttribute) samlObject;

    if (attribute.getLocalName().equals(RequestedAttribute.NAME_ATTRIB_NAME)) {
      requestedAttr.setName(attribute.getValue());
    } else if (attribute.getLocalName().equals(RequestedAttribute.NAME_FORMAT_ATTR)) {
      requestedAttr.setNameFormat(attribute.getValue());
    } else if (attribute.getLocalName().equals(RequestedAttribute.FRIENDLY_NAME_ATT)) {
      requestedAttr.setFriendlyName(attribute.getValue());
    } else if (attribute.getLocalName().equals(RequestedAttribute.IS_REQUIRED_ATTR)) {
      requestedAttr.setIsRequired(attribute.getValue());

    } else {
      final QName attribQName = XMLHelper.getNodeQName(attribute);
      if (attribute.isId()) {
        requestedAttr.getUnknownAttributes().registerID(attribQName);
      }
      requestedAttr.getUnknownAttributes().put(attribQName, attribute.getValue());
    }
  }
コード例 #4
0
  /** {@inheritDoc} */
  protected void processAttribute(XMLObject samlObject, Attr attribute)
      throws UnmarshallingException {
    EntityDescriptor entityDescriptor = (EntityDescriptor) samlObject;

    if (attribute.getLocalName().equals(EntityDescriptor.ENTITY_ID_ATTRIB_NAME)) {
      entityDescriptor.setEntityID(attribute.getValue());
    } else if (attribute.getLocalName().equals(EntityDescriptor.ID_ATTRIB_NAME)) {
      entityDescriptor.setID(attribute.getValue());
      attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else if (attribute.getLocalName().equals(TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME)
        && !DatatypeHelper.isEmpty(attribute.getValue())) {
      entityDescriptor.setValidUntil(
          new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME)) {
      entityDescriptor.setCacheDuration(XMLHelper.durationToLong(attribute.getValue()));
    } else {
      QName attribQName = XMLHelper.getNodeQName(attribute);
      if (attribute.isId()) {
        entityDescriptor.getUnknownAttributes().registerID(attribQName);
      }
      entityDescriptor.getUnknownAttributes().put(attribQName, attribute.getValue());
    }
  }
コード例 #5
0
 public String getType(String qName) {
   Attr attr = (Attr) attrs.getNamedItem(qName);
   return attr.isId() ? "ID" : "CDATA";
 }
コード例 #6
0
 public String getType(String uri, String localName) {
   Attr attr = (Attr) attrs.getNamedItemNS(uri, localName);
   return attr.isId() ? "ID" : "CDATA";
 }
コード例 #7
0
 public String getType(int index) {
   Attr attr = (Attr) attrs.item(index);
   return attr.isId() ? "ID" : "CDATA";
 }