Java Code Examples for org.w3c.dom.Element#equals()
The following examples show how to use
org.w3c.dom.Element#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpdateSpringBeanFilter.java From citrus-admin with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public short accept(Element element) { if (added == null && (isEqualById(element, elementId))) { if (element.getNextSibling() != null) { added = element.getParentNode().insertBefore(element.getOwnerDocument().importNode(beanDefinition, true), element.getNextSibling()); } else { added = element.getParentNode().appendChild(element.getOwnerDocument().importNode(beanDefinition, true)); } updatedBeans++; } if (element.equals(added)) { return NodeFilter.FILTER_ACCEPT; } return super.accept(element); }
Example 2
Source File: AbstractBindingPolicyValidator.java From cxf with Apache License 2.0 | 6 votes |
/** * Return true if the given Element was encrypted */ private boolean isElementEncrypted(Element element, List<WSSecurityEngineResult> results) { for (WSSecurityEngineResult wser : results) { Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION); if (actInt.intValue() == WSConstants.ENCR) { List<WSDataRef> el = CastUtils.cast((List<?>)wser.get(WSSecurityEngineResult.TAG_DATA_REF_URIS)); if (el != null) { for (WSDataRef r : el) { Element protectedElement = r.getProtectedElement(); if (element.equals(protectedElement)) { return true; } } } } } return false; }
Example 3
Source File: ConfigParseUtil.java From lucene-solr with Apache License 2.0 | 5 votes |
public static List<Element> getChildNodes(Element e, String byName) { List<Element> result = new ArrayList<>(); NodeList l = e.getChildNodes(); for (int i = 0; i < l.getLength(); i++) { if (e.equals(l.item(i).getParentNode()) && byName.equals(l.item(i).getNodeName())) result.add((Element) l .item(i)); } return result; }
Example 4
Source File: ConfigParseUtil.java From lucene-solr with Apache License 2.0 | 5 votes |
public static List<Element> getChildNodes(Element e, String byName) { List<Element> result = new ArrayList<>(); NodeList l = e.getChildNodes(); for (int i = 0; i < l.getLength(); i++) { if (e.equals(l.item(i).getParentNode()) && byName.equals(l.item(i).getNodeName())) result.add((Element) l.item(i)); } return result; }
Example 5
Source File: Utils.java From netbeans-mmd-plugin with Apache License 2.0 | 5 votes |
/** * Find all direct children with defined name. * * @param element parent element * @param childElementname child element name * @return list of found elements * @since 1.4.0 */ @Nonnull @MustNotContainNull public static List<Element> findDirectChildrenForName(@Nonnull final Element element, @Nonnull final String childElementname) { final List<Element> resultList = new ArrayList<Element>(); final NodeList list = element.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { final Node node = list.item(i); if (element.equals(node.getParentNode()) && node instanceof Element && childElementname.equals(node.getNodeName())) { resultList.add((Element) node); } } return resultList; }
Example 6
Source File: DynamicContentBasicsPanel.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
/** * Look through all dynamicContent controls - only one can have 'useHash="true"' on a page. * @param dn * @return */ private String checkAllDynamicConectPropertiesForUseHash(DataNode dn) { DataNode root = dn.getRootNode(); Object o = root.getDataProvider().getParentObject(); String controlName = null; if (o instanceof Element) { Element elem = (Element)o; Document doc = elem.getOwnerDocument(); NodeList nl = DOMUtil.getChildElementsByTagNameNS(doc.getDocumentElement(), EXT_LIB_NAMESPACE_URI, TAG); for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); if (n instanceof Element) { Element dync = (Element)n; String uh = dync.getAttribute(ATTR_USEHASH); if (uh != null && StringUtil.equalsIgnoreCase(uh, Boolean.toString(Boolean.TRUE))) { if (!dync.equals(elem)) controlName = dync.getLocalName(); } } } } return controlName; }
Example 7
Source File: AbstractBindingPolicyValidator.java From cxf with Apache License 2.0 | 5 votes |
/** * Check whether the token protection policy is followed. In other words, check that the * signature token was itself signed. */ protected boolean isTokenProtected( List<WSSecurityEngineResult> results, List<WSSecurityEngineResult> signedResults ) { for (WSSecurityEngineResult result : signedResults) { // Get the Token result that was used for the signature WSSecurityEngineResult tokenResult = findCorrespondingToken(result, results); if (tokenResult == null) { return false; } // Now go through what was signed and see if the token itself was signed List<WSDataRef> sl = CastUtils.cast((List<?>)result.get( WSSecurityEngineResult.TAG_DATA_REF_URIS )); boolean found = false; if (sl != null) { for (WSDataRef dataRef : sl) { Element referenceElement = dataRef.getProtectedElement(); if (referenceElement != null && referenceElement.equals(tokenResult.get(WSSecurityEngineResult.TAG_TOKEN_ELEMENT))) { found = true; } } } if (!found) { return false; } } return true; }