|
From: <to...@us...> - 2008-01-18 22:19:38
|
Revision: 104
http://xoperator.svn.sourceforge.net/xoperator/?rev=104&view=rev
Author: tomatop
Date: 2008-01-18 14:19:41 -0800 (Fri, 18 Jan 2008)
Log Message:
-----------
stripping of html data
Modified Paths:
--------------
trunk/xOperator/src/net/sf/xoperator/store/RDFStoreHTTPAdaptor.java
Modified: trunk/xOperator/src/net/sf/xoperator/store/RDFStoreHTTPAdaptor.java
===================================================================
--- trunk/xOperator/src/net/sf/xoperator/store/RDFStoreHTTPAdaptor.java 2008-01-17 21:03:32 UTC (rev 103)
+++ trunk/xOperator/src/net/sf/xoperator/store/RDFStoreHTTPAdaptor.java 2008-01-18 22:19:41 UTC (rev 104)
@@ -25,6 +25,8 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import net.sf.xoperator.blackboard.ConfigurationAwareKnowledgeSource;
import net.sf.xoperator.configuration.KSConfiguration;
@@ -82,8 +84,15 @@
if (get.getStatusCode() == 200) {
return new SPARQLResult(res, info.getName());
} else {
+
+ //strip html from res
+
+
+ Pattern pat = Pattern.compile("(<\\!--.*?-->)|(<\\!.*?>)|(<.+?>)",Pattern.DOTALL);
+ String stripRes = pat.matcher(res).replaceAll("").replaceAll("\\s+", " ");
+
return new StringMessage("Store " + info.getName()
- + " was unable to execute the query: " + res);
+ + " was unable to execute the query: " + stripRes);
}
} catch (UnsupportedEncodingException e1) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|