projects
/
tatoo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix a bug: attributes were considered as nodes -> using first_child_x
[tatoo.git]
/
src
/
tree.ml
diff --git
a/src/tree.ml
b/src/tree.ml
index
2b0fa4e
..
434d195
100644
(file)
--- a/
src/tree.ml
+++ b/
src/tree.ml
@@
-261,10
+261,16
@@
let rec print_xml out tree_ node =
let root t = t.root
let first_child _ n = n.first_child
let root t = t.root
let first_child _ n = n.first_child
+let first_child_x _ n =
+ if n.first_child.tag == QName.attribute_map
+ then n.first_child.next_sibling
+ else n.first_child
let next_sibling _ n = n.next_sibling
let parent _ n = n.parent
(* Begin Lucca Hirschi *)
let next_sibling _ n = n.next_sibling
let parent _ n = n.parent
(* Begin Lucca Hirschi *)
-let is_leaf t n = (first_child t n == nil) && (next_sibling t n == nil)
+let is_leaf t n = (not (n.tag == QName.attribute_map)) &&
+ (first_child t n == nil) && (next_sibling t n == nil)
+let is_attribute t n = n.tag == QName.attribute_map
(* End *)
let tag _ n = n.tag
let data _ n = n.data
(* End *)
let tag _ n = n.tag
let data _ n = n.data
@@
-287,7
+293,8
@@
let rec print_xml_preorder out tree_ node =
let fchild =
if node.first_child.tag == QName.attribute_map then
let () =
let fchild =
if node.first_child.tag == QName.attribute_map then
let () =
- print_attributes out tree_ node.first_child.first_child
+ let ffn = node.first_child.first_child in
+ print_attributes out tree_ ffn;
in
node.first_child.next_sibling
else
in
node.first_child.next_sibling
else
@@
-303,3
+310,6
@@
let rec print_xml_preorder out tree_ node =
end
in
print_xml_preorder out tree_ node.next_sibling
end
in
print_xml_preorder out tree_ node.next_sibling
+
+let debug_node fmt t n =
+ Parser.debug_node fmt n