New issue 27 by mathieu.carbou: Remove namespaces
http://code.google.com/p/xmltool/issues/detail?id=27
faire une method dans XMLTag
XMLTag removeNamespaces(): delete all namespaces and remove all prefixes of
tag name and attributes of current tag
XMLTag removeNamespacesDeeply(): same but for all child nodes also
=> doing gotoRoot.removeNamespacesDeeply() will remove all namespaces and
prefixes from a document.
=> Also throw an exception if operation fails (i.e. if you have an element
with two same attribute's name in different namespaces, thus two prefixes)
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
Comment #1 on issue 27 by mathieu.carbou: Remove namespaces
http://code.google.com/p/xmltool/issues/detail?id=27
XMLTag.deletePrefixes implemented.
Thus, XPath expressions can be simplified to ignore prefixes, and both
documents can
take the same XPath expressions regarding whether they ignore namespaces or
not:
XMLTag nons = XMLDoc.from(new File("big-sample.xml"),
true).deletePrefixes();
XMLTag ns = XMLDoc.from(new File("big-sample.xml"), false).deletePrefixes();
These expressions:
System.out.println("UUID: " +
ns.gotoRoot().getAttribute("UUID", "Vehicle[1]/Type"));
System.out.println("UUID: " +
nons.gotoRoot().getAttribute("UUID", "Vehicle[1]/Type"));
will give the same result, even if Vehicle was prefixed with a namespace
and UUID in
another namespace. All tags an attributes are simplified in both cases to
remove
prefoxes and namespaces.