本文整理了Java中org.w3c.dom.Element.isSameNode()
方法的一些代码示例,展示了Element.isSameNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.isSameNode()
方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:isSameNode
暂无
代码示例来源:origin: xyz.cofe/common
@Override
public boolean isSameNode(Node other) {
return element.isSameNode(other);
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public boolean isSameNode(Node other) {
return element.isSameNode(soapDocument.getDomNode(other));
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Node#isSameNode(org.w3c.dom.Node)
*/
public boolean isSameNode(Node other) {
return getOriginal().isSameNode(other);
}
代码示例来源:origin: Geomatys/geotoolkit
@Override
public boolean isSameNode(Node other) {
final Element elem = getElement();
return elem != null ? elem.isSameNode(other) : Boolean.FALSE;
}
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Node#isSameNode(org.w3c.dom.Node)
*/
@Override
public boolean isSameNode(Node other) {
return original.get().isSameNode(other);
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Node#isSameNode(org.w3c.dom.Node)
*/
@Override
public boolean isSameNode(Node other) {
return original.get().isSameNode(other);
}
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Node#isSameNode(org.w3c.dom.Node)
*/
public boolean isSameNode(Node other) {
return getOriginal().isSameNode(other);
}
代码示例来源:origin: org.vectomatic/lib-gwt-svg
private String getXpath(Element element) {
StringBuilder buffer = new StringBuilder();
while (!root.isSameNode(element)) {
int index = 1;
Node sibling = element.getPreviousSibling();
while (sibling != null) {
if (sibling.getNodeType() == Node.ELEMENT_NODE) {
index++;
}
sibling = sibling.getPreviousSibling();
}
buffer.insert(0, "/*[" + index + "]");
Node node = element.getParentNode();
while (node.getNodeType() != Node.ELEMENT_NODE) {
node = node.getParentNode();
}
element = (Element)node;
}
buffer.insert(0, ".");
return buffer.toString();
}
}
代码示例来源:origin: laaglu/lib-gwt-svg
private String getXpath(Element element) {
StringBuilder buffer = new StringBuilder();
while (!root.isSameNode(element)) {
int index = 1;
Node sibling = element.getPreviousSibling();
while (sibling != null) {
if (sibling.getNodeType() == Node.ELEMENT_NODE) {
index++;
}
sibling = sibling.getPreviousSibling();
}
buffer.insert(0, "/*[" + index + "]");
Node node = element.getParentNode();
while (node.getNodeType() != Node.ELEMENT_NODE) {
node = node.getParentNode();
}
element = (Element)node;
}
buffer.insert(0, ".");
return buffer.toString();
}
}
代码示例来源:origin: org.opendaylight.yangtools/yang-data-codec-gson
private void handleArray(final Node node) throws IOException {
final Element parentNode = (Element)node.getParentNode();
final NodeList elementsList = parentNode.getElementsByTagName(node.getNodeName());
for (int i = 0, length = elementsList.getLength(); i < length; i++) {
final Node arrayElement = elementsList.item(i);
final Element parent = (Element)arrayElement.getParentNode();
if (parentNode.isSameNode(parent)) {
final Element firstChildElement = getFirstChildElement(arrayElement);
if (firstChildElement != null) {
writeObjectContent(firstChildElement);
} else {
// It may be scalar
writeXmlValue(arrayElement);
}
}
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite
/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
Document doc;
Element element1;
Element element2;
boolean isSame;
doc = (Document) load("hc_staff", false);
element1 = doc.createElementNS("http://www.w3.org/1999/xhtml", "xhtml:br");
element2 = doc.createElementNS("http://www.w3.org/1999/xhtml", "xhtml:br");
isSame = element2.isSameNode(element1);
assertFalse("nodeissamenode04", isSame);
}
/**
代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite
/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
Document doc;
Element element1;
Element element2;
boolean isSame;
doc = (Document) load("hc_staff", false);
element1 = doc.getDocumentElement();
element2 = doc.getDocumentElement();
isSame = element2.isSameNode(element1);
assertTrue("nodeissamenode05", isSame);
}
/**
代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite
/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
Document doc;
Element element1;
Element element2;
NodeList childList;
boolean isSame;
doc = (Document) load("hc_staff", false);
childList = doc.getElementsByTagName("p");
element1 = (Element) childList.item(0);
element2 = (Element) childList.item(0);
isSame = element2.isSameNode(element1);
assertTrue("nodeissamenode03", isSame);
}
/**
代码示例来源:origin: opendaylight/yangtools
private void handleArray(final Node node) throws IOException {
final Element parentNode = (Element)node.getParentNode();
final NodeList elementsList = parentNode.getElementsByTagName(node.getNodeName());
for (int i = 0, length = elementsList.getLength(); i < length; i++) {
final Node arrayElement = elementsList.item(i);
final Element parent = (Element)arrayElement.getParentNode();
if (parentNode.isSameNode(parent)) {
final Element firstChildElement = getFirstChildElement(arrayElement);
if (firstChildElement != null) {
writeObjectContent(firstChildElement);
} else {
// It may be scalar
writeXmlValue(arrayElement);
}
}
}
}
代码示例来源:origin: net.shibboleth.tool/xmlsectool
/**
* Validates that the element resolved by the signature validation layer is the same as the
* element resolved by the DOM layer.
*
* @param xmlDocument the signed document
* @param reference the reference to be validated
*/
protected static void validateSignatureReferenceUri(final Document xmlDocument, final Reference reference) {
final ReferenceData refData = reference.getReferenceData();
if (refData instanceof ReferenceSubTreeData) {
final ReferenceSubTreeData subTree = (ReferenceSubTreeData) refData;
final Node root = subTree.getRoot();
Node resolvedSignedNode = root;
if (root.getNodeType() == Node.DOCUMENT_NODE) {
resolvedSignedNode = ((Document)root).getDocumentElement();
}
final Element expectedSignedNode = xmlDocument.getDocumentElement();
if (!expectedSignedNode.isSameNode(resolvedSignedNode)) {
log.error("Signature Reference URI \"" + reference.getURI()
+ "\" was resolved to a node other than the document element");
throw new Terminator(ReturnCode.RC_SIG);
}
} else {
log.error("Signature Reference URI did not resolve to a subtree");
throw new Terminator(ReturnCode.RC_SIG);
}
}
代码示例来源:origin: net.shibboleth.metadata/aggregator-pipeline
/**
* Validates that the element resolved by the signature validation layer is the same as the
* element resolved by the DOM layer.
*
* @param expectedSignedNode the node expected as the result of the reference
* @param reference the reference to be validated
* @throws ValidationException if validation fails
*/
private void validateSignatureReferenceUri(@Nonnull final Element expectedSignedNode,
@Nonnull final Reference reference) throws ValidationException {
final ReferenceData refData = reference.getReferenceData();
if (refData instanceof ReferenceSubTreeData) {
final ReferenceSubTreeData subTree = (ReferenceSubTreeData) refData;
final Node root = subTree.getRoot();
Node resolvedSignedNode = root;
if (root.getNodeType() == Node.DOCUMENT_NODE) {
resolvedSignedNode = ((Document)root).getDocumentElement();
}
if (!expectedSignedNode.isSameNode(resolvedSignedNode)) {
throw new ValidationException("Signature Reference URI \"" + reference.getURI()
+ "\" was resolved to a node other than the document element");
}
} else {
throw new ValidationException("Signature Reference URI did not resolve to a subtree");
}
}
代码示例来源:origin: org.opensaml/opensaml-saml-impl
if (!expected.isSameNode(resolved)) {
log.error("Signature Reference URI '{}' did not resolve to the expected parent Element", uri);
throw new SignatureException("Signature Reference URI did not resolve to the expected parent Element");
代码示例来源:origin: org.jboss.soa.bpel/riftsaw-bpel-runtime
if (parentElmt == null) {
parentElmt = (Element) targetNode.getParentNode();
} else if (!parentElmt.isSameNode((Element) targetNode.getParentNode())) {
throw new XPathFunctionException(
new FaultException(_oxpath.getOwner().constants.qnSelectionFailure,
代码示例来源:origin: org.opensaml/opensaml
if (!expected.isSameNode(resolved)) {
log.error("Signature Reference URI '{}' did not resolve to the expected parent Element", uri);
throw new ValidationException("Signature Reference URI did not resolve to the expected parent Element");
代码示例来源:origin: apache/cxf
Element nd = ((W3CDOMStreamWriter)xtw).getCurrentNode();
if (header.getObject() instanceof Element
&& nd.isSameNode(((Element)header.getObject()).getParentNode())) {
continue;
内容来源于网络,如有侵权,请联系作者删除!