String lookupBind (String contextXPointer,
String relativeXPointer, String atXPointer)
Returns the xpointer of the matching or bound element.
This method will first try to look up the element. If no match was found, then it will try to match as many steps as possible and then continue to bind.
contextXPointer |
The first matching element for contextXPointer
will be used as the context. The context is the point from where the relativeXPointer
will start.Note: Use "# /1" for document element. |
relativeXPointer |
The first matching element for relativeXPointer
will be returned or bound starting from the step that didn't have a match. |
atXPointer |
The new elements will be bound
at the locations defined by relativeXPointer .Note: if name is "*", then element will be added (at the end). |
Try to look up the first branch at the root level. If it does not exist add a branch at the beginning or the root level.
var docElement = "#/1";
var newElement = "#xpointer(has/b)";
var at = "*/*[1];
var firstBranch = diputree.lookupBind (docElement, newElement, at);