Package net.sf.saxon.s9api

Examples of net.sf.saxon.s9api.QName


    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


        if (exception instanceof XProcException) {
            XProcException err = (XProcException) exception;
            loc = err.getLocator();
            if (err.getErrorCode() != null) {
                QName n = err.getErrorCode();
                qCode = new StructuredQName(n.getPrefix(),n.getNamespaceURI(),n.getLocalName());
            }
            if (err.getStep() != null) {
                message = message + err.getStep() + ":";
            }
        }
View Full Code Here

   @Override
   protected <T> void addParameter(PipelineInput<T> input) {
      RuntimeValue runtimeParam = getRuntimeValue(input);
     
      if (pipeline.getInputs().contains("parameters")) {
         pipeline.setParameter("parameters", new QName("", input.getName()), runtimeParam);
      } else {
         pipeline.setParameter(new QName("", input.getName()), runtimeParam);
      }
   }
View Full Code Here

      }
   }
  
   @Override
   protected <T> void addOption(PipelineInput<T> input) {
      pipeline.setOption(new QName(input.getName()), getRuntimeValue(input));
   }
View Full Code Here

        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();
                    }
View Full Code Here

    try {
      keyDoc = doc.build(new StreamSource(new StringReader("<Key>"+key.toString()+"</Key>")));
      valDoc = doc.build(new StreamSource(new StringReader(value.toString())));
   
      eval.setExternalVariable(new QName("key"), keyDoc);
      eval.setExternalVariable(new QName("value"), valDoc);

    } catch (SaxonApiException e1) {
      e1.printStackTrace();
    }
   
View Full Code Here

      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())));
       
        eval.setExternalVariable(new QName("key"), keyDoc);
        eval.setExternalVariable(new QName("value"), valDoc);
      } catch (SaxonApiException e) {
        e.printStackTrace();
      }
    }
   
View Full Code Here

      }
      String optionNames = getContext().getParameters().getFirstValue(OPTION_NAMES_PARAM);
      if (optionNames!=null) {
         String [] names = optionNames.split(",");
         for (int i=0; i<names.length; i++) {
            QName name = QName.fromClarkName(names[i].trim());
            if (options==null) {
               options = new ArrayList<QName>();
            }
            options.add(name);
         }
View Full Code Here

            if ("inf".equals(msgType)) {
                step.info(step.getNode(), msgText);
            } else if ("wrn".equals(msgType)) {
                step.warning(step.getNode(), msgText);
            } else {
                step.error(step.getNode(), msgText, new QName(XProcConstants.NS_XPROC_ERROR_EX, "prince"));
            }
        }
View Full Code Here

        if (cns != null && codeNameStr.contains(":")) {
            throw XProcException.dynamicError(34, "You can't specify a namespace if the code name contains a colon");
        }

        QName errorCode = null;
        if (codeNameStr != null) {
            if (codeNameStr.contains(":")) {
                errorCode = new QName(codeNameStr, codeNameValue.getNode());
            } else {
                errorCode = new QName(cpfx == null ? "" : cpfx, cns, codeNameStr);
            }
        }

        while (report.moreDocuments()) {
            XdmNode doc = report.read();
View Full Code Here

TOP

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

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.