我正在从Web服务中获取值。我的一些值带有单引号。像这个示例的sqlite不支持单引号。所以我用双引号替换它们。然后当我从数据库中检索该值时,我无法解析该值。我得到了“解析器异常未格式化”的错误消息。有人能告诉我如何解决吗?
这是我将单引号替换为双引号的代码
stockservicevalue=stockservicevalue.replaceAll("'", "\"");
这是我从数据库检索值的方式
String sql = "SELECT * FROM MyQuest;";
日志:
03-28 19:02:36.309: WARN/System.err(344): org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 50437: not well-formed (invalid token)
03-28 19:02:36.321: WARN/System.err(344): at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:492)
03-28 19:02:36.330: WARN/System.err(344): at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:477)
03-28 19:02:36.340: WARN/System.err(344): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:317)
03-28 19:02:36.380: WARN/System.err(344): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:273)
03-28 19:02:36.389: WARN/System.err(344): at com.inquest.SaxPortfolioDocument.getEventsFromAnXML(SaxPortfolioDocument.java:13)
03-28 19:02:36.411: WARN/System.err(344): at com.inquest.PortfolioActivity$PortFolioTask.doInBackground(PortfolioActivity.java:171)
03-28 19:02:36.420: WARN/System.err(344): at com.inquest.PortfolioActivity$PortFolioTask.doInBackground(PortfolioActivity.java:1)
03-28 19:02:36.430: WARN/System.err(344): at android.os.AsyncTask$2.call(AsyncTask.java:185)
03-28 19:02:36.430: WARN/System.err(344): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
03-28 19:02:36.440: WARN/System.err(344): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
03-28 19:02:36.479: WARN/System.err(344): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
03-28 19:02:36.500: WARN/System.err(344): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
03-28 19:02:36.510: WARN/System.err(344): at java.lang.Thread.run(Thread.java:1096)
03-28 19:02:36.840: WARN/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@46dfec78
谢谢