net.sf.saxon.om.Item类的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中net.sf.saxon.om.Item类的一些代码示例,展示了Item类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item类的具体详情如下:
包路径:net.sf.saxon.om.Item
类名称:Item

Item介绍

[英]An Item is an object that can occur as a member of a sequence. It corresponds directly to the concept of an item in the XPath 2.0 data model. There are two kinds of Item: atomic values, and nodes.

This interface is part of the public Saxon API. As such (starting from Saxon 8.4), methods that form part of the stable API are labelled with a JavaDoc "since" tag to identify the Saxon release at which they were introduced.

Note: there is no method getItemType(). This is to avoid having to implement it on every implementation of NodeInfo. Instead, use the static method Type.getItemType(Item).
[中]项是可以作为序列成员出现的对象。它直接对应于XPath2.0数据模型中的项目概念。有两种类型的项:原子值和节点。
此接口是公共Saxon API的一部分。因此(从Saxon 8.4开始),构成稳定API一部分的方法用JavaDoc“since”标记,以标识引入它们的Saxon版本。
注意:没有getItemType()方法。这是为了避免必须在NodeInfo的每个实现上实现它。相反,使用静态方法类型。getItemType(项目)。

代码示例

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Convert the value to a string, using the serialization rules.
 * For atomic values this is the same as a cast; for sequence values
 * it gives a space-separated list. For QNames and NOTATIONS, or lists
 * containing them, it fails.
 */
