/** * 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(); }
/** * 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(); }
public String getText() { if (currentStaxEvent != CHARACTERS && currentStaxEvent != COMMENT) { throw new IllegalStateException(""+currentStaxEvent); } if (previousAtomic) { return currentTextNode.toString(); } else { return currentItem.getStringValue(); } }
public String convert(Sequence<?> value, Class<?> targetClass, XPathContext context) throws XPathException { Item first = value.head(); return first == null ? null : first.getStringValue(); }
@Override public StringValue evaluate(Item arg, XPathContext context) { return StringValue.makeStringValue(arg.getStringValue().toLowerCase()); }
private String toSpaceSeparatedString(Sequence<?> seqVal) throws XPathException { SequenceIterator<?> iterator = seqVal.iterate(); Item item; StringBuilder stringVal = new StringBuilder(); while ((item = iterator.next()) != null) { stringVal.append(" ").append(item.getStringValue()); } return stringVal.toString(); }
private static String[] sequenceToArray(Sequence seq) throws XPathException { List<String> list = new ArrayList<String>(); SequenceIterator iterator = seq.iterate(); for (Item item = iterator.next(); item != null; item = iterator.next()) list.add(item.getStringValue()); return list.toArray(new String[list.size()]); }
public Object convert(Sequence<?> value, Class<?> targetClass, XPathContext context) throws XPathException { try { return constructor.newInstance(value.head().getStringValue()); } catch (InstantiationException | IllegalAccessException e) { throw new XPathException(e); } catch (InvocationTargetException e) { throw new XPathException("Cannot convert untypedAtomic to " + targetClass.getName() + ": " + e.getMessage(), "FORG0001"); } } };
public Object convert(Sequence<?> value, Class<?> targetClass, XPathContext context) throws XPathException { try { return constructor.newInstance(value.head().getStringValue()); } catch (InstantiationException | IllegalAccessException e) { throw new XPathException(e); } catch (InvocationTargetException e) { throw new XPathException("Cannot convert untypedAtomic to " + targetClass.getName() + ": " + e.getMessage(), "FORG0001"); } } };
public Item map(Item item) throws XPathException { String b = baseURI; if (b==null) { if (item instanceof NodeInfo) { b = ((NodeInfo)item).getBaseURI(); } else { b = stylesheetURI; } } return makeDoc(item.getStringValue(), b, context, locator); } }
public Item map(Item item) throws XPathException { String b = baseURI; if (b==null) { if (item instanceof NodeInfo) { b = ((NodeInfo)item).getBaseURI(); } else { b = stylesheetURI; } } return makeDoc(item.getStringValue(), b, context, locator); } }
public Item map(Item item) throws XPathException { String b = baseURI; if (b==null) { if (item instanceof NodeInfo) { b = ((NodeInfo)item).getBaseURI(); } else { b = stylesheetURI; } } return makeDoc(item.getStringValue(), b, context, locator); } }
private static List<String> sequenceToList(Sequence seq) throws XPathException { List<String> list = new ArrayList<String>(); SequenceIterator iterator = seq.iterate(); for (Item item = iterator.next(); item != null; item = iterator.next()) list.add(item.getStringValue()); return list; }
private static List<String> sequenceToList(Sequence seq) throws XPathException { List<String> list = new ArrayList<String>(); SequenceIterator iterator = seq.iterate(); for (Item item = iterator.next(); item != null; item = iterator.next()) list.add(item.getStringValue()); return list; }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public SequenceIterator call(SequenceIterator[] arguments, XPathContext context) throws XPathException { String id = arguments[0].next().getStringValue(); ScopedDatasetManager.deleteScopedDataset(id); return EmptyIterator.getInstance(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public SequenceIterator call(SequenceIterator[] arguments, XPathContext context) throws XPathException { String id = arguments[0].next().getStringValue(); ScopedDatasetManager.scopedDatasetPopResults(id); return EmptyIterator.getInstance(); }
public void outputWarning(Item item, XPathContext context) { String id = item instanceof NodeInfo ? "the node " + Navigator.getPath((NodeInfo) item) : "the atomic value " + item.getStringValue(); XPathException warning = new XPathException("No user-defined template rule matches " + id, "XTDE0555"); context.getController().getErrorListener().warning(warning); }
public void outputWarning(Item item, XPathContext context) { String id = item instanceof NodeInfo ? "the node " + Navigator.getPath((NodeInfo) item) : "the atomic value " + item.getStringValue(); XPathException warning = new XPathException("No user-defined template rule matches " + id, "XTDE0555"); context.getController().getErrorListener().warning(warning); }
private String toMethodTypeString(Sequence<?> seqVal) throws XPathException { String stringVal; if (seqVal.head() instanceof QNameValue) { QNameValue qNameValue = (QNameValue) seqVal.head(); stringVal = '{' + qNameValue.getComponent(AccessorFn.Component.NAMESPACE).toString() + '}' + qNameValue.getComponent(AccessorFn.Component.LOCALNAME); } else { stringVal = seqVal.head().getStringValue(); } return stringVal; }
private String toMethodTypeString(Sequence<?> seqVal) throws XPathException { String stringVal; if (seqVal.head() instanceof QNameValue) { QNameValue qNameValue = (QNameValue) seqVal.head(); stringVal = '{' + qNameValue.getComponent(AccessorFn.Component.NAMESPACE).toString() + '}' + qNameValue.getComponent(AccessorFn.Component.LOCALNAME); } else { stringVal = seqVal.head().getStringValue(); } return stringVal; }