1 | void testNSOnElement() throws IOException {↵ | | 1 | void testNSPrefixOnAttribute() throws IOException {↵
|
2 | Document d = DOMUtils.newDocument();↵ | | 2 | Document d = DOMUtils.newDocument();↵
|
3 | Element root = d.createElementNS("urn:foo", "root");↵ | | 3 | Element root = d.createElementNS("urn:foo", "root");↵
|
4 | root.setAttributeNS("urn:foo2", "bar", "baz");↵ | | 4 | root.setAttributeNS("urn:foo2", "bar", "baz");↵
|
|
5 | StringWriter sw = new StringWriter();↵ | | 5 | StringWriter sw = new StringWriter();↵
|
6 | DOMElementWriter w =↵ | | 6 | DOMElementWriter w =↵
|
7 | new DOMElementWriter(false,↵ | | 7 | new DOMElementWriter(false,↵
|
8 | DOMElementWriter.XmlNamespacePolicy↵ | | 8 | DOMElementWriter.XmlNamespacePolicy↵
|
9 | .ONLY_QUALIFY_ELEMENTS);↵ | | 9 | .QUALIFY_ALL);↵
|
10 | w.write(root, sw, 0, " ");↵ | | 10 | w.write(root, sw, 0, " ");↵
|
11 | assertEquals("<root bar=\"baz\" xmlns=\"urn:foo\"↵ | | 11 | assertEquals("<root ns0:bar=\"baz\" xmlns=\"urn:foo\""↵
|
12 | />"↵ | | 12 | + " xmlns:ns0=\"urn:foo2\" />"↵
|
13 | + StringUtils.LINE_SEP, sw.toString());↵ | | 13 | + StringUtils.LINE_SEP, sw.toString());↵
|
14 | }↵ | | 14 | }↵
|
|
15 | public void testNSPrefixOnAttribute() throws IOException {↵ | | 15 | public void testNSPrefixOnAttributeEvenWithoutElement() throws IOException {↵
|
16 | Document d = DOMUtils.newDocument();↵ | | 16 | Document d = DOMUtils.newDocument();↵
|
17 | Element root = d.createElementNS("urn:foo", "root");↵ | | 17 | Element root = d.createElementNS("urn:foo", "root");↵
|
18 | root.setAttributeNS("urn:foo2", "bar", "baz");↵ | | 18 | root.setAttributeNS("urn:foo2", "bar", "baz");↵
|
|
19 | StringWriter sw = new StringWriter();↵ | | 19 | StringWriter sw = new StringWriter();↵
|
20 | DOMElementWriter w =↵ | | 20 | DOMElementWriter w =↵
|
21 | new DOMElementWrite | | 21 | new DOMElementWrite
|