Note that there are some explanatory texts on larger screens.

plurals
  1. POExtract contents from xml which is in .jsp format
    primarykey
    data
    text
    <p>monitorUrl-- <code>http://host03:8810/solr/admin/stats.jsp</code> which contains this xml file.</p> <pre><code> &lt;?xml-stylesheet type="text/xsl" href="stats.xsl"?&gt; &lt;solr&gt; &lt;core&gt;&lt;/core&gt; &lt;schema&gt;test&lt;/schema&gt; &lt;host&gt;domain.host.com&lt;/host&gt; &lt;now&gt;Fri Nov 11 11:14:01 PST 2011&lt;/now&gt; &lt;start&gt;Thu Sep 22 18:33:06 PDT 2011&lt;/start&gt; &lt;solr-info&gt; &lt;CORE&gt; &lt;entry&gt; &lt;name&gt; core &lt;/name&gt; &lt;class&gt; &lt;/class&gt; &lt;version&gt; 1.0 &lt;/version&gt; &lt;description&gt; SolrCore &lt;/description&gt; &lt;stats&gt; &lt;stat name="coreName" &gt; &lt;/stat&gt; &lt;stat name="startTime" &gt; Thu Sep 22 18:33:06 PDT 2011 &lt;/stat&gt; &lt;stat name="refCount" &gt; 2 &lt;/stat&gt; &lt;stat name="aliases" &gt; [] &lt;/stat&gt; &lt;/stats&gt; &lt;/entry&gt; &lt;entry&gt; &lt;name&gt; searcher &lt;/name&gt; &lt;class&gt; org.apache.solr.search.SolrIndexSearcher &lt;/class&gt; &lt;version&gt; 1.0 &lt;/version&gt; &lt;description&gt; index searcher &lt;/description&gt; &lt;stats&gt; &lt;stat name="searcherName" &gt; Searcher@5b637a2d main &lt;/stat&gt; &lt;stat name="caching" &gt; true &lt;/stat&gt; &lt;stat name="numDocs" &gt; 111959 &lt;/stat&gt; &lt;stat name="maxDoc" &gt; 112310 &lt;/stat&gt; &lt;stat name="reader" &gt; DirectoryReader(segments_h0 _1zn:Cv101710/351 _1zl:Cv8026 _1zp:Cv2574) &lt;/stat&gt; &lt;stat name="readerDir" &gt; org.apache.lucene.store.NIOFSDirectory@/es_idx_prd/projects/index/solr-agile/document/data/index lockFactory=org.apache.lucene.store.NativeFSLockFactory@2c164804 &lt;/stat&gt; &lt;stat name="indexVersion" &gt; 1313979005459 &lt;/stat&gt; &lt;stat name="openedAt" &gt; Fri Nov 11 11:00:04 PST 2011 &lt;/stat&gt; &lt;stat name="registeredAt" &gt; Fri Nov 11 11:00:04 PST 2011 &lt;/stat&gt; &lt;stat name="warmupTime" &gt; 0 &lt;/stat&gt; &lt;/stats&gt; &lt;/entry&gt; &lt;/solr-info&gt; &lt;/solr&gt; </code></pre> <p>And I want to extract the <strong>numDocs</strong> value from the above xml means 111959-- 111959 And the below fetchlog method is just reading each line of that jsp file. So how can I retrieve numDocs value by fetching it directly by reading it line by line.</p> <p>The monitorUrl is a .jsp file which is in xml format.</p> <pre><code>public void fetchlog() { InputStream is = null; FileOutputStream fos = null; try { is = HttpUtil.getFile(monitorUrl); BufferedReader in = new BufferedReader (new InputStreamReader (is)); String line; while ((line = in.readLine()) != null) { if(line.contains("numDocs")) { //Extract numDocs value- How to do this? } System.out.println(line); } fos = new FileOutputStream(buildTargetPath()); IOUtils.copy(is, fos); } catch (FileNotFoundException e) { log.error("File Exception in fetching monitor logs :" + e); } catch (IOException e) { log.error("Exception in fetching monitor logs :" + e); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload