strWriter.toString());
}
public void testPrefixedNamespace() throws Exception {
StringWriter strWriter = new StringWriter();
BadgerFishXMLStreamWriter w = new BadgerFishXMLStreamWriter(strWriter);
w.writeStartDocument();
w.writeStartElement("alice");
w.writeDefaultNamespace("http://some-namespace");
w.writeNamespace("charlie", "http://some-other-namespace");
assertEquals("http://some-other-namespace", w.getNamespaceContext().getNamespaceURI("charlie"));
assertEquals("charlie", w.getNamespaceContext().getPrefix("http://some-other-namespace"));
w.writeCharacters("bob");
w.writeEndElement();
w.writeEndDocument();
w.close();
strWriter.close();
assertJSONEquals("{ \"alice\": { \"@xmlns\": { \"$\" : \"http:\\/\\/some-namespace\", \"charlie\" : \"http:\\/\\/some-other-namespace\" }, \"$\" : \"bob\" } }",
strWriter.toString());