Package net.sf.saxon.s9api

Examples of net.sf.saxon.s9api.XdmNode


  private boolean isImageForPdfOnly(XdmNode imageDataNode) {
    return parentRoleEquals(imageDataNode, "fo") || parentRoleEquals(imageDataNode, "pdf");
  }
 
  private boolean parentRoleEquals(XdmNode node, String role) {
    XdmNode parent = node.getParent();
    String parentRole = (parent==null ? null : parent.getAttributeValue(new QName("role")));
    if (parentRole != null &&
      parentRole.equalsIgnoreCase(role)) {
      return true;
    }
    return false;
View Full Code Here


    public void run() throws SaxonApiException {
        super.run();

        List<XPathReplacement> replacements = readReplacementsFile(getOption(_replacements_file, "replacements.config"));
        XdmNode updatedDoc = makeReplacements (source.read(), replacements);
       
        result.write(updatedDoc);
    }
View Full Code Here

  }

  public void run() throws SaxonApiException {
    super.run();

    XdmNode updatedDoc = processInlineImages (source.read());
    result.write(updatedDoc);
  }
View Full Code Here

      pipeline.setOption(new QName(input.getName()), getRuntimeValue(input));
   }
  
   @Override
   protected <T> void addPort(PipelineInput<T> input) {
      XdmNode node;
      T source = input.getSource();
     
      if (source instanceof InputSource) {
         node = runtime.parse((InputSource)source);
      } else if (input.getSource() instanceof XdmNode) {
View Full Code Here

    }
    this.trans = exp.load();
  }

  public String run(Reader input, OutputStream output) {
    XdmNode source = null;
                String aftermath = null;
    try {
      source = builder.build(new SAXSource(new InputSource(input)));
    //} catch (SaxonApiException e) {
      // TODO Auto-generated catch block
View Full Code Here

        InputStream instream = getClass().getResourceAsStream("/etc/error-list.xml"); //TODO - Get proper path to this
        if (instream != null) {
            try {
                SAXSource source = new SAXSource(new InputSource(instream));
                DocumentBuilder builder = runtime.getProcessor().newDocumentBuilder();
                XdmNode doc = builder.build(source);
                XdmSequenceIterator iter = doc.axisIterator(Axis.DESCENDANT, new QName("error"));
                while (iter.hasNext()) {
                    XdmNode error = (XdmNode) iter.next();
                    if (code.getLocalName().equals(error.getAttributeValue(_code))) {
                        return error.getStringValue();
                    }
                }
            } catch (SaxonApiException sae) {
                // nop;
            }
View Full Code Here

   
    XQueryEvaluator eval = exec.load();
   
    //System.out.print(System.currentTimeMillis()-time_stamp+", ");
   
    XdmNode keyDoc;
    XdmNode valDoc;

    try {
      keyDoc = doc.build(new StreamSource(new StringReader("<Key>"+key.toString()+"</Key>")));
      valDoc = doc.build(new StreamSource(new StringReader(value.toString())));
   
View Full Code Here

        e1.printStackTrace();
      }
     
      //System.out.print(System.currentTimeMillis()-time_stamp+", ");
     
      XdmNode keyDoc;
     
      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+", ");
     
    //if streaming is not enabled (no need to write input to file)
    } else {
     
      StringBuffer values = new StringBuffer();
      values.append("<root>");
      for (Text inputValue : inputValues) {
        values.append(inputValue.toString().trim().replaceAll("\n", "").replaceAll("\t", ""));
        //counter++;
      }
      values.append("</root>");
     
      //System.out.println("Length of input: " + counter);
     
      //System.out.println("###VALUES###:\n" + values);
     
      //System.out.print(System.currentTimeMillis()-time_stamp+", ");
     
      XdmNode keyDoc;
      XdmNode valDoc;
     
      try {
        keyDoc = doc.build(new StreamSource(new StringReader(key.toString())));
        valDoc = doc.build(new StreamSource(new StringReader(values.toString())));
       
View Full Code Here

    Processor proc = new Processor(false);
    XsltCompiler comp = proc.newXsltCompiler();
    XsltExecutable exp;
    try {
      exp = comp.compile(new StreamSource(styleSheetFile));
      XdmNode source = proc.newDocumentBuilder().build(
          new StreamSource(xmlFile));
      Serializer out = proc.newSerializer(outputStream);
      out.setOutputProperty(Serializer.Property.METHOD, "xml");
      out.setOutputProperty(Serializer.Property.INDENT, "yes");
      XsltTransformer trans = exp.load();
View Full Code Here

    }

    public void run() throws SaxonApiException {
        super.run();

        XdmNode sdoc = source.read();
        XdmNode adoc = alternate.read();

        XPathCompiler xcomp = runtime.getProcessor().newXPathCompiler();
        xcomp.declareVariable(doca);
        xcomp.declareVariable(docb);
View Full Code Here

TOP

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

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.