XMLStartElement { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("<" + getName() + ""); for (int i = 0; i < getNamespaceCount(); ++i) { sb.append(" xmlns"); String prefix = getNamespacePrefix(i); if (prefix != null && !prefix.isEmpty()) { sb.append(":"); sb.append(prefix); } sb.append("=\""); sb.append(getNamespaceUri(i)); sb.append("\""); } for (int i = 0; i < getAttributeCount(); ++i) { sb.append(" "); String prefix = getAttributePrefix(i); if (prefix != null && !prefix.isEmpty()) { sb.append(prefix); sb.append(":"); } sb.append(getAttributeLocalName(i)); sb.append("=\""); sb.append(getAttributeValue(i)); sb.append("\""); } sb.append(">"); return sb.toString(); } XMLStartElement(String localName);  XMLStartElement(String prefix, String localName);  XMLStartElement(String prefix, String localName, String[] namespacePrefixes,
      String[] namespaceUris);  XMLStartElement(String prefix, String localName, String[] attributePrefixes,
      String[] attributeLocalNames,  String[] attributeValues);  XMLStartElement(String prefix, String localName, String[] namespacePrefixes,
      String[] namespaceUris, String[] attributePrefixes, String[] attributeLocalNames,
      String[] attributeValues); String getPrefix(); String getLocalName(); String getName(); int getNamespaceCount(); String getNamespacePrefix(int i); String getNamespaceUri(int i); int getAttributeCount(); String getAttributePrefix(int i); String getAttributeLocalName(int i); String getAttributeValue(int i); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); JsonObject toJsonObject(); static XMLStartElement fromJsonObject(JsonObject obj);  }
@Test public void simple() { XMLStartElement e = new XMLStartElement("test"); assertEquals("<test>", e.toString()); }
@Test public void prefix() { XMLStartElement e = new XMLStartElement("p", "test"); assertEquals("<p:test>", e.toString()); }
@Test public void attrs() { XMLStartElement e = new XMLStartElement(null, "test", new String[] { "", "" }, new String[] { "key1", "key2" }, new String[] { "v1", "v2" }); assertEquals("<test key1=\"v1\" key2=\"v2\">", e.toString()); }
@Test public void attrsWithPrefixes() { XMLStartElement e = new XMLStartElement("p", "test", new String[] { "a", "b" }, new String[] { "key1", "key2" }, new String[] { "v1", "v2" }); assertEquals("<p:test a:key1=\"v1\" b:key2=\"v2\">", e.toString()); }
@Test public void namespaces() { XMLStartElement e = new XMLStartElement("p", "test", new String[] { "p1", "p2" }, new String[] { "http: assertEquals("<p:test xmlns:p1=\"http: }
@Test public void full() { XMLStartElement e = new XMLStartElement("p", "test", new String[] { "p1", "p2" }, new String[] { "http: new String[] { "a", "b" }, new String[] { "key1", "key2" }, new String[] { "v1", "v2" }); assertEquals("<p:test xmlns:p1=\"http: + "a:key1=\"v1\" b:key2=\"v2\">", e.toString()); }