Package net.sf.saxon.om

Examples of net.sf.saxon.om.NodeInfo


    if (item == null && !emptyOnEmpty) {
      return null;
    }
    XMLType.Type type = Type.CONTENT;
    if (item instanceof NodeInfo) {
      NodeInfo info = (NodeInfo)item;
      switch (info.getNodeKind()) {
        case net.sf.saxon.type.Type.DOCUMENT:
          type = Type.DOCUMENT;
          break;
        case net.sf.saxon.type.Type.ELEMENT:
          type = Type.ELEMENT;
View Full Code Here


    if (PRESERVE_IDENTITIES && this.alreadyConverted == null) {
      this.alreadyConverted = new HashMap();
    }
    Node value = convertNodeInfo(node);
    if (PRESERVE_IDENTITIES && node.getNodeKind() != Type.NAMESPACE) {
      NodeInfo root = node.getRoot();
      if (!root.isSameNodeInfo(node)) {
        if (DEBUG) System.err.println(
            "ROOT converting nodeinfo: " + root.getStringValue() + " : " + root);
        convertNodeInfo(root); // link value together with it's ancestor pointers
      }
    }
    return value;
  }
View Full Code Here

    Document doc = new Document(new Element("fakeRoot"));
    doc.setBaseURI(node.getBaseURI());
   
    boolean hasRootElement = false;
    int i = 0;
    NodeInfo next;
    AxisIterator iter = node.iterateAxis(Axis.CHILD);
    while ((next = (NodeInfo) iter.next()) != null) {
      Node child = convertNodeInfo(next);
      if (child instanceof Element) { // replace fake root with real root
        if (hasRootElement) throw new IllegalAddException(
View Full Code Here

  }
 
  private Element convertElementNodeInfo(NodeInfo node) {
    if (DEBUG) System.err.println("converting element=" + node.getDisplayName());
    Element elem = new Element(node.getDisplayName(), node.getURI());
    NodeInfo next;
   
    // Append attributes
    AxisIterator iter = node.iterateAxis(Axis.ATTRIBUTE);
    ArrayList prefixes = null;
    while ((next = (NodeInfo) iter.next()) != null) {
      elem.addAttribute((Attribute) convertNodeInfo(next));
     
      // keep track of attributes with prefixes, so we can avoid adding costly
      // additional namespaces declarations below. This safes potentially vast
      // amounts of memory due too XOM's expensive NS declaration storage scheme.
      String prefix = next.getPrefix();
      if (prefix.length() != 0) { // e.g. SOAP
         if (prefixes == null) prefixes = new ArrayList(1);
         prefixes.add(prefix);
      }
    }
View Full Code Here

            org.w3c.dom.Document domDoc = null;
            if (mode.equals("dom")) {
              domDoc = domBuilder.parse(file);
            }
           
            NodeInfo saxonDoc = null;
            if (mode.equals("saxon")) {
              saxonDoc = context.buildDocument(new StreamSource(new ByteArrayInputStream(fileData)));
            }
   
            if (mode.startsWith("fi")) {
View Full Code Here

     * are generated by XQuery, there will always be a valueExpression to evaluate
     * the content
     */

    public Item evaluateItem(XPathContext context) throws XPathException {
        NodeInfo node = (NodeInfo)super.evaluateItem(context);
        String prefix = node.getLocalPart();
        String uri = node.getStringValue();
        checkPrefixAndUri(prefix, uri, context);
        return node;
    }
View Full Code Here

            XPathException e = new XPathException("Cannot call xsl:next-match when context item is not a node");
            e.setXPathContext(context);
            e.setErrorCode("XTDE0565");
            throw e;
        }
        NodeInfo node = (NodeInfo)currentItem;
        Rule rule = controller.getRuleManager().getNextMatchHandler(node, mode, currentRule, context);

    if (rule==null) {             // use the default action for the node
            ApplyTemplates.defaultAction(node, params, tunnels, context, getLocationId());
        } else if (useTailRecursion) {
View Full Code Here

            e.setXPathContext(context);
            e.setErrorCode("XTDE0565");
            e.setLocator(this);
            throw e;
        }
        NodeInfo node = (NodeInfo)currentItem;
        Rule rule = controller.getRuleManager().getTemplateRule(node, mode, min, max, context);

    if (rule==null) {             // use the default action for the node
            ApplyTemplates.defaultAction(node, params, tunnels, context, getLocationId());
        } else {
View Full Code Here

            ini.endElement();
            ini.close();

            // the constructed element is the first and only item in the sequence
            NodeInfo result = (NodeInfo)seq.popLastItem();
            seq.reset();
            return result;

        } catch (XPathException err) {
            if (err instanceof ValidationException) {
View Full Code Here

    public NodeInfo transform(Node source, TransformationContext context) {
        Configuration configuration = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
        if (configuration == null) {
            configuration = new Configuration();
        }
        NodeInfo docInfo = null;
        try {
            source = DOMHelper.promote(source);
            docInfo = Builder.build(new DOMSource(source), null, configuration);
        } catch (XPathException e) {
            throw new TransformationException(e);
View Full Code Here

TOP

Related Classes of net.sf.saxon.om.NodeInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.