Package org.pdf4j.saxon.om

Examples of org.pdf4j.saxon.om.Item


    public static double min (SequenceIterator nsv) throws XPathException {
        try {
            double min = Double.POSITIVE_INFINITY;
            while (true) {
                Item it = nsv.next();
                if (it == null) break;
                double x = Value.stringToNumber(it.getStringValueCS());
                if (Double.isNaN(x)) return x;
                if (x<min) min = x;
            }
            return min;
        } catch (NumberFormatException e) {
View Full Code Here


    public static Value highest (SequenceIterator nsv) throws XPathException {
        try {
            double max = Double.NEGATIVE_INFINITY;
            ArrayList highest = new ArrayList();
            while (true) {
                Item it = nsv.next();
                if (it == null) break;
                double x = Value.stringToNumber(it.getStringValueCS());
                if (Double.isNaN(x)) return EmptySequence.getInstance();
                if (x==max) {
                    highest.add(it);
                } else if (x>max) {
                    max = x;
View Full Code Here

    public static Value lowest (SequenceIterator nsv) throws XPathException {
        try {
            double min = Double.POSITIVE_INFINITY;
            ArrayList lowest = new ArrayList();
            while (true) {
               Item it = nsv.next();
               if (it == null) break;
               double x = Value.stringToNumber(it.getStringValueCS());
               if (Double.isNaN(x)) return EmptySequence.getInstance();
               if (x==min) {
                   lowest.add(it);
               } else if (x<min) {
                   min = x;
View Full Code Here

            this.inserting = (insertPosition==1);
        }


        public Item next() throws XPathException {
            Item nextItem;
            if (inserting) {
                nextItem = insert.next();
                if (nextItem == null) {
                    inserting = false;
                    nextItem = base.next();
View Full Code Here

        this.action = action;
    }


    public PullEvent next() throws XPathException {
        Item nextSource = base.next();
        return (nextSource == null ? null : action.map(nextSource));
    }
View Full Code Here

     */

    public Expression preEvaluate(ExpressionVisitor visitor) throws XPathException {
        try {
            XPathContext early = visitor.getStaticContext().makeEarlyEvaluationContext();
            final Item item1 = argument[1].evaluateItem(early);
            final String lex = item1.getStringValue();
            final Item item0 = argument[0].evaluateItem(early);
            String uri;
            if (item0 == null) {
                uri = "";
            } else {
                uri = item0.getStringValue();
            }
            final NameChecker checker = visitor.getConfiguration().getNameChecker();
            final String[] parts = checker.getQNameParts(lex);
            // The QNameValue constructor does not check the prefix
            if (parts[0].length() != 0 && !checker.isValidNCName(parts[0])) {
View Full Code Here

        // Check for duplicate parameter names

        AxisIterator iter = iterateAxis(Axis.PRECEDING_SIBLING);
        while (true) {
            Item prev = iter.next();
            if (prev == null) {
                break;
            }
            if (prev instanceof XSLWithParam) {
                if (this.getVariableQName().equals(((XSLWithParam)prev).getVariableQName())) {
View Full Code Here

        NodeInfo doc = xpe.getConfiguration().buildDocument(new StreamSource(new File(args[0])));
        XPathDynamicContext context = exp.createDynamicContext(doc);
        //context.setVariable(in, new StringValue(args[1]));
        SequenceIterator results = exp.iterate(context);
        while (true) {
            Item item = results.next();
            if (item == null) break;
            System.err.println(item);
        }
//        if (args.length != 2) {
//            System.err.println("format: java XPathEvaluator source.xml \"expression\"");
View Full Code Here

    /**
    * Evaluate the function
    */

    public Item evaluateItem(XPathContext c) throws XPathException {
        Item arg = argument[0].evaluateItem(c);
        if (arg==null) {
            return StringValue.EMPTY_STRING;
        } else {
            return StringValue.makeStringValue(arg.getStringValueCS());
        }
    }
View Full Code Here

    public Item evaluateItem(XPathContext c) throws XPathException {
        NodeInfo target;
        if (argument.length > 1) {
            target = (NodeInfo)argument[1].evaluateItem(c);
        } else {
            Item current = c.getContextItem();
            if (current==null) {
                XPathException err = new XPathException("The context item is undefined");
                err.setErrorCode("XPDY0002");
                err.setXPathContext(c);
                throw err;
            }
            if (!(current instanceof NodeInfo)) {
                XPathException err = new XPathException("The context item is not a node");
                err.setErrorCode("XPTY0004");
                err.setXPathContext(c);
                throw err;
            }
            target = (NodeInfo)current;
        }
        final Item arg0Val = argument[0].evaluateItem(c);
        final String testLang = (arg0Val==null ? "" : arg0Val.getStringValue());
        boolean b = isLang(testLang, target);
        return BooleanValue.get(b);
    }
View Full Code Here

TOP

Related Classes of org.pdf4j.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.