org.w3c.dom.Element.setIdAttributeNS()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.w3c.dom.Element.setIdAttributeNS()方法的一些代码示例,展示了Element.setIdAttributeNS()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setIdAttributeNS()方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:setIdAttributeNS

Element.setIdAttributeNS介绍

[英]If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute . This affects the value of Attr.isId and the behavior of Document.getElementById, but does not change any schema that may be in use, in particular this does not affect the Attr.schemaTypeInfo of the specified Attr node. Use the value false for the parameter isId to undeclare an attribute for being a user-determined ID attribute.
[中]如果参数isIdtrue,则此方法将指定的属性声明为用户确定的ID属性。这会影响Attr.isId的值和Document.getElementById的行为,但不会更改可能正在使用的任何架构,尤其是不会影响指定Attr节点的Attr.schemaTypeInfo。使用参数isId的值false取消声明属性,使其成为用户确定的ID属性。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

private void setAttribute(String namespaceUri, String localName, String value, boolean isIdAttribute) {
 synchronized(document) {
  XmlQName xmlQName = new XmlQName(this, namespaceUri, localName);
  if (xmlQName.hasLocalNamespace()) {
   element.setAttributeNS(null, xmlQName.getLocalName(), value);
   if (isIdAttribute) {
    element.setIdAttributeNS(null, xmlQName.getLocalName(), true);
   }
  }
  else {
   element.setAttributeNS(xmlQName.getNamespaceUri(), xmlQName.getPrefixedName(), value);
   if (isIdAttribute) {
    element.setIdAttributeNS(xmlQName.getNamespaceUri(), xmlQName.getLocalName(), true);
   }
  }
 }
}

代码示例来源:origin: org.opensingular/form-core

/**
 * @see org.w3c.dom.Element#setIdAttributeNS(java.lang.String, java.lang.String, boolean)
 */
@Override
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException {
  original.get().setIdAttributeNS(namespaceURI, localName, isId);
}

代码示例来源:origin: org.opensingular/form-core

/**
 * @see org.w3c.dom.Element#setIdAttributeNS(java.lang.String, java.lang.String, boolean)
 */
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException {
  getAtualInterno().setIdAttributeNS(namespaceURI, localName, isId);
}

代码示例来源:origin: org.vx68k.quercus/quercus

public void setIdAttributeNS(String namespaceURI,
               String localName,
               boolean isId)
 throws DOMException
{
 try {
  _delegate.setIdAttributeNS(namespaceURI, localName, isId);
 }
 catch (org.w3c.dom.DOMException ex) {
  throw wrap(ex);
 }
}

代码示例来源:origin: org.opensingular/singular-commons

/**
 * @see org.w3c.dom.Element#setIdAttributeNS(java.lang.String, java.lang.String, boolean)
 */
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException {
  getCurrentInternal().setIdAttributeNS(namespaceURI, localName, isId);
}

代码示例来源:origin: fbacchella/jrds

/**
 * @param namespaceURI
 * @param localName
 * @param isId
 * @throws org.w3c.dom.DOMException
 * @see org.w3c.dom.Element#setIdAttributeNS(java.lang.String,
 *      java.lang.String, boolean)
 */
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) {
  getParent().setIdAttributeNS(namespaceURI, localName, isId);
}

代码示例来源:origin: org.opensaml/xmltooling

/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
  KeyInfoType keyInfo = (KeyInfoType) xmlObject;
  if (keyInfo.getID() != null) {
    domElement.setAttributeNS(null, KeyInfoType.ID_ATTRIB_NAME, keyInfo.getID());
    domElement.setIdAttributeNS(null, KeyInfoType.ID_ATTRIB_NAME, true);
  }
}

代码示例来源:origin: org.opensaml/xmltooling

/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
  ECKeyValue ec = (ECKeyValue) xmlObject;
  if (ec.getID() != null) {
    domElement.setAttributeNS(null, ECKeyValue.ID_ATTRIB_NAME, ec.getID());
    domElement.setIdAttributeNS(null, ECKeyValue.ID_ATTRIB_NAME, true);
  }
}

代码示例来源:origin: org.opensaml/xmltooling

/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
  EncryptionProperties ep = (EncryptionProperties) xmlObject;
  if (ep.getID() != null) {
    domElement.setAttributeNS(null, EncryptionProperties.ID_ATTRIB_NAME, ep.getID());
    domElement.setIdAttributeNS(null, EncryptionProperties.ID_ATTRIB_NAME, true);
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
  EncryptionProperties ep = (EncryptionProperties) xmlObject;
  if (ep.getID() != null) {
    domElement.setAttributeNS(null, EncryptionProperties.ID_ATTRIB_NAME, ep.getID());
    domElement.setIdAttributeNS(null, EncryptionProperties.ID_ATTRIB_NAME, true);
  }
}

