本文整理了Java中org.w3c.dom.Element.compareDocumentPosition()
方法的一些代码示例,展示了Element.compareDocumentPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.compareDocumentPosition()
方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:compareDocumentPosition
暂无
代码示例来源:origin: xyz.cofe/common
@Override
public short compareDocumentPosition(Node other) throws DOMException {
return element.compareDocumentPosition(other);
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public short compareDocumentPosition(Node other) throws DOMException {
return element.compareDocumentPosition(soapDocument.getDomNode(other));
}
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Node#compareDocumentPosition(org.w3c.dom.Node)
*/
@Override
public short compareDocumentPosition(Node other) throws DOMException {
return original.get().compareDocumentPosition(other);
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Node#compareDocumentPosition(org.w3c.dom.Node)
*/
@Override
public short compareDocumentPosition(Node other) throws DOMException {
return original.get().compareDocumentPosition(other);
}
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Node#compareDocumentPosition(org.w3c.dom.Node)
*/
public short compareDocumentPosition(Node other) throws DOMException {
return getCurrentInternal().compareDocumentPosition(other);
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Node#compareDocumentPosition(org.w3c.dom.Node)
*/
public short compareDocumentPosition(Node other) throws DOMException {
return getAtualInterno().compareDocumentPosition(other);
}
代码示例来源:origin: Geomatys/geotoolkit
@Override
public short compareDocumentPosition(Node other) throws DOMException {
final Element elem = getElement();
return elem != null ? elem.compareDocumentPosition(other) : 0;
}
代码示例来源: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;
Document doc2;
NodeList nameList;
NodeList positionList;
Element strong;
Element code;
int documentPosition;
doc = (Document) load("hc_staff", false);
doc2 = doc;
nameList = doc.getElementsByTagName("strong");
strong = (Element) nameList.item(0);
positionList = doc2.getElementsByTagName("code");
code = (Element) positionList.item(0);
documentPosition = (int) strong.compareDocumentPosition(code);
assertEquals("nodecomparedocumentpositionFollowing32", 4, documentPosition);
}
/**
代码示例来源: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;
NodeList nameList;
NodeList positionList;
Element strong;
Element code;
Element newElem;
int namePosition;
int elemPosition;
Node appendedChild;
doc = (Document) load("hc_staff", true);
nameList = doc.getElementsByTagName("strong");
strong = (Element) nameList.item(0);
positionList = doc.getElementsByTagName("code");
code = (Element) positionList.item(1);
newElem = doc.createElementNS("http://www.w3.org/1999/xhtml", "br");
appendedChild = code.appendChild(newElem);
namePosition = (int) strong.compareDocumentPosition(newElem);
assertEquals("nodecomparedocumentpositionFollowing31", 4, namePosition);
elemPosition = (int) newElem.compareDocumentPosition(strong);
assertEquals("nodecomparedocumentpositionPRECEDING31", 2, elemPosition);
}
/**
代码示例来源: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;
NodeList nameList;
NodeList positionList;
Element strong;
Element code;
int namePosition;
doc = (Document) load("hc_staff", false);
nameList = doc.getElementsByTagName("strong");
strong = (Element) nameList.item(0);
positionList = doc.getElementsByTagName("code");
code = (Element) positionList.item(0);
namePosition = (int) code.compareDocumentPosition(strong);
assertEquals("nodecomparedocumentpositionFollowing30", 2, namePosition);
}
/**
代码示例来源: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;
NodeList elemList;
Element elemName;
Node entRef;
int elementPosition;
int entRefPosition;
doc = (Document) load("hc_staff", false);
elemList = doc.getElementsByTagName("var");
elemName = (Element) elemList.item(2);
entRef = elemName.getFirstChild();
elementPosition = (int) elemName.compareDocumentPosition(entRef);
assertEquals("nodecomparedocumentpositionIsContainedFollowing25", 20, elementPosition);
entRefPosition = (int) entRef.compareDocumentPosition(elemName);
assertEquals("nodecomparedocumentpositionContainsPRECEDING25", 10, entRefPosition);
}
/**
代码示例来源: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 elem;
Element newElem;
NodeList elemList;
int documentPosition;
int documentElementPosition;
Node appendedChild;
doc = (Document) load("hc_staff", true);
elemList = doc.getElementsByTagName("p");
elem = (Element) elemList.item(3);
newElem = doc.createElementNS("http://www.w3.org/1999/xhtml", "br");
appendedChild = elem.appendChild(newElem);
documentPosition = (int) doc.compareDocumentPosition(newElem);
assertEquals("nodecomparedocumentpositionIsContainedFollowing09", 20, documentPosition);
documentElementPosition = (int) newElem.compareDocumentPosition(doc);
assertEquals("nodecomparedocumentpositionContainsPRECEDING09", 10, documentElementPosition);
}
/**
代码示例来源: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;
NodeList elemList;
Element elem;
NodeList elemListFollows;
Element elemFollows;
Attr attr;
int attrPosition;
int elemFollowsPosition;
doc = (Document) load("hc_staff", false);
elemList = doc.getElementsByTagName("p");
elem = (Element) elemList.item(3);
attr = elem.getAttributeNode("dir");
elemListFollows = doc.getElementsByTagName("strong");
elemFollows = (Element) elemListFollows.item(3);
attrPosition = (int) attr.compareDocumentPosition(elemFollows);
assertEquals("nodecomparedocumentpositionFollowing36", 4, attrPosition);
elemFollowsPosition = (int) elemFollows.compareDocumentPosition(attr);
assertEquals("nodecomparedocumentpositionPRECEEDING36", 2, elemFollowsPosition);
}
/**
代码示例来源: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;
NodeList elemList;
Element elem;
Attr attr;
int elementPosition;
int attrPosition;
doc = (Document) load("hc_staff", false);
elemList = doc.getElementsByTagName("p");
elem = (Element) elemList.item(3);
attr = elem.getAttributeNode("dir");
elementPosition = (int) elem.compareDocumentPosition(attr);
assertEquals("nodecomparedocumentpositionIsContainedFollowing35", 20, elementPosition);
attrPosition = (int) attr.compareDocumentPosition(elem);
assertEquals("nodecomparedocumentpositionPRECEDINGContains35", 10, attrPosition);
}
/**
代码示例来源: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 docElem;
Element newElem;
int documentPosition;
int documentElementPosition;
Node appendedChild;
doc = (Document) load("hc_staff", true);
docElem = doc.getDocumentElement();
newElem = doc.createElementNS("http://www.w3.org/1999/xhtml", "br");
appendedChild = docElem.appendChild(newElem);
documentPosition = (int) doc.compareDocumentPosition(newElem);
assertEquals("nodecomparedocumentpositionIsContainedFollowing07", 20, documentPosition);
documentElementPosition = (int) newElem.compareDocumentPosition(doc);
assertEquals("nodecomparedocumentpositionContainedPRECEDING07", 10, documentElementPosition);
}
/**
代码示例来源: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 elem;
NodeList elemList;
int documentPosition;
int elementPosition;
doc = (Document) load("hc_staff", false);
elemList = doc.getElementsByTagName("p");
elem = (Element) elemList.item(3);
documentPosition = (int) doc.compareDocumentPosition(elem);
assertEquals("nodecomparedocumentpositionIsContainedFollowing08", 20, documentPosition);
elementPosition = (int) elem.compareDocumentPosition(doc);
assertEquals("nodecomparedocumentpositionContainsPRECEDING08", 10, elementPosition);
}
/**
代码示例来源: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 docElem;
int documentPositionDoc;
int documentPositionDocElem;
doc = (Document) load("hc_staff", false);
docElem = doc.getDocumentElement();
documentPositionDoc = (int) doc.compareDocumentPosition(docElem);
assertEquals("nodecomparedocumentpositionIsContainedFollowing06", 20, documentPositionDoc);
documentPositionDocElem = (int) docElem.compareDocumentPosition(doc);
assertEquals("nodecomparedocumentpotionContainsPRECEDING06", 10, documentPositionDocElem);
}
/**
代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite
entRefPosition = (int) entRef.compareDocumentPosition(entRefChild1);
assertEquals("nodecomparedocumentpositionIsContainedFollowing26", 20, entRefPosition);
entRefChild1Position = (int) entRefChild1.compareDocumentPosition(entRef);
assertEquals("nodecomparedocumentpositionContainsPRECEDING26", 10, entRefChild1Position);
代码示例来源: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 docElem;
EntityReference entRef1;
EntityReference entRef2;
Element entRefChild1;
ProcessingInstruction entRefChild2;
int entRefChild1Position;
int entRefChild2Position;
Node appendedChild;
doc = (Document) load("hc_staff", true);
entRef1 = doc.createEntityReference("ent4");
entRef2 = doc.createEntityReference("ent4");
docElem = doc.getDocumentElement();
appendedChild = docElem.appendChild(entRef1);
appendedChild = docElem.appendChild(entRef2);
entRefChild1 = (Element) entRef1.getFirstChild();
assertNotNull("entRefChild1NotNull", entRefChild1);
entRefChild2 = (ProcessingInstruction) entRef2.getLastChild();
assertNotNull("entRefChild2NotNull", entRefChild2);
entRefChild1Position = (int) entRefChild1.compareDocumentPosition(entRefChild2);
assertEquals("nodecomparedocumentpositionFollowing29", 4, entRefChild1Position);
entRefChild2Position = (int) entRefChild2.compareDocumentPosition(entRefChild1);
assertEquals("nodecomparedocumentpositionPRECEDING29", 2, entRefChild2Position);
}
/**
代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite
entRefChild2 = (ProcessingInstruction) entRef.getLastChild();
assertNotNull("entRefChild2NotNull", entRefChild2);
entRefChild1Position = (int) entRefChild1.compareDocumentPosition(entRefChild2);
assertEquals("nodecomparedocumentpositionFollowing28", 4, entRefChild1Position);
entRefChild2Position = (int) entRefChild2.compareDocumentPosition(entRefChild1);
内容来源于网络,如有侵权,请联系作者删除!