Questions tagged [libxml2]

Software library for parsing XML documents.

libxml2 is written in the programming language, and provides bindings to , , , , / and other Pascals, , , and .

The library was originally developed as part of the GNOME project and features

Useful Links

1518 questions
6
votes
1 answer

Nokogiri fails outputting XML with UTF-16 declaration (understanding and working around)

Summary Attempting to read and serialize XML documents that have a UTF-16 encoding and declaration causes Nokogiri to produce garbage after a certain point. Is this a bug, or is there a reasonable explanation for this? What's the best way to avoid…
Phrogz
  • 296,393
  • 112
  • 651
  • 745
5
votes
1 answer

How do I patch libxml2 so it will compile with ICU support when using a prefix?

I'm trying to fix a bug in libxml2. I cannot get it to compile with --with-icu when using --prefix=/Server/software. I have submitted a bug report here, but I need to get it to compile for resolving a conflict when compiling PHP with intl support. I…
Luke
  • 13,678
  • 7
  • 45
  • 79
5
votes
1 answer

Need help installing lxml on os x 10.7

I have been struggling to be able to do from lxml import etree (import lxml works fine by the way) The error is: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/lxml/etree.so, 2): Symbol…
Pat B
  • 564
  • 1
  • 5
  • 15
5
votes
1 answer

With libxml, how to get the character position of a given element or attribute in the source xml file?

With libxml2, we can use xmlGetLineNo to get the line number in which a node appears in the source XML file. But how to get character positions of a given element and a given attribute? I need both the start and end positions in the source xml file…
Edwin Yip
  • 4,089
  • 4
  • 40
  • 86
5
votes
4 answers

How do I install ruby gem libxml without 'extconf failure: need libxml2'

I'm currently trying to install a ruby gem which fails because extconf says it needs libxml, so when I follow these instructions to install libxml (which includes these instructions for the ruby dev kit installation) I get the following output: $…
Zaz
  • 3,017
  • 2
  • 21
  • 28
5
votes
1 answer

XML::LibXML - detect if two Elements are the same?

I'm working with XML::LibXML in Perl. Say I have two $element references gotten by different (opaque) XPath queries. (How) can I determine, if the two $element (Node) refs are the same element in the document tree? Comparing $el1 == $el2doesn't…
Martin Ba
  • 37,187
  • 33
  • 183
  • 337
5
votes
1 answer

Libxml Cleaner adds unwanted

tag to HTML fragments

I'm trying to sanitize user input to prevent XSS injection using libxml's HTML cleaner. When I input a string like this: Normal text Bold text I get this instead:

Normal text Bold text

I want to get rid of the

tag that…

Wylie
  • 1,054
  • 2
  • 12
  • 20
5
votes
3 answers

XSLT 1.0 (xsltproc) - Unable to Parse Huge XML

I am trying to parse an input xml file that is 13,00,000 lines long with a size of 56 MB, using xsltproc. I get the below error: input.xml:245393: parser error : internal error: Huge input lookup "description" : "List of values for…
AutoTester999
  • 528
  • 1
  • 6
  • 25
5
votes
2 answers

"Invalid ELF header" using libxmljs on AWS Lambda

I have a super basic AWS Lambda function using serverless, express, and libxmljs (which binds JavaScript to libxml): Code serverless.xml: service: xmltest provider: name: aws runtime: nodejs10.x stage: dev region: us-east-1 functions: …
Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
5
votes
2 answers

XML_PARSE_HUGE on function simplexml_load_string()

The constant XML_PARSE_HUGE can be passed as the third argument to simplexml_load_string(). According to to php.net this flag: relaxes any hardcoded limit from the parser. What is the "default hardcoded limit from the parser"? I think relaxes is a…
amateur barista
  • 4,440
  • 3
  • 25
  • 37
5
votes
4 answers

cannot Install libxml2 in virtualenv

I have got an issue with libxml2 python module. I'm trying to install it on a python3 virtualenv using the following command: pip install libxml2-python3 but it shows the following error: Collecting libxml2-python3 Using…
5
votes
2 answers

Installing xml2 in R in Fedora 27

I'm having trouble installing xml2 in RStudio, running Fedora 27. On running install.packages('xml2'), I get the following error: installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs ** R ** inst ** preparing package for lazy…
Robert Yi
  • 1,553
  • 1
  • 14
  • 18
5
votes
3 answers

A swiftier way to convert String to UnsafePointer in Swift 3 (libxml2)

I'm working on a Swift 3 wrapper for the libxml2 C-library. There are two convenience methods to convert String to UnsafePointer and vice versa. In libxml2 xmlChar is declared as unsigned char. UnsafePointer to String is…
vadian
  • 274,689
  • 30
  • 353
  • 361
5
votes
1 answer

libxml2 fails to handle CDATA in HTML correctly

I'm using libxml2.2.7.3 to parse html pages and I'm having difficulties getting it work correctly with CDATA in HTML. Here's the code: xmlDocPtr doc = htmlReadMemory(data, length, "", NULL, 0); xmlBufferPtr buffer =…
K J
  • 4,505
  • 6
  • 27
  • 45
5
votes
2 answers

Requesting complete, compilable libxml2 sax example

I'm having a heck of a time figuring out how to use the sax parser for libxml2. Can someone post an example that parses this XML ( yes, without the header and footer tags, if that can be parsed by the libxml2 sax parser):
Ross Rogers
  • 23,523
  • 27
  • 108
  • 164