Examples of Document


Examples of com.digitalpebble.classification.Document

            boolean create, String vector_location) throws IOException {
        File vectorFile = new File(vector_location);
        PrintWriter out = null;
        out = new PrintWriter(new FileWriter(vectorFile));
        for (int i = 0; i < documents.length; i++) {
            Document doc = documents[i];
            int label = doc.getLabel();
            // get a vector from the document
            // need a metric (e.g. relative frequency / binary)
            // and a lexicon
            // the vector is represented as a string directly
            Vector vector = doc.getFeatureVector(lexicon);
            out.print(label + " " + Utils.getVectorString(vector) + "\n");
        }
        out.close();
        return vectorFile;
    }
View Full Code Here

Examples of com.dotcms.repackage.org.apache.lucene.document.Document

        luceneHits = new ArrayList<LuceneHit>(upperIndex - offset);
       
        for (int i = offset; i < upperIndex; i++) {
          int docId = hitsList[i].doc;
         Document d = searcher.doc(docId);
         LuceneHit hit = new LuceneHit (docId, d);
            luceneHits.add(hit);
        }
       
        if(UtilMethods.isSet(sortBy) && sortBy.trim().equalsIgnoreCase("random")){
View Full Code Here

Examples of com.dotcms.repackage.org.dom4j.Document

    };*/

    SAXReader reader = new SAXReader();
    //reader.setEntityResolver(resolver);

    Document doc = reader.read(new StringReader(xml));

    Element root = doc.getRootElement();

    Set userAttributes = new HashSet();

    Iterator itr1 = root.elements("user-attribute").iterator();

View Full Code Here

Examples of com.dotcms.repackage.org.jdom.Document

  public Document getResponseAsDocument() throws IOException {
    InputStream in = getResponseBodyAsStream();
//        IOUtils.copy( in, out );
//        String xml = out.toString();
    try {
      Document document = RespUtils.getJDomDocument(in);
      return document;
    } catch (JDOMException ex) {
      throw new RuntimeException(ex);
    }
  }
View Full Code Here

Examples of com.dotcms.repackage.org.jsoup.nodes.Document

   *
   * @param _body - the body became by jsp TemplateForm
   * @return endBody with all HTML tags
   */
  public static StringBuffer getPreviewBody(String _body, List<PreviewFileAsset> savedFiles, String themePath, boolean header, boolean footer){
    Document templateBody = Jsoup.parse(_body);

    // adding default css for YUI Grid
    if(UtilMethods.isSet(themePath)) {
      addHeadCode(templateBody, "#dotParse('"+themePath+Template.THEME_HTML_HEAD+"')");
    }
    addHeadCode(templateBody, "<link rel=\"stylesheet\" type=\"text/css\" href=\""+PATH_CSS_YUI+"\">");

    if(UtilMethods.isSet(themePath) && header) {
      addHeaderCode(templateBody, "#dotParse('"+themePath+Template.THEME_HEADER+"')");
    }

    if(UtilMethods.isSet(themePath) && footer) {
      addFooterCode(templateBody, "#dotParse('"+themePath+Template.THEME_FOOTER+"')");
    }

    // remove the div for file
    removeFileIconDiv(templateBody);

    // remove the "add container" links
    removeAddContainer(templateBody);

    // remove the mock containers
    removeMockContainers(templateBody);

    // remove the <h1> contents
    removeYuiGridContent(templateBody);

    // add all the js and css files
//    addPreviewJsCssFiles(templateBody,savedFiles);
    addJsCssFiles(templateBody);

    // gets the parseContainer
    getParseContainer(templateBody);


    return new StringBuffer(templateBody.toString());

  }
View Full Code Here

Examples of com.dotcms.repackage.org.w3c.dom.Document

      ByteArrayOutputStream os = new ByteArrayOutputStream();
      tidy.parse(is, os);
      s = os.toString();

      is = new ByteArrayInputStream(s.getBytes());
      Document doc = builder.parse(is);

      NodeList nl = doc.getElementsByTagName("img");
      for (int i = 0; i < nl.getLength(); i++) {
        Node n = nl.item(i);
        Node srcNode = n.getAttributes().getNamedItem("src");
        String srcText = srcNode.getNodeValue();
        String newText = getRealPath(srcText, host, url);
View Full Code Here

Examples of com.eibus.xml.nom.Document

      }
  
      private static void startBPM(String bpmName, String inputMessage)
    {     
        int message = 0;
        Document document = BSF.getXMLDocument();
     
        SOAPRequestObject soapRequestObject = new SOAPRequestObject("http://schemas.cordys.com/bpm/execution/1.0",
        "ExecuteProcess",null,null);
    soapRequestObject.addParameterAsXml(document.createTextElement("type", "definition"));
    soapRequestObject.addParameterAsXml(document.createTextElement("receiver", bpmName));
    try
    {
      message = BSF.getXMLDocument().parseString(inputMessage);
      soapRequestObject.addParameterAsXml(message);   
      soapRequestObject.addParameterAsXml(document.createTextElement("source", "Run from Process Designer"));
        soapRequestObject.execute();       
    }
    catch (Exception e){}       
  }
