polotek/libxmljs — pull request #149 by triccardi-systran (2012-07-18 16:08:07+00:00)
Title: fix child method: off-by-one error: child(0) == child(1)

```javascript
var doc = libxml.parseXmlString('' +
'text node 1text node 2');

console.log("doc.root().length: " + doc.root().childNodes().length);

var child1 = doc.root().child(0);
var child2 = doc.root().child(1);
var child3 = doc.root().child(2);

console.log("child1 text: " + child1.text());
console.log("child2 text: " + child2.text());
console.log("child3 text: " + child3.text());
```

This code should crash on the last line: *child3* is *null*.
However we get this output:
```
doc.root().length: 2
child1 text: text node 1
child2 text: text node 1
child3 text: text node 2
```