public void testNamespaceNodesComeBeforeAttributeNodesInDocumentOrder() throws JaxenException {
org.w3c.dom.Element root = doc.createElementNS("http://www.example.org", "pre:b");
doc.appendChild(root);
root.setAttribute("name", "value");
XPath xpath = new DOMXPath("/*/attribute::* | /*/namespace::node()");
List result = xpath.selectNodes(doc);
assertTrue(((org.w3c.dom.Node) result.get(0)).getNodeType() == Pattern.NAMESPACE_NODE);
assertTrue(((org.w3c.dom.Node) result.get(1)).getNodeType() == Pattern.NAMESPACE_NODE);
assertTrue(((org.w3c.dom.Node) result.get(2)).getNodeType() == Node.ATTRIBUTE_NODE);
// now flip the order of the statement and retest
xpath = new DOMXPath("/*/namespace::node() | /*/attribute::* ");
result = xpath.selectNodes(doc);
assertTrue(((org.w3c.dom.Node) result.get(0)).getNodeType() == Pattern.NAMESPACE_NODE);
assertTrue(((org.w3c.dom.Node) result.get(1)).getNodeType() == Pattern.NAMESPACE_NODE);
assertTrue(((org.w3c.dom.Node) result.get(2)).getNodeType() == Node.ATTRIBUTE_NODE);
}