Example #1
0
  /**
   * Converts a xom node into something readable by Saxon
   *
   * @param node
   * @param config
   * @return
   */
  static NodeInfo wrap(Node node, Configuration config) {
    if (node == null) throw new IllegalArgumentException("node must not be null"); // $NON-NLS-1$
    if (node instanceof DocType)
      throw new IllegalArgumentException("DocType can't be queried by XQuery/XPath"); // $NON-NLS-1$

    Node root = node;
    while (root.getParent() != null) {
      root = root.getParent();
    }

    DocumentWrapper docWrapper = new DocumentWrapper(root, root.getBaseURI(), config);

    return docWrapper.wrap(node);
  }