View Full Code Here

Examples of com.facebook.swift.parser.model.Document

        final String thriftNamespace = extractThriftNamespace(thriftUri);

        Preconditions.checkState(!isBlank(thriftNamespace), "Thrift URI %s can not be translated to a namespace", thriftUri);
        final SwiftDocumentContext context = new SwiftDocumentContext(thriftUri, thriftNamespace, swiftGeneratorConfig, typeRegistry, typedefRegistry);

        final Document document = context.getDocument();
        final Header header = document.getHeader();

        String effectiveJavaNamespace = "java.swift";
        if (swiftGeneratorConfig.usePlainJavaNamespace()) {
            effectiveJavaNamespace = "java";
        }

        // Override takes precedence
        String javaPackage = swiftGeneratorConfig.getOverridePackage();
        // Otherwise fallback on package specified in .thrift file
        if (javaPackage == null) {
            javaPackage = header.getNamespace(effectiveJavaNamespace);
        }
        // Or the default if we don't have an override package or a package in the .thrift file
        if (javaPackage == null) {
            javaPackage = swiftGeneratorConfig.getDefaultPackage();
        }

        // If none of the above options get us a package to use, fail
        Preconditions.checkState(javaPackage != null, "thrift uri %s does not declare a '%s' namespace!", thriftUri, effectiveJavaNamespace);

        // Make a note that this document is a parent of all the documents included, directly or recursively
        parentDocuments.push(thriftUri);

        try {
            for (final String include : header.getIncludes()) {
                final URI includeUri = swiftGeneratorConfig.getInputBase().resolve(include);
                LOG.debug("Found {} included from {}.", includeUri, thriftUri);
                parseDocument(includeUri,
                              // If the includes should also generate code, pass the list of
                              // contexts down to the include parser, otherwise pass a null in
                              swiftGeneratorConfig.isGenerateIncludedCode() ? contexts : null,
                              typeRegistry,
                              typedefRegistry);
            }
        }
        finally {
            // Done parsing this document's includes, remove it from the parent chain
            parentDocuments.pop();
        }

        // Make a note that we've already parsed this document
        parsedDocuments.add(thriftUri);

        document.visit(new TypeVisitor(javaPackage, context));

        if (contexts != null && contexts.put(context.getNamespace(), context) != null) {
            LOG.info("Thrift Namespace {} included multiple times!", context.getNamespace());
        }
    }
View Full Code Here

Examples of com.filenet.api.core.Document

      if (type.equals(ClassNames.VERSION_SERIES)) {
        VersionSeries vs = (VersionSeries) obj;
        vs.refresh();
        return new FnVersionSeries(vs);
      } else if (type.equals(ClassNames.DOCUMENT)) {
        Document doc = (Document) obj;
        doc.refresh();
        return new FnDocument(doc);
      } else {
        obj.refresh();
        return new FnBaseObject(obj);
      }
View Full Code Here

Examples of com.flaptor.indextank.index.Document

            throw new IllegalArgumentException("snippet_type has to be either 'html' or 'lines'");
        }
       
        if (fetchFields.length + snippetFields.length > 0) {
          for (SearchResult result : results.getResults()) {
            Document data = storage.getDocument(result.getDocId());


            // fetch fields
            for (String field : fetchFields) {
                    // handle '*', as a fetch all
                    if ("*".equals(field.trim())){
                        // assume we get the actual fields, not a copy.
                        result.getFields().putAll(data.asMap());
                        break;
                    }
                    String text = data.getField(field);
                    if (null != text) {
                        result.setField(field, text);
                    }
        }

            // snippet fields
            for (String field : snippetFields) {
                    String text = data.getField(field);
                    if (null != text) {
                        result.setField("snippet_" + field, sn.snippet(positiveTerms, field, text));
                    }
            }
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.