Package net.sf.saxon.s9api

Examples of net.sf.saxon.s9api.XdmAtomicValue


     
      try {
        keyDoc = doc.build(new StreamSource(new StringReader(key.toString())));
               
        eval.setExternalVariable(new QName("key"), keyDoc);
        eval.setExternalVariable(new QName("uri"), new XdmAtomicValue("value.txt"));
      } catch (SaxonApiException e) {
        e.printStackTrace();
      }
   
      //System.out.print(System.currentTimeMillis()-time_stamp+", ");
View Full Code Here


        selector.setVariable(doca,sdoc);
        selector.setVariable(docb,adoc);

        Iterator<XdmItem> values = selector.iterator();
        XdmAtomicValue item = (XdmAtomicValue) values.next();
        boolean same = item.getBooleanValue();
        if (!same && getOption(_fail_if_not_equal,false)) {
            throw XProcException.stepError(19);
        }

        TreeWriter treeWriter = new TreeWriter(runtime);
View Full Code Here

            selector.setVariable(vara,a);
            selector.setVariable(varb,b);

            Iterator<XdmItem> values = selector.iterator();
            XdmAtomicValue item = (XdmAtomicValue) values.next();
            boolean same = item.getBooleanValue();
            return same;
        } catch (SaxonApiException sae) {
            return false;
        }
    }
View Full Code Here

            for (QName name : params.keySet()) {
                RuntimeValue v = params.get(name);
                if (runtime.getAllowGeneralExpressions()) {
                    transformer.setParameter(name, v.getValue());
                } else {
                    transformer.setParameter(name, new XdmAtomicValue(v.getString()));
                }
            }

            if (document != null) {
                transformer.setInitialContextNode(document);
View Full Code Here

                treeWriter.addAttribute(_namespace, "");
            }

            if (runtime.getAllowGeneralExpressions()) {
                XdmValue xdmvalue = parameters.get(param).getValue();
                XdmAtomicValue atom = null;
                if (xdmvalue.size() == 1) {
                    XdmItem item = xdmvalue.itemAt(0);
                    if (item.isAtomicValue()) {
                        atom = (XdmAtomicValue) item;
                    }
View Full Code Here

                        if ("{".equals(peek)) {
                            ptext += "{";
                            pos++;
                        } else {
                            if (!"".equals(ptext)) {
                                items.add(new XdmAtomicValue(ptext));
                                ptext = "";
                            }
                            state = XPATHMODE;
                        }
                    } else if ("}".equals(ch)) {
                        if ("}".equals(peek)) {
                            ptext += "}";
                            pos++;
                        } else {
                            throw XProcException.stepError(67);
                        }
                    } else {
                        ptext += ch;
                    }
                    break;
                case XPATHMODE:
                    if ("{".equals(ch)) {
                        throw XProcException.stepError(67);
                    } else if ("'".equals(ch)) {
                        ptext += "'";
                        state = SQUOTEMODE;
                    } else if ("\"".equals(ch)) {
                        ptext += "\"";
                        state = DQUOTEMODE;
                    } else if ("}".equals(ch)) {
                        items.addAll(evaluateXPath(context, nsbindings, ptext, params));
                        ptext = "";
                        state = START;
                    } else {
                        ptext += ch;
                    }
                    break;
                case SQUOTEMODE:
                    if ("'".equals(ch)) {
                        ptext += "'";
                        state = XPATHMODE;
                    } else {
                        ptext += ch;
                    }
                    break;
                case DQUOTEMODE:
                    if (("\"").equals(ch)) {
                        ptext += "\"";
                        state = XPATHMODE;
                    } else {
                        ptext += ch;
                    }
                    break;
            }

            pos++;
        }

        if (state != START) {
            throw XProcException.stepError(67);
        }

        if (!"".equals(ptext)) {
            items.add(new XdmAtomicValue(ptext));
        }

        return items;
    }
View Full Code Here

                    } catch (SaxonApiException sae) {
                        throw new XProcException(sae);
                    }
                } else {
                    stringValue += child.getStringValue();
                    items.add(new XdmAtomicValue(child.getStringValue()));
                }
            }
        }

        RuntimeValue value = new RuntimeValue(stringValue, items, pnode, new Hashtable<String,String> ());
View Full Code Here

                    XPathExecutable xexec = xcomp.compile(nsbinding.getXPath());
                    XPathSelector selector = xexec.load();

                    for (QName varname : globals.keySet()) {
                        XdmAtomicValue avalue = new XdmAtomicValue(globals.get(varname).getString());
                        selector.setVariable(varname,avalue);
                    }

                    if (doc != null) {
                        selector.setContextItem(doc);
View Full Code Here

    public XdmAtomicValue getUntypedAtomic(XProcRuntime runtime) {
        try {
            ItemTypeFactory itf = new ItemTypeFactory(runtime.getProcessor());
            ItemType untypedAtomic = itf.getAtomicType(new QName(NamespaceConstant.SCHEMA, "xs:untypedAtomic"));
            XdmAtomicValue val = new XdmAtomicValue(value, untypedAtomic);
            return val;
        } catch (SaxonApiException sae) {
            throw new XProcException(sae);
        }
    }
View Full Code Here

    }

    public XdmValue getValue() {
        if (generalValue == null) {
            // Turn the string value into an XdmValue
            return new XdmAtomicValue(value);
        }
        if (generalValue.size() == 1) {
            return generalValue.get(0);
        } else {
            return new XdmValue(generalValue);
View Full Code Here

TOP

Related Classes of net.sf.saxon.s9api.XdmAtomicValue

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.