org.kuali.rice.ken.xpath
Class XPathTest
java.lang.Object
org.kuali.rice.test.BaseRiceTestCase
org.kuali.rice.test.RiceTestCase
org.kuali.rice.test.RiceInternalSuiteDataTestCase
org.kuali.rice.test.BaseModuleTestCase
org.kuali.rice.test.BaselineTestCase
org.kuali.rice.ken.test.KENTestCase
org.kuali.rice.ken.xpath.XPathTest
- All Implemented Interfaces:
- MethodAware
public class XPathTest
- extends KENTestCase
Unit test that tests the affects of various document parsing (DocumentBuilderFactory)
and XPath (XPath) flags, such as validation, namespace awareness, and namespace context.
Lessons learned:
- DocumentBuilder namespace awareness needs to be turned on for validation to work
- XPath absolutely requires a working NamespaceContext and qualified node names in expressions
if operating against a DOM which is the result of a validating parse
- There is no apparent way to set the "default" namespace for XPath...so even when NamespaceContext
is set, nodes must be qualified. The only way to obtain the "default" namespace is to explicitly
qualify with an empty namespace, e.g. /:notification/:channel (which is ugly and potentially confusing)
- When deriving NamespaceContext from validated DOM, the "default" namespace must therefore be explicitly
registered with a prefix (which is redundant) so the NamespaceContext lookup can succeed. The alternative
is to predefine the prefix in the NamespaceContent (which can be done by using a CompositeNamespaceContenxt
consisting of a ConfiguredNamespaceContext and a DocumentNamespaceContext).
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
Methods inherited from class org.kuali.rice.test.RiceTestCase |
configureLogging, dumpMemory, getBaseDir, getConfigLocations, getFullTestName, getModuleTestConfigLocation, getRiceMasterDefaultConfigFile, getTestHarnessConfig, getTestHarnessSpringBeansLocation, getTestHarnessSpringResourceLoader, loadPerTestData, logAfterRun, logBeforeRun, report, setBaseDirSystemProperty, setClearTables, setModuleName, setUpInternal, startLifecycles, startSuiteDataLoaderLifecycles, stopLifecycles, tearDown |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TEST_XML
private static final String TEST_XML
- See Also:
- Constant Field Values
XPathTest
public XPathTest()
getTestXMLInputSource
protected InputSource getTestXMLInputSource()
getXPath
protected XPath getXPath(Document doc)
getDocument
protected Document getDocument(boolean namespaceAware,
boolean validate)
throws Exception
- Throws:
Exception
testXPathWithPlainDOM
public void testXPathWithPlainDOM()
throws Exception
- Throws:
Exception
testXPathWithNamespaceAwareDOM
public void testXPathWithNamespaceAwareDOM()
throws Exception
- Throws:
Exception
testXPathWithValidatedDOMFixedNamespace
public void testXPathWithValidatedDOMFixedNamespace()
throws Exception
- Throws:
Exception
testXPathWithValidatedDOMDocNamespace
public void testXPathWithValidatedDOMDocNamespace()
throws Exception
- Throws:
Exception
Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.