assertNode("c:Cars/c:Sports/c:Infiniti G37", "c:maker=Infiniti", "c:model=G37");
}
@Test
public void shouldParseXmlDocumentWithNamespacesThatAreNotYetInRegistry() throws IOException, SAXException {
NamespaceRegistry reg = context.getNamespaceRegistry();
reg.unregister(JcrLexicon.Namespace.URI);
reg.unregister(NT_NAMESPACE_URI);
// Verify the prefixes don't exist ...
assertThat(reg.getPrefixForNamespaceUri(JcrLexicon.Namespace.URI, false), is(nullValue()));
assertThat(reg.getPrefixForNamespaceUri(NT_NAMESPACE_URI, false), is(nullValue()));
assertThat(reg.getPrefixForNamespaceUri("http://default.namespace.com", false), is(nullValue()));
// Parse the XML file ...
parse("xmlHandler/docWithNestedNamespaces.xml");
// Get the prefix for the default namespace ...
String c = reg.getPrefixForNamespaceUri("http://default.namespace.com", false);
String i = reg.getPrefixForNamespaceUri("http://attributes.com", false);
String d = reg.getPrefixForNamespaceUri(reg.getDefaultNamespaceUri(), false);
assertThat("Namespace not properly registered in primary registry", c, is(notNullValue()));
assertThat("Namespace not properly registered in primary registry", d, is(notNullValue()));
assertThat("Namespace not properly registered in primary registry", i, is(notNullValue()));
if (c.length() != 0) c = c + ":";
if (d.length() != 0) d = d + ":";