Project

Profile

Help

Revision 55754867

Added by Michael Kay almost 2 years ago

Fix bug #4445

View differences:

latest9.9/hej/net/sf/saxon/tree/tiny/TinyParentNodeImpl.java
72 72
        // we optimize two special cases: firstly, where the node has no children, and secondly,
73 73
        // where it has a single text node as a child.
74 74

  
75

  
75 76
        if (tree.nodeKind[nodeNr] == Type.TEXTUAL_ELEMENT) {
76 77
            return TinyTextImpl.getStringValue(tree, nodeNr);
77 78
        } else if (tree.nodeKind[nodeNr] == Type.EXTERNAL_NODE_REFERENCE) {
78 79
            GraftedElement graft = tree.externalNodes.get(tree.alpha[nodeNr]);
79 80
            return graft.getStringValueCS();
80
        } else if (tree.depth[next] <= level) {
81
            return "";
82
        } else if (tree.nodeKind[next] == Type.TEXT && (next + 1 >= tree.numberOfNodes || tree.depth[next + 1] <= level)) {
83
            return TinyTextImpl.getStringValue(tree, next);
81
        } else if (next < tree.numberOfNodes) {    // bug 4445
82
            if (tree.depth[next] <= level) {
83
                return "";
84
            } else if (tree.nodeKind[next] == Type.TEXT && (next + 1 >= tree.numberOfNodes || tree.depth[next + 1] <= level)) {
85
                return TinyTextImpl.getStringValue(tree, next);
86
            }
84 87
        }
85 88

  
89

  
86 90
        // now handle the general case
87 91

  
88 92
        FastStringBuffer sb = null;

Also available in: Unified diff