我找不到这些解析技术的比较.哪一个最常用?
问候.穆斯塔法
我尝试了很多Perl XML Parsers.我对Sablotron Parser很感兴趣,但安装在Windows机箱上真是太痛苦了.目前我已经开始使用XML :: LibXML和XML :: LibXSLT这两者似乎都做我需要的一切.
它们似乎也很标准.是否有比这更好的XML解析器?
我正在尝试安装libxml2,以便我可以设置python绑定并最终使用lxml.
但是,我无法在地球上工作,我应该解压缩文件.我没能成功谷歌.
我是否需要Cygwin/MinGW才能使安装成功?
目前,我将libxml2.tar.gz和libxslt.tar.gz中的文件放在Python文件夹中各自的目录中.因此,包含在包含的变量中的文件位于Python26\include\libxml2\libxml ...等等.
但是,当我运行easy_install lxml时,我收到以下输出:
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.2.4
Downloading http://codespeak.net/lxml/lxml-2.2.4.tgz
Processing lxml-2.2.4.tgz
Running lxml-2.2.4\setup.py -q bdist_egg --dist-dir c:\users\rocco\appdata\local
\temp\easy_install-1xwbhy\lxml-2.2.4\egg-dist-tmp-9zwhe4
Building lxml version 2.2.4.
NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' need
s to be available.
ERROR: 'xslt-config' is not recognized as an internal or external command,
operable program or batch file.
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt …Run Code Online (Sandbox Code Playgroud) Running 'compile' for libxslt 1.1.28... OK
Running 'install' for libxslt 1.1.28... OK
Activating libxslt 1.1.28 (from /Users/Kartik/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28)...
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
Run Code Online (Sandbox Code Playgroud)
缺少libxml2.请找到mkmf.log来调查它是如何失败的.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Run Code Online (Sandbox Code Playgroud) 我刚刚更新到OS X Mountain Lion,在使用rails和终端时我得到了以下内容.
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
Run Code Online (Sandbox Code Playgroud)
我已经看过类似问题的其他答案,但它们似乎并没有阻止出现警告信息.
更新:已修复
我在另一个帖子中找到了答案.我使用的解决方法是告诉Nokogiri使用系统库:
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install
Run Code Online (Sandbox Code Playgroud)
====
试图在Mac上安装nokogiri 1.6.0.在以前的版本中,我没有遇到任何问题.但1.6.0拒绝安装.这是错误:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/josenriq/.rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp/i686-apple-darwin11/ports/libxml2/2.8.0... ERROR
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains obsolescent base-64 headers
tar: Read 3 bytes from /Users/josenriq/.rvm/gems/ruby-1.9.3-head@wdi/gems/nokogiri-1.6.0/ports/archives/libxml2-2.8.0.tar.gz
tar: Error exit delayed from previous errors
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably …Run Code Online (Sandbox Code Playgroud) 这是安装的标准输出:
$sudo cpanm XML::LibXML
--> Working on XML::LibXML
Fetching http://www.cpan.org/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0014.tar.gz ... OK
Configuring XML-LibXML-2.0014 ... N/A
! Configure failed for XML-LibXML-2.0014. See /home/kahmed/.cpanm/build.log for details.
Run Code Online (Sandbox Code Playgroud)
细节:
Unpacking XML-LibXML-2.0014.tar.gz
Entering XML-LibXML-2.0014
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.55_02)
Configuring XML-LibXML-2.0014
Running Makefile.PL
enable native perl UTF8
running xml2-config...ok (2.9.0)
Checking for ability to link against xml2...no
Checking for ability to link against libxml2...libxml2, zlib, and/or the Math library (-lm) have not been found.
Try …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用任何一个基于libxml的第三方XML解析器,但我不能,因为我认为我有某种类型的libxml2问题
我将其他链接器标志设置为-lxml2
和/ usr/include/libxml2的标题搜索路径
但是当我尝试编译时,我仍然会得到大量未定义的符号.以下错误是尝试编译TouchXML的结果.
Undefined symbols:
"_xmlDocDumpFormatMemory", referenced from:
-[CXMLDocument description] in CXMLDocument.o
"_xmlXPathNewContext", referenced from:
-[CXMLNode nodesForXPath:error:] in CXMLNode.o
-[CXMLNode(CXMLNode_NamespaceExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
"_xmlOutputBufferFlush", referenced from:
-[CXMLNode XMLStringWithOptions:] in CXMLNode.o
"_xmlNodeListGetString", referenced from:
-[CXMLNode stringValue] in CXMLNode.o
"_xmlFree", referenced from:
_xmlFree$non_lazy_ptr in CXMLDocument.o
_xmlFree$non_lazy_ptr in CXMLNode.o
(maybe you meant: _xmlFree$non_lazy_ptr)
"_xmlXPathFreeContext", referenced from:
-[CXMLNode nodesForXPath:error:] in CXMLNode.o
-[CXMLNode(CXMLNode_NamespaceExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
"_xmlNodeDumpOutput", referenced from:
-[CXMLNode XMLStringWithOptions:] in CXMLNode.o
"_xmlAddChild", referenced from:
-[CXMLDocument(CXMLDocument_CreationExtensions) addChild:] in CXMLDocument_CreationExtensions.o
-[CXMLElement(CXMLElement_CreationExtensions) addChild:] in …Run Code Online (Sandbox Code Playgroud) 你如何从libxml2库转换/转换xmlChar*为char*?谢谢.