List of usage examples for org.w3c.dom Element setIdAttribute
public void setIdAttribute(String name, boolean isId) throws DOMException;
isId
is true
, this method declares the specified attribute to be a user-determined ID attribute . From source file:Main.java
/** * Traverses the passed Element <var>e</var> and sets the "id" attribute to * be the user-defined ID attribute. This method recursively visits all * children of the parent Element <var>e</var>. This is used to find * elements by their ID// ww w . ja v a2 s . c o m * * @param e */ private static void defineIDAttribute(Element e) { if (e.getAttribute("id").length() > 0) e.setIdAttribute("id", true); for (Node child = e.getFirstChild(); child != null; child = child.getNextSibling()) if (child.getNodeType() == Document.ELEMENT_NODE) defineIDAttribute((Element) child); }
From source file:Main.java
public static void setIdAttr(Element element, String Id) { element.setAttribute("Id", Id); element.setIdAttribute("Id", true); }
From source file:Main.java
/** * Setup the ID attribute into <code>destElement</code> depending on the <code>isId</code> flag of an attribute of * <code>sourceNode</code>.// w ww .j av a 2s. c o m * * @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; } } }
From source file:com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.java
/** * Set the id of the root element of the DOMContext associated with the * UIComponent parameter./*from w w w . ja va 2 s . c o m*/ * * @param facesContext * @param rootElement * @param uiComponent */ public static void setRootElementId(FacesContext facesContext, Element rootElement, UIComponent uiComponent) { if (idNotNull(uiComponent)) { rootElement.setAttribute("id", uiComponent.getClientId(facesContext)); rootElement.setIdAttribute("id", true); } }
From source file:no.digipost.signature.client.asice.signature.CreateXAdESProperties.java
private void markAsIdProperty(final Document document, final String elementName, final String property) { XPath xPath = XPathFactory.newInstance().newXPath(); try {//from w w w. java 2s . c om Element idElement = (Element) xPath.evaluate("//*[local-name()='" + elementName + "']", document, XPathConstants.NODE); idElement.setIdAttribute(property, true); } catch (XPathExpressionException e) { throw new XmlConfigurationException("XPath on generated XML failed.", e); } }
From source file:no.difi.sdp.client.asice.signature.CreateXAdESProperties.java
private void markAsIdProperty(Document document, final String elementName, String property) { XPath xPath = XPathFactory.newInstance().newXPath(); try {//ww w. ja v a2s. c o m Element idElement = (Element) xPath.evaluate("//*[local-name()='" + elementName + "']", document, XPathConstants.NODE); idElement.setIdAttribute(property, true); } catch (XPathExpressionException e) { throw new XmlKonfigurasjonException("XPath p generert XML feilet.", e); } }
From source file:eu.europa.esig.dss.DSSXMLUtils.java
/** * If this method finds an attribute with names ID (case-insensitive) then declares it to be a user-determined ID attribute. * * @param childElement//from ww w . j a v a2 s .c o m */ public static void setIDIdentifier(final Element childElement) { final NamedNodeMap attributes = childElement.getAttributes(); for (int jj = 0; jj < attributes.getLength(); jj++) { final Node item = attributes.item(jj); final String localName = item.getNodeName(); if (localName != null) { final String id = localName.toLowerCase(); if (ID_ATTRIBUTE_NAME.equals(id)) { childElement.setIdAttribute(localName, true); break; } } } }
From source file:be.fedict.eid.dss.spi.utils.XAdESValidation.java
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); }//from w w w .ja va 2 s . co m }
From source file:be.fedict.eid.dss.spi.utils.XAdESValidation.java
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); }//w ww . j a v a2 s . co m }
From source file:be.e_contract.mycarenet.xkms.ProofOfPossessionSignatureSOAPHandler.java
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); }//www . j a v a2 s . c om }