本文整理了Java中org.w3c.dom.Element.setIdAttribute()
方法的一些代码示例,展示了Element.setIdAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setIdAttribute()
方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:setIdAttribute
[英]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.
To specify an attribute by local name and namespace URI, use the setIdAttributeNS
method.
[中]如果参数isId
为true
,则此方法将指定的属性声明为用户确定的ID属性。这会影响Attr.isId
的值和Document.getElementById
的行为,但不会更改可能正在使用的任何架构,尤其是不会影响指定Attr
节点的Attr.schemaTypeInfo
。使用参数isId
的值false
取消声明属性,使其成为用户确定的ID属性。
要按本地名称和命名空间URI指定属性,请使用setIdAttributeNS
方法。
代码示例来源:origin: stackoverflow.com
Document doc;
Element fooElem;
doc = ...; // load XML document instance
fooElem = ...; // locate the element node "foo" in doc
fooElem.setIdAttribute("bar", true); // without this, 'found' would be null
Element found = doc.getElementById("xyz");
代码示例来源:origin: org.apache.poi/poi-ooxml
public void handleElement(Element el) {
EventTarget target = this.target.get();
if (el.hasAttribute("Id")) {
el.setIdAttribute("Id", true);
}
setListener(target, this, false);
if (OO_DIGSIG_NS.equals(el.getNamespaceURI())) {
String parentNS = el.getParentNode().getNamespaceURI();
if (!OO_DIGSIG_NS.equals(parentNS) && !el.hasAttributeNS(XML_NS, "mdssi")) {
el.setAttributeNS(XML_NS, "xmlns:mdssi", OO_DIGSIG_NS);
}
}
setPrefix(el);
setListener(target, this, true);
}
代码示例来源:origin: org.apache.poi/poi-ooxml
final int length = nl.getLength();
for (int i=0; i<length; i++) {
((Element)nl.item(i)).setIdAttribute("Id", true);
代码示例来源:origin: org.jboss.ws.native/jbossws-native-core
public void setIdAttribute(String name, boolean isId) throws DOMException
{
this.element.setIdAttribute(name, isId);
}
代码示例来源:origin: xyz.cofe/common
@Override
public void setIdAttribute(String name, boolean isId) throws DOMException {
element.setIdAttribute(name, isId);
}
代码示例来源:origin: com.hynnet/xws-security
public static void setIdAttr(Element element, String Id) {
element.setAttribute("Id", Id);
element.setIdAttribute("Id", true);
}
代码示例来源:origin: be.fedict.eid-dss/eid-dss-spi-utils
private void prepareDocumentIdentity(Element signatureElement) {
NodeList nodeList = signatureElement.getElementsByTagNameNS(
"be:fedict:eid:dss:stylesheet:1.0", "StyleSheet");
if (1 == nodeList.getLength()) {
Element styleSheetElement = (Element) nodeList.item(0);
styleSheetElement.setIdAttribute("Id", true);
}
}
代码示例来源:origin: se.vgregion.commons-util/commons-util-core-bc-composite-security
private static void setIdAttributesAsId(Document doc) {
NodeList nodeList = doc.getElementsByTagName("bankIdSignedData");
if (nodeList.getLength() > 0) {
Element bankIdSignedDataElement = (Element) nodeList.item(0);
bankIdSignedDataElement.setIdAttribute("Id", true);
}
}
}
代码示例来源:origin: be.fedict.eid-dss/eid-dss-spi-utils
private void prepareDocumentXades(Element signatureElement) {
NodeList nodeList = signatureElement.getElementsByTagNameNS(
"http://uri.etsi.org/01903/v1.3.2#", "SignedProperties");
if (1 == nodeList.getLength()) {
Element signedPropertiesElement = (Element) nodeList.item(0);
signedPropertiesElement.setIdAttribute("Id", true);
}
}
代码示例来源:origin: se.vgregion.commons-util/commons-util-core-bc-composite-security
private void setIdAttributesAsId(Document doc) {
NodeList elementsByTagName = doc.getElementsByTagName("bankIdSignedData");
if (elementsByTagName.getLength() > 0) {
Element bankIdSignedDataElement = (Element) elementsByTagName.item(0);
bankIdSignedDataElement.setIdAttribute("Id", true);
}
}
代码示例来源:origin: org.vx68k.quercus/quercus
public void setIdAttribute(String name, boolean isId)
throws DOMException
{
try {
_delegate.setIdAttribute(name, isId);
}
catch (org.w3c.dom.DOMException ex) {
throw wrap(ex);
}
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Element#setIdAttribute(java.lang.String, boolean)
*/
@Override
public void setIdAttribute(String name, boolean isId) throws DOMException {
original.get().setIdAttribute(name, isId);
}
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Element#setIdAttribute(java.lang.String, boolean)
*/
@Override
public void setIdAttribute(String name, boolean isId) throws DOMException {
original.get().setIdAttribute(name, isId);
}
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Element#setIdAttribute(java.lang.String, boolean)
*/
public void setIdAttribute(String name, boolean isId) throws DOMException {
getCurrentInternal().setIdAttribute(name, isId);
}
代码示例来源:origin: be.e_contract.mycarenet/mycarenet-xkms
private void prepareDocument(Document xkmsDocument) {
Element prototypeElement = xkmsDocument
.getElementById(this.prototypeKeyBindingId);
if (null == prototypeElement) {
LOG.warn("Prototype element not found via Id");
prototypeElement = (Element) xkmsDocument.getElementsByTagNameNS(
XKMS_NAMESPACE, "Prototype").item(0);
prototypeElement.setIdAttribute("Id", true);
}
}
代码示例来源:origin: Geomatys/geotoolkit
@Override
public void setIdAttribute(String name, boolean isId) throws DOMException {
final Element elem = getElement();
if (elem != null) elem.setIdAttribute(name, isId);
}
代码示例来源:origin: fbacchella/jrds
/**
* @param name
* @param isId
* @throws org.w3c.dom.DOMException
* @see org.w3c.dom.Element#setIdAttribute(java.lang.String, boolean)
*/
public void setIdAttribute(String name, boolean isId) {
getParent().setIdAttribute(name, isId);
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Element#setIdAttribute(java.lang.String, boolean)
*/
public void setIdAttribute(String name, boolean isId) throws DOMException {
getAtualInterno().setIdAttribute(name, isId);
}
代码示例来源:origin: io.github.i49/cascade-tests
private static void activateIdentifiers(Document doc) {
walkTree(doc.getDocumentElement(), e->{
if (e.hasAttribute("id")) {
e.setIdAttribute("id", true);
}
});
}
代码示例来源:origin: de.rototor.snuggletex/snuggletex-core
public void handleCommand(DOMBuilder builder, Element parentElement, CommandToken token)
throws SnuggleParseException {
/* Make sure anchor is a proper XML name */
ArgumentContainerToken anchorToken = token.getArguments()[0];
String rawAnchorId = builder.extractStringValue(anchorToken);
String validatedId = builder.validateXMLId(parentElement, anchorToken, rawAnchorId);
if (validatedId!=null) {
/* Create <a/> element */
Element aElement = builder.appendXHTMLElement(parentElement, "a");
aElement.setAttribute("id", validatedId);
aElement.setIdAttribute("id", true);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!