サクソンといくつかのxpathをパースしようとしていますが、いくつかのxpathをクエリしていますが、2つの問題があります。最初のものはsaxonが非常に短いため、xhtmlに非常に短いドキュメントを作成できません。サクソンは遅い解析です
Processor processorInstance = new Processor(false);
processorInstance.setConfigurationProperty(FeatureKeys.DTD_VALIDATION, false);
XPathCompiler XPathCompilerInstance = processorInstance.newXPathCompiler();
XPathCompilerInstance.setBackwardsCompatible(false);
String expressionTitre = "//div[@class='score_global']/preceding-sibling::img[1]";
XPathExecutable XPathExecutableInstance = XPathCompilerInstance.compile(expressionTitre);
XPathSelector selector = XPathExecutableInstance.load();
logger.info("Xpath compiled.");
// Phase 2, load xml document.
DocumentBuilder documentBuilderInstance = processorInstance.newDocumentBuilder();
documentBuilderInstance.setSchemaValidator(null);
documentBuilderInstance.setLineNumbering(false);
documentBuilderInstance.setRetainPSVI(false);
XdmNode context = documentBuilderInstance.build(new File("sample/sample.xml")); // This line takes ages to return.
私は理解していないが、私はSAXでそれを行うならば、それは:(通常の速度でロードすることである 私はサクソン人に提供することを忘れなかった
のJava:。? コードはこれです1.6 サクソン9.1.0.8
第二の問題は、彼が私のXMLは、このようなものだったしながら、アクセント付き文字を処理することができないということである。
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
xml:lang en lang =属性を削除しましたが、より良い運を得ました:(
ご意見はありますか? ありがとうございました!
これを他の「回答」と組み合わせてください。 2つの理由はありません。ありがとう。 –