You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2011/04/13 20:16:05 UTC

[jira] [Issue Comment Edited] (SOLR-2436) move uimaConfig to under the uima's update processor in solrconfig.xml

    [ https://issues.apache.org/jira/browse/SOLR-2436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019470#comment-13019470 ] 

Uwe Schindler edited comment on SOLR-2436 at 4/13/11 6:14 PM:
--------------------------------------------------------------

Here is the new way to load XML from ResourceLoaders in Solr (taken from Config). This code also intercepts errors and warnings and logs them correctly (parsers tend to write them to System.err):

{code:java}
public static final Logger log = LoggerFactory.getLogger(Config.class);
private static final XMLErrorLogger xmllog = new XMLErrorLogger(log);

...

final InputSource is = new InputSource(loader.openConfig(name));
is.setSystemId(SystemIdResolver.createSystemIdFromResourceName(name));

final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// only enable xinclude, if a SystemId is available
if (is.getSystemId() != null) {
	try {
		dbf.setXIncludeAware(true);
		dbf.setNamespaceAware(true);
	} catch(UnsupportedOperationException e) {
		log.warn(name + " XML parser doesn't support XInclude option");
	}
}

final DocumentBuilder db = dbf.newDocumentBuilder();
db.setEntityResolver(new SystemIdResolver(loader));
db.setErrorHandler(xmllog);
try {
	doc = db.parse(is);
} finally {
	// some XML parsers are broken and don't close the byte stream (but they should according to spec)
	IOUtils.closeQuietly(is.getByteStream());
}
{code}

      was (Author: thetaphi):
    Here is the new way to load XML from ResourceLoaders in Solr (taken from Config). This code also intercepts errors and warnings and logs them correctly (parsers tend to write them to System.err):

{code:java}
is = new InputSource(loader.openConfig(name));
is.setSystemId(SystemIdResolver.createSystemIdFromResourceName(name));


// only enable xinclude, if a SystemId is available
if (is.getSystemId() != null) {
	try {
		dbf.setXIncludeAware(true);
		dbf.setNamespaceAware(true);
	} catch(UnsupportedOperationException e) {
		log.warn(name + " XML parser doesn't support XInclude option");
	}
}

final DocumentBuilder db = dbf.newDocumentBuilder();
db.setEntityResolver(new SystemIdResolver(loader));
db.setErrorHandler(xmllog);
try {
	doc = db.parse(is);
} finally {
	// some XML parsers are broken and don't close the byte stream (but they should according to spec)
	IOUtils.closeQuietly(is.getByteStream());
}
{code}
  
> move uimaConfig to under the uima's update processor in solrconfig.xml
> ----------------------------------------------------------------------
>
>                 Key: SOLR-2436
>                 URL: https://issues.apache.org/jira/browse/SOLR-2436
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 3.1
>            Reporter: Koji Sekiguchi
>            Priority: Minor
>         Attachments: SOLR-2436-3.patch, SOLR-2436.patch, SOLR-2436.patch, SOLR-2436.patch, SOLR-2436_2.patch
>
>
> Solr contrib UIMA has its config just beneath <config>. I think it should move to uima's update processor tag.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org