C
chenzhongshan
Unregistered / Unconfirmed
GUEST, unregistred user!
使用XQuery的时候发现无法转换中文,
尝试转换各种编码,例如:UTF-8、ISO-8859-1等
仍然报错[]
输入的字符串如下
String buffer = " FOR $xfile1 INdo
cument(/"F:/report/dtd/bib.xml/")/bib/book, " +
" $xfile2 INdo
cument(/"F:/report/dtd/bib1.xml/")/bib/book " +
" WHERE $xfile1/publisher = /"Addison-Wesley/" " +
// " WHERE $xfile1/publisher = /"中国上海出版社/" " +
" AND $xfile1/title = $xfile2/title " +
" RETURN " +
" <records> " +
" <中国人民政府> { $xfile1/title } </中国人民政府"> " +
" <price> { $xfile1/price + $xfile2/price } </price> " +
" </records> " +
" SORTBY(price ASCENDING)";
错误如下
oracle.xquery.parser.TokenMgrError: Lexical error at line 1, column 226. Encountered: "-" (45), after : ""
at oracle.xquery.parser.XPathTokenManager.getNextToken(XPathTokenManager.java:244)
at oracle.xquery.parser.XPath.jj_consume_token(XPath.java:4490)
at oracle.xquery.parser.XPath.ElementConstructor(XPath.java:2776)
at oracle.xquery.parser.XPath.ElementContent(XPath.java:2927)
at oracle.xquery.parser.XPath.ElementConstructor(XPath.java:2785)
at oracle.xquery.parser.XPath.PrimaryExpr(XPath.java:2327)
at oracle.xquery.parser.XPath.OtherStepExpr(XPath.java:2153)
at oracle.xquery.parser.XPath.StepExpr(XPath.java:2104)
at oracle.xquery.parser.XPath.RelativePathExpr(XPath.java:1989)
at oracle.xquery.parser.XPath.Expr_14(XPath.java:1306)
at oracle.xquery.parser.XPath.Expr_13(XPath.java:1243)
at oracle.xquery.parser.XPath.Expr_12(XPath.java:1175)
at oracle.xquery.parser.XPath.Expr_11(XPath.java:1144)
at oracle.xquery.parser.XPath.Expr_10(XPath.java:1018)
at oracle.xquery.parser.XPath.Expr_9(XPath.java:949)
at oracle.xquery.parser.XPath.Expr_8(XPath.java:914)
at oracle.xquery.parser.XPath.Expr_7(XPath.java:815)
at oracle.xquery.parser.XPath.Expr_6(XPath.java:749)
at oracle.xquery.parser.XPath.Expr_5(XPath.java:703)
at oracle.xquery.parser.XPath.Expr_4(XPath.java:188)
at oracle.xquery.parser.XPath.Expr_3(XPath.java:153)
at oracle.xquery.parser.XPath.Expr_2(XPath.java:124)
at oracle.xquery.parser.XPath.Expr_1(XPath.java:83)
at oracle.xquery.parser.XPath.Expr(XPath.java:75)
at oracle.xquery.parser.XPath.ExprSequence(XPath.java:2583)
at oracle.xquery.parser.XPath.QueryModule(XPath.java:3345)
at oracle.xquery.parser.XPath.QueryModuleList(XPath.java:3224)
at oracle.xquery.parser.XPath.Input(XPath.java:70)
at oracle.xquery.parser.XPath.parseStream(XPath.java:46)
at oracle.xquery.parser.XPath.generateXQX(XPath.java:59)
at oracle.xquery.comp.XQCompiler.parse(XQCompiler.java:155)
at oracle.xquery.comp.XQCompiler.parse(XQCompiler.java:133)
at oracle.xquery.PreparedXQuery.<init>(PreparedXQuery.java:29)
at oracle.xquery.XQueryContext.prepareXQuery(XQueryContext.java:145)
at oracle.xquery.test.XQLTest.<init>(XQLTest.java:70)
at oracle.xquery.test.XQLTest.main(XQLTest.java:183)
我想改变ASCII_UCodeESC_CharStream的内部实现,是否能够解决中文的问题?
该如何去实现呢
尝试转换各种编码,例如:UTF-8、ISO-8859-1等
仍然报错[]
输入的字符串如下
String buffer = " FOR $xfile1 INdo
cument(/"F:/report/dtd/bib.xml/")/bib/book, " +
" $xfile2 INdo
cument(/"F:/report/dtd/bib1.xml/")/bib/book " +
" WHERE $xfile1/publisher = /"Addison-Wesley/" " +
// " WHERE $xfile1/publisher = /"中国上海出版社/" " +
" AND $xfile1/title = $xfile2/title " +
" RETURN " +
" <records> " +
" <中国人民政府> { $xfile1/title } </中国人民政府"> " +
" <price> { $xfile1/price + $xfile2/price } </price> " +
" </records> " +
" SORTBY(price ASCENDING)";
错误如下
oracle.xquery.parser.TokenMgrError: Lexical error at line 1, column 226. Encountered: "-" (45), after : ""
at oracle.xquery.parser.XPathTokenManager.getNextToken(XPathTokenManager.java:244)
at oracle.xquery.parser.XPath.jj_consume_token(XPath.java:4490)
at oracle.xquery.parser.XPath.ElementConstructor(XPath.java:2776)
at oracle.xquery.parser.XPath.ElementContent(XPath.java:2927)
at oracle.xquery.parser.XPath.ElementConstructor(XPath.java:2785)
at oracle.xquery.parser.XPath.PrimaryExpr(XPath.java:2327)
at oracle.xquery.parser.XPath.OtherStepExpr(XPath.java:2153)
at oracle.xquery.parser.XPath.StepExpr(XPath.java:2104)
at oracle.xquery.parser.XPath.RelativePathExpr(XPath.java:1989)
at oracle.xquery.parser.XPath.Expr_14(XPath.java:1306)
at oracle.xquery.parser.XPath.Expr_13(XPath.java:1243)
at oracle.xquery.parser.XPath.Expr_12(XPath.java:1175)
at oracle.xquery.parser.XPath.Expr_11(XPath.java:1144)
at oracle.xquery.parser.XPath.Expr_10(XPath.java:1018)
at oracle.xquery.parser.XPath.Expr_9(XPath.java:949)
at oracle.xquery.parser.XPath.Expr_8(XPath.java:914)
at oracle.xquery.parser.XPath.Expr_7(XPath.java:815)
at oracle.xquery.parser.XPath.Expr_6(XPath.java:749)
at oracle.xquery.parser.XPath.Expr_5(XPath.java:703)
at oracle.xquery.parser.XPath.Expr_4(XPath.java:188)
at oracle.xquery.parser.XPath.Expr_3(XPath.java:153)
at oracle.xquery.parser.XPath.Expr_2(XPath.java:124)
at oracle.xquery.parser.XPath.Expr_1(XPath.java:83)
at oracle.xquery.parser.XPath.Expr(XPath.java:75)
at oracle.xquery.parser.XPath.ExprSequence(XPath.java:2583)
at oracle.xquery.parser.XPath.QueryModule(XPath.java:3345)
at oracle.xquery.parser.XPath.QueryModuleList(XPath.java:3224)
at oracle.xquery.parser.XPath.Input(XPath.java:70)
at oracle.xquery.parser.XPath.parseStream(XPath.java:46)
at oracle.xquery.parser.XPath.generateXQX(XPath.java:59)
at oracle.xquery.comp.XQCompiler.parse(XQCompiler.java:155)
at oracle.xquery.comp.XQCompiler.parse(XQCompiler.java:133)
at oracle.xquery.PreparedXQuery.<init>(PreparedXQuery.java:29)
at oracle.xquery.XQueryContext.prepareXQuery(XQueryContext.java:145)
at oracle.xquery.test.XQLTest.<init>(XQLTest.java:70)
at oracle.xquery.test.XQLTest.main(XQLTest.java:183)
我想改变ASCII_UCodeESC_CharStream的内部实现,是否能够解决中文的问题?
该如何去实现呢