/*@NotNull*/
public String getStringValue() {
  return item == null ? "" : item.getStringValue();
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Get the string value of this sequence. The string value of an item is the result of applying the string()
 * function. The string value of an empty sequence is the zero-length string.
 *
 * @return the string value of the sequence.
 */
public CharSequence getStringValueCS() {
  return item == null ? "" : item.getStringValueCS();
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Get the n'th item in the value, counting from 0
 *
 * @param n the index of the required item, with 0 representing the first item in the sequence
 * @return the n'th item if it exists, or null otherwise
 */
default T itemAt(int n) {
  return n == 0 ? head() : null;
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public AtomicSequence atomize() throws XPathException {
  List<AtomicValue> list = new ArrayList<>(source.size());
  for (Object o: source) {
    Item item = objectToItem(o, config);
    SequenceIterator iter = item.iterate();
    while ((item = iter.next()) != null) {
      AtomicSequence atoms = item.atomize();
      for (AtomicValue atom: atoms) {
        list.add(atom);
      }
    }
  }
  return new AtomicArray(list);
}

代码示例来源:origin: net.sourceforge.saxon/saxon

CharSequence s = item.getStringValueCS();
  if (s.length() > 0) {
    if (!first && !prevText) {
      if (sep == null) {
        sep = separator.evaluateItem(context).getStringValueCS();
  SequenceIterator iter2 = item.getTypedValue();
  while (true) {
    Item item2 = iter2.next();
        sep = separator.evaluateItem(context).getStringValueCS();
    sb.append(item2.getStringValueCS());
if (!first) {
  if (sep == null) {
    sep = separator.evaluateItem(context).getStringValueCS();
sb.append(item.getStringValueCS());

代码示例来源:origin: net.sf.saxon/Saxon-HE

public AtomicValue next() throws XPathException {
  Item nextSource = base.next();
  if (nextSource == null) {
    return null;
  } else {
    return (AtomicValue) nextSource.atomize();
  }
}

代码示例来源:origin: net.sourceforge.saxon/saxon

public SequenceIterator map(Item item) throws XPathException {
    if (item instanceof NodeInfo) {
      return item.getTypedValue();
    } else {
      return SingletonIterator.makeIterator(item);
    }
  }
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

if (baseVal instanceof MemoClosure) {
    Item<?> m = ((MemoClosure) baseVal).itemAt(pos - 1);
    return m == null ? EmptyIterator.emptyIterator() : m.iterate();
  } else {
    Item<?> m = baseVal.materialize().itemAt(pos - 1);
    return m == null ? EmptyIterator.emptyIterator() : m.iterate();
  return i == null ? EmptyIterator.emptyIterator() : i.iterate();
} else {
  SequenceIterator<?> baseIter = getBase().iterate(context);

代码示例来源:origin: org.opengis.cite.saxon/saxon9

CharSequence s = item.getStringValueCS();
  if (s.length() > 0) {
    if (!first && !prevText) {
      if (sep == null) {
        sep = separator.evaluateItem(context).getStringValueCS();
  SequenceIterator iter2 = item.getTypedValue();
  while (true) {
    Item item2 = iter2.next();
        sep = separator.evaluateItem(context).getStringValueCS();
    sb.append(item2.getStringValueCS());
if (!first) {
  if (sep == null) {
    sep = separator.evaluateItem(context).getStringValueCS();
sb.append(item.getStringValueCS());

代码示例来源:origin: net.sf.saxon/Saxon-HE

protected List<ItemToBeSorted> getItemsToBeSorted(Sequence<?> input) throws XPathException {
  final List<ItemToBeSorted> inputList = new ArrayList<>();
  int i = 0;
  SequenceIterator<?> iterator = input.iterate();
  Item item;
  while ((item = iterator.next()) != null) {
    ItemToBeSorted member = new ItemToBeSorted();
    member.value = item;
    member.originalPosition = i++;
    member.sortKey = item.atomize();
    inputList.add(member);
  }
  return inputList;
}

代码示例来源:origin: net.sf.saxon/Saxon-B

public SequenceIterator map(Item item) throws XPathException {
    if (item instanceof NodeInfo) {
      return item.getTypedValue();
    } else {
      return SingletonIterator.makeIterator(item);
    }
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

if (baseVal instanceof MemoClosure) {
    Item<?> m = ((MemoClosure) baseVal).itemAt(pos - 1);
    return m == null ? EmptyIterator.emptyIterator() : m.iterate();
  } else {
    Item<?> m = baseVal.materialize().itemAt(pos - 1);
    return m == null ? EmptyIterator.emptyIterator() : m.iterate();
  return i == null ? EmptyIterator.emptyIterator() : i.iterate();
} else {
  SequenceIterator<?> baseIter = getBase().iterate(context);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Convert the value to a string, using the serialization rules.
 * For atomic values this is the same as a cast; for sequence values
 * it gives a space-separated list. For QNames and NOTATIONS, or lists
 * containing them, it fails.
 */
/*@NotNull*/
public String getStringValue() {
  return item == null ? "" : item.getStringValue();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Get the string value of this sequence. The string value of an item is the result of applying the string()
 * function. The string value of an empty sequence is the zero-length string.
 *
 * @return the string value of the sequence.
 */
public CharSequence getStringValueCS() {
  return item == null ? "" : item.getStringValueCS();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Get the n'th item in the value, counting from 0
 *
 * @param n the index of the required item, with 0 representing the first item in the sequence
 * @return the n'th item if it exists, or null otherwise
 */
default T itemAt(int n) {
  return n == 0 ? head() : null;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

protected List<ItemToBeSorted> getItemsToBeSorted(Sequence<?> input) throws XPathException {
  final List<ItemToBeSorted> inputList = new ArrayList<>();
  int i = 0;
  SequenceIterator<?> iterator = input.iterate();
  Item item;
  while ((item = iterator.next()) != null) {
    ItemToBeSorted member = new ItemToBeSorted();
    member.value = item;
    member.originalPosition = i++;
    member.sortKey = item.atomize();
    inputList.add(member);
  }
  return inputList;
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

public SequenceIterator map(Item item) throws XPathException {
    if (item instanceof NodeInfo) {
      return item.getTypedValue();
    } else {
      return SingletonIterator.makeIterator(item);
    }
  }
}

代码示例来源:origin: net.sourceforge.saxon/saxon

public String getText() {
  if (currentStaxEvent != CHARACTERS && currentStaxEvent != COMMENT) {
    throw new IllegalStateException(""+currentStaxEvent);
  }
  if (previousAtomic) {
    return currentTextNode.toString();
  } else {
    return currentItem.getStringValue();
  }
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
* Evaluate the function in a string context
*/
public CharSequence evaluateAsString(XPathContext c) throws XPathException {
  return evaluateItem(c).getStringValueCS();
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Get the contents of this value in the form of a Java {@link java.util.Iterator},
 * so that the sequence value can be used in a for-each expression
 *
 * @return an Iterator delivering a sequence of items containing this single item only
 */
default Iterator<T> iterator() {
  return new MonoIterator<>(head());
}

相关文章