Package net.sf.saxon.om

Examples of net.sf.saxon.om.Item


          }
        }
    }
   
  public XMLType createXMLType(final SequenceIterator iter, BufferManager bufferManager, boolean emptyOnEmpty) throws XPathException, TeiidComponentException, TeiidProcessingException {
    Item item = iter.next();
    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;
          break;
        case net.sf.saxon.type.Type.TEXT:
          type = Type.TEXT;
          break;
      }
    }
    Item next = iter.next();
    if (next != null) {
      type = Type.CONTENT;
    }
    SQLXMLImpl xml = XMLSystemFunctions.saveToBufferManager(bufferManager, new XMLTranslator() {
     
View Full Code Here


      } else {
        try {
          XPathExpression path = proColumn.getPathExpression();
          XPathDynamicContext dynamicContext = path.createDynamicContext(item);
          SequenceIterator pathIter = path.iterate(dynamicContext);
          Item colItem = pathIter.next();
          if (colItem == null) {
            if (proColumn.getDefaultExpression() != null) {
              tuple.add(getEvaluator(Collections.emptyMap()).evaluate(proColumn.getDefaultExpression(), null));
            } else {
              tuple.add(null);
            }
            continue;
          }
          if (proColumn.getSymbol().getType() == DataTypeManager.DefaultDataClasses.XML) {
            XMLType value = table.getXQueryExpression().createXMLType(pathIter.getAnother(), this.getBufferManager(), false);
            tuple.add(value);
            continue;
          }
          if (pathIter.next() != null) {
            throw new TeiidProcessingException(QueryPlugin.Util.getString("XMLTableName.multi_value", proColumn.getName())); //$NON-NLS-1$
          }
          Object value = Value.convertToJava(colItem);
          if (value instanceof Item) {
            Item i = (Item)value;
            BuiltInAtomicType bat = typeMapping.get(proColumn.getSymbol().getType());
            if (bat != null) {
              ConversionResult cr = StringValue.convertStringToBuiltInType(i.getStringValueCS(), bat, null);
              value = cr.asAtomic();
              value = Value.convertToJava((AtomicValue)value);
              if (value instanceof Item) {
                value = ((Item)value).getStringValue();
              }
            } else {
              value = i.getStringValue();
            }
          }
          value = FunctionDescriptor.importValue(value, proColumn.getSymbol().getType());
          tuple.add(value);
        } catch (XPathException e) {
View Full Code Here

    return nodes;
  }

  public Node next() throws XQueryException {
    if (this.results != null) {
      Item item;
      try { // pull from underlying saxon iterator
        item = this.results.next();
      } catch (TransformerException e) {
        throw new XQueryException(e);
      }
View Full Code Here

        DynamicQueryContext dynamicQueryContext = new DynamicQueryContext(config);

        Message in = exchange.getIn();
        Source source = null;
        try {
            Item item = in.getBody(Item.class);
            dynamicQueryContext.setContextItem(item);
        } catch (NoTypeConversionAvailableException e) {
            try {
                source = in.getBody(Source.class);
            } catch (NoTypeConversionAvailableException e2) {
View Full Code Here

    public static ListVariable createListOfXmlNodes(XQueryExpression exp, DynamicQueryContext dynamicContext) throws XPathException {
        final SequenceIterator iter = exp.iterator(dynamicContext);

        ListVariable listVariable = new ListVariable();
        while (true) {
            Item item = iter.next();
            if (item == null) {
                break;
            }

            XmlNodeWrapper value = new XmlNodeWrapper(item);
View Full Code Here

        c2.setCurrentTemplateRule(null);

        if (controller.isTracing()) {
            TraceListener listener = controller.getTraceListener();
            while (true) {
                Item item = groupIterator.next();
                if (item == null) {
                    break;
                }
                listener.startCurrentItem(item);
                action.process(c2);
                listener.endCurrentItem(item);
            }
        } else {
            while (true) {
                Item item = groupIterator.next();
                if (item == null) {
                    break;
                }
                action.process(c2);
            }
View Full Code Here

            XPathException e = new XPathException("There is no context item");
            e.setXPathContext(context);
            e.setErrorCode("XTDE0565");
            throw e;
        }
        Item currentItem = context.getCurrentIterator().current();
        if (!(currentItem instanceof NodeInfo)) {
            XPathException e = new XPathException("Cannot call xsl:next-match when context item is not a node");
            e.setXPathContext(context);
            e.setErrorCode("XTDE0565");
            throw e;
View Full Code Here

            e.setXPathContext(context);
            e.setErrorCode("XTDE0565");
            e.setLocator(this);
            throw e;
        }
        Item currentItem = context.getCurrentIterator().current();
        if (!(currentItem instanceof NodeInfo)) {
            XPathException e = new XPathException("Cannot call xsl:apply-imports when context item is not a node");
            e.setXPathContext(context);
            e.setErrorCode("XTDE0565");
            e.setLocator(this);
View Full Code Here

        c2.setOrigin(this);
        c2.setCurrentIterator(iter);
        c2.setCurrentRegexIterator(iter);

        while (true) {
            Item it = iter.next();
            if (it == null) {
                break;
            }
            if (iter.isMatching()) {
                if (matching != null) {
View Full Code Here

    public Item evaluateItem(XPathContext context) throws XPathException {
        Controller controller = context.getController();
        if (controller.isTracing()) {
            controller.getTraceListener().enter(getInstructionInfo(), context);
        }
        Item result = child.evaluateItem(context);
        if (controller.isTracing()) {
            controller.getTraceListener().leave(getInstructionInfo());
        }
        return result;
    }
View Full Code Here

TOP

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

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.