/** * Determine whether the node has any children. * <p>Note: the result is equivalent to * <code>getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext()</code></p> */ public boolean hasChildNodes() { return node.hasChildNodes(); }
/** * Determine whether the node has any children. * <p>Note: the result is equivalent to * <code>getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext()</code></p> * * @return True if the node has one or more children */ public boolean hasChildNodes() { return original.hasChildNodes(); }
/** * Determine whether the node has any children. <br /> * Note: the result is equivalent to <br /> * getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext() * * @return True if the node has one or more children */ public boolean hasChildNodes() { return original.hasChildNodes(); }
/** * Determine whether the node has any children. <br /> * Note: the result is equivalent to <br /> * getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext() */ public boolean hasChildNodes() { return node.hasChildNodes(); }
/** * Determine whether the node has any children. <br /> * Note: the result is equivalent to <br /> * getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext() */ public boolean hasChildNodes() { return node.hasChildNodes(); }
/** * Determine whether the node has any children. <br /> * Note: the result is equivalent to <br /> * getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext() */ public boolean hasChildNodes() { return node.hasChildNodes(); }
/** * Determine whether the node has any children. * <p>Note: the result is equivalent to * <code>getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext()</code></p> * * @return True if the node has one or more children */ public boolean hasChildNodes() { return original.hasChildNodes(); }
/** * Determine whether the node has any children. <br /> * Note: the result is equivalent to <br /> * getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext() * * @return True if the node has one or more children */ public boolean hasChildNodes() { return original.hasChildNodes(); }
/** * Determine whether the node has any children. * <p>Note: the result is equivalent to * <code>getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext()</code></p> */ public boolean hasChildNodes() { return node.hasChildNodes(); }
/** * Determine whether the node has any children. <br /> * Note: the result is equivalent to <br /> * getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext() * * @return True if the node has one or more children */ public boolean hasChildNodes() { if (node == null) { tryToConstruct(); } return node.hasChildNodes(); }
/** * Determine whether the node has any children. <br /> * Note: the result is equivalent to <br /> * getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext() * * @return True if the node has one or more children */ public boolean hasChildNodes() { if (node == null) { tryToConstruct(); } return node.hasChildNodes(); }
public static boolean isNull(Item i) { if (i instanceof NodeInfo) { NodeInfo ni = (NodeInfo)i; return ni.getNodeKind() == net.sf.saxon.type.Type.ELEMENT && !ni.hasChildNodes() && Boolean.valueOf(ni.getAttributeValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "nil")); //$NON-NLS-1$ /* ideally we'd be able to check for nilled, but that doesn't work without validation if (ni.isNilled()) { tuple.add(null); continue; }*/ } return false; }
public static boolean isNull(Item i) { if (i instanceof NodeInfo) { NodeInfo ni = (NodeInfo)i; return ni.getNodeKind() == net.sf.saxon.type.Type.ELEMENT && !ni.hasChildNodes() && Boolean.valueOf(ni.getAttributeValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "nil")); //$NON-NLS-1$ /* ideally we'd be able to check for nilled, but that doesn't work without validation if (ni.isNilled()) { tuple.add(null); continue; }*/ } return false; }
public static boolean isNull(Item i) { if (i instanceof NodeInfo) { NodeInfo ni = (NodeInfo)i; return ni.getNodeKind() == net.sf.saxon.type.Type.ELEMENT && !ni.hasChildNodes() && Boolean.valueOf(ni.getAttributeValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "nil")); //$NON-NLS-1$ /* ideally we'd be able to check for nilled, but that doesn't work without validation if (ni.isNilled()) { tuple.add(null); continue; }*/ } return false; }
/** * Evaluate the function dynamically * * @param context the dynamic evaluation context * @param arguments the values of the arguments, supplied as Sequences * @return the result of the evaluation, in the form of a Sequence * @throws net.sf.saxon.trans.XPathException * if a dynamic error occurs during the evaluation of the expression */ public BooleanValue call(XPathContext context, Sequence[] arguments) throws XPathException { NodeInfo arg = (NodeInfo) arguments[0].head(); if (arg == null) { return BooleanValue.FALSE; } return BooleanValue.get(arg.hasChildNodes()); } }
/** * Evaluate the function dynamically * * @param context the dynamic evaluation context * @param arguments the values of the arguments, supplied as Sequences * @return the result of the evaluation, in the form of a Sequence * @throws net.sf.saxon.trans.XPathException * if a dynamic error occurs during the evaluation of the expression */ public BooleanValue call(XPathContext context, Sequence[] arguments) throws XPathException { NodeInfo arg = (NodeInfo) arguments[0].head(); if (arg == null) { return BooleanValue.FALSE; } return BooleanValue.get(arg.hasChildNodes()); } }
/** * Test whether an item is empty according to the definition in the spec * for xsl:conditional-content * @param item the item to be tested * @return true if it is "empty", for example, an element without children */ public static boolean isDeemedEmpty(Item item) { if (item instanceof NodeInfo) { int kind = ((NodeInfo) item).getNodeKind(); switch (kind) { case Type.DOCUMENT: case Type.ELEMENT: return !((NodeInfo) item).hasChildNodes(); default: return item.getStringValueCS().length() == 0; } } else if (item instanceof StringValue || item instanceof HexBinaryValue || item instanceof Base64BinaryValue) { return item.getStringValueCS().length() == 0; } else if (item instanceof MapItem) { return ((MapItem)item).isEmpty(); } else { return false; } }
/** * Test whether an item is empty according to the definition in the spec * for xsl:conditional-content * @param item the item to be tested * @return true if it is "empty", for example, an element without children */ public static boolean isDeemedEmpty(Item item) { if (item instanceof NodeInfo) { int kind = ((NodeInfo) item).getNodeKind(); switch (kind) { case Type.DOCUMENT: case Type.ELEMENT: return !((NodeInfo) item).hasChildNodes(); default: return item.getStringValueCS().length() == 0; } } else if (item instanceof StringValue || item instanceof HexBinaryValue || item instanceof Base64BinaryValue) { return item.getStringValueCS().length() == 0; } else if (item instanceof MapItem) { return ((MapItem)item).isEmpty(); } else { return false; } }
public static boolean isSignificant(Item item) { if (item instanceof NodeInfo) { NodeInfo node = (NodeInfo) item; return (node.getNodeKind() != Type.TEXT || !node.getStringValue().isEmpty()) && (node.getNodeKind() != Type.DOCUMENT || node.hasChildNodes()); } else if (item instanceof AtomicValue) { return !item.getStringValue().isEmpty(); } else if (item instanceof ArrayItem) { if (((ArrayItem) item).isEmpty()) { return true; } else { for (Sequence<?> mem : ((ArrayItem) item).members()) { try { SequenceIterator<?> memIter = mem.iterate(); Item it; while ((it = memIter.next()) != null) { if (isSignificant(it)) { return true; } } } catch (XPathException e) { return true; } } return false; } } return true; }
public static boolean isSignificant(Item item) { if (item instanceof NodeInfo) { NodeInfo node = (NodeInfo) item; return (node.getNodeKind() != Type.TEXT || !node.getStringValue().isEmpty()) && (node.getNodeKind() != Type.DOCUMENT || node.hasChildNodes()); } else if (item instanceof AtomicValue) { return !item.getStringValue().isEmpty(); } else if (item instanceof ArrayItem) { if (((ArrayItem) item).isEmpty()) { return true; } else { for (Sequence<?> mem : ((ArrayItem) item).members()) { try { SequenceIterator<?> memIter = mem.iterate(); Item it; while ((it = memIter.next()) != null) { if (isSignificant(it)) { return true; } } } catch (XPathException e) { return true; } } return false; } } return true; }