我用来处理XSLT和XML文件的一般java代码是:
public static final String transformXmlDocument(String inputXmlString,
File xsltFile) {
TransformerFactory factory = TransformerFactory.newInstance();
StreamSource xslt = new StreamSource(xsltFile);
StreamSource text = new StreamSource(new StringReader(inputXmlString));
StringWriter writer = new StringWriter();
StreamResult textOP = new StreamResult(writer);
try {
Transformer transformer = factory.newTransformer(xslt);
transformer.transform(text, textOP);
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (TransformerException e2) {
e2.printStackTrace();
}
String results = writer.toString();
return results;
}
Run Code Online (Sandbox Code Playgroud)
我必须处理XSLT3.0 版本才能使用以下功能:
解析 xml-fragment()
对于这个版本的XSLT说法,它会抛出错误:
找不到 parse-xml-fragment() 作为函数
我的输入 …
我正在尝试使用 Rails 创建一个以 mysql 作为数据库的项目
我使用以下命令:
gem install mysql2
Run Code Online (Sandbox Code Playgroud)
我在命令行中得到以下结果:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/home/sample/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20170316-5426-f6rn3k.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
checking for mysql_query() in -lmysqlclient... no
-----
mysql client …Run Code Online (Sandbox Code Playgroud)