projects
/
tatoo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3f53099
)
Rework the java test program to print out attribute nodes too.
author
Kim Nguyễn
<kn@lri.fr>
Wed, 13 Mar 2013 10:21:24 +0000
(11:21 +0100)
committer
Kim Nguyễn
<kn@lri.fr>
Wed, 13 Mar 2013 10:21:24 +0000
(11:21 +0100)
tools/XPathEval.java
patch
|
blob
|
history
diff --git
a/tools/XPathEval.java
b/tools/XPathEval.java
index
8c854ac
..
436ba7a
100644
(file)
--- a/
tools/XPathEval.java
+++ b/
tools/XPathEval.java
@@
-21,8
+21,16
@@
public class XPathEval {
StreamResult o = new StreamResult(System.out);
System.out.println("<xml_result>");
for(int i = 0; i < nodes.getLength(); i++){
StreamResult o = new StreamResult(System.out);
System.out.println("<xml_result>");
for(int i = 0; i < nodes.getLength(); i++){
- serializer.transform(new DOMSource(nodes.item(i)), o);
- System.out.println("");
+ Node n = nodes.item(i);
+ switch (n.getNodeType()) {
+ case Node.ATTRIBUTE_NODE:
+ System.out.print (n.getNodeName() + "=" + n.getNodeValue());
+ break;
+ default:
+ serializer.transform(new DOMSource(nodes.item(i)), o);
+ break;
+ };
+ System.out.println();
};
System.out.println("</xml_result>");
} catch (XPathException e) {
};
System.out.println("</xml_result>");
} catch (XPathException e) {