/**
* Test changing namespace prefixes.
*/
public void testNamespacePrefixes() throws Exception {
JDOMWriter jdomWriter = new JDOMWriter(new String[] { EMPTY_NAMESPACE, XML_NAMESPACE, "urn:myNs1", "urn:myNs2" });
assertEquals("", jdomWriter.getNamespaceUri(0));
assertEquals("http://www.w3.org/XML/1998/namespace", jdomWriter.getNamespaceUri(1));
assertEquals("urn:myNs1", jdomWriter.getNamespaceUri(2));
assertEquals("urn:myNs2", jdomWriter.getNamespaceUri(3));
assertEquals("", jdomWriter.getNamespacePrefix(0));
assertEquals("xml", jdomWriter.getNamespacePrefix(1));
assertNull("unexpected prefix defined", jdomWriter.getNamespacePrefix(2));
assertNull("unexpected prefix defined", jdomWriter.getNamespacePrefix(3));
jdomWriter.startTagNamespaces(0, "element1", new int[] {2, 3}, new String[] {"myns1", "myns2"});
jdomWriter.closeStartTag();
assertEquals("myns1", jdomWriter.getNamespacePrefix(2));
assertEquals("myns2", jdomWriter.getNamespacePrefix(3));
jdomWriter.startTagNamespaces(0, "element2", new int[] {2}, new String[] {"prefix"});
assertEquals("prefix", jdomWriter.getNamespacePrefix(2));
assertEquals("myns2", jdomWriter.getNamespacePrefix(3));
jdomWriter.closeEmptyTag();
assertEquals("myns1", jdomWriter.getNamespacePrefix(2));
assertEquals("myns2", jdomWriter.getNamespacePrefix(3));
jdomWriter.endTag(0, "element1");
assertNull("unexpected prefix defined", jdomWriter.getNamespacePrefix(2));
assertNull("unexpected prefix defined", jdomWriter.getNamespacePrefix(3));
}