代码示例来源:origin: org.opensaml/xmltooling

/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
  DEREncodedKeyValue der = (DEREncodedKeyValue) xmlObject;
  if (der.getID() != null) {
    domElement.setAttributeNS(null, DEREncodedKeyValue.ID_ATTRIB_NAME, der.getID());
    domElement.setIdAttributeNS(null, DEREncodedKeyValue.ID_ATTRIB_NAME, true);
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
  ECKeyValue ec = (ECKeyValue) xmlObject;
  if (ec.getID() != null) {
    domElement.setAttributeNS(null, ECKeyValue.ID_ATTRIB_NAME, ec.getID());
    domElement.setIdAttributeNS(null, ECKeyValue.ID_ATTRIB_NAME, true);
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
  KeyInfoType keyInfo = (KeyInfoType) xmlObject;
  if (keyInfo.getID() != null) {
    domElement.setAttributeNS(null, KeyInfoType.ID_ATTRIB_NAME, keyInfo.getID());
    domElement.setIdAttributeNS(null, KeyInfoType.ID_ATTRIB_NAME, true);
  }
}

代码示例来源:origin: org.opensaml/opensaml-saml-impl

/** {@inheritDoc} */
public XMLObject unmarshall(Element domElement) throws UnmarshallingException {
  // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0
  ResponseAbstractType response = (ResponseAbstractType) super.unmarshall(domElement);
  if (response.getVersion() != SAMLVersion.VERSION_10 && !Strings.isNullOrEmpty(response.getID())) {
    domElement.setIdAttributeNS(null, ResponseAbstractType.ID_ATTRIB_NAME, true);
  }
  return response;
}

代码示例来源:origin: org.opensaml/opensaml-saml-impl

/** {@inheritDoc} */
public XMLObject unmarshall(Element domElement) throws UnmarshallingException {
  // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0
  Assertion assertion = (Assertion) super.unmarshall(domElement);
  if (assertion.getMinorVersion() != 0 && !Strings.isNullOrEmpty(assertion.getID())) {
    domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true);
  }
  return assertion;
}

代码示例来源:origin: org.opensaml/xmltooling

/** {@inheritDoc} */
  protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    KeyInfoReference ref = (KeyInfoReference) xmlObject;

    if (ref.getID() != null) {
      domElement.setAttributeNS(null, KeyInfoReference.ID_ATTRIB_NAME, ref.getID());
      domElement.setIdAttributeNS(null, KeyInfoReference.ID_ATTRIB_NAME, true);
    }

    if (ref.getURI() != null) {
      domElement.setAttributeNS(null, KeyInfoReference.URI_ATTRIB_NAME, ref.getURI());
    }
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/** {@inheritDoc} */
  protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    KeyInfoReference ref = (KeyInfoReference) xmlObject;

    if (ref.getID() != null) {
      domElement.setAttributeNS(null, KeyInfoReference.ID_ATTRIB_NAME, ref.getID());
      domElement.setIdAttributeNS(null, KeyInfoReference.ID_ATTRIB_NAME, true);
    }

    if (ref.getURI() != null) {
      domElement.setAttributeNS(null, KeyInfoReference.URI_ATTRIB_NAME, ref.getURI());
    }
  }
}

代码示例来源:origin: org.opensaml/opensaml

/** {@inheritDoc} */
public XMLObject unmarshall(Element domElement) throws UnmarshallingException {
  // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0
  ResponseAbstractType response = (ResponseAbstractType) super.unmarshall(domElement);
  if (response.getMinorVersion() != 0 && !DatatypeHelper.isEmpty(response.getID())) {
    domElement.setIdAttributeNS(null, ResponseAbstractType.ID_ATTRIB_NAME, true);
  }
  return response;
}

代码示例来源:origin: org.opensaml/opensaml

/** {@inheritDoc} */
public XMLObject unmarshall(Element domElement) throws UnmarshallingException {
  // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0
  RequestAbstractType request = (RequestAbstractType) super.unmarshall(domElement);
  if (request.getMinorVersion() != 0 && !DatatypeHelper.isEmpty(request.getID())) {
    domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true);
  }
  return request;
}

代码示例来源:origin: org.opensaml/opensaml

/** {@inheritDoc} */
public XMLObject unmarshall(Element domElement) throws UnmarshallingException {
  // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0
  Assertion assertion = (Assertion) super.unmarshall(domElement);
  if (assertion.getMinorVersion() != 0 && !DatatypeHelper.isEmpty(assertion.getID())) {
    domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true);
  }
  return assertion;
}

相关文章

微信公众号

最新文章

更多