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
7
votes
1 answer

PHP, SimpleXML, decoding entities in CDATA

I'm experiencing the following behavior: $xml_string1 = ""; $xml_string2 = " Someone's Name "; $person = new SimpleXMLElement($xml_string1); print…
Cassie
  • 292
  • 1
  • 3
  • 9
7
votes
2 answers

Speeding up XML schema validations of a batch of XML files against the same XML schema (XSD)

I would like to speed up the process of validating a batch of XML files against the same single XML schema (XSD). Only restrictions are that I am in a PHP environment. My current problem is that the schema I would like to validate against includes…
kraenhansen
  • 1,535
  • 2
  • 15
  • 26
7
votes
6 answers

How to get attributes from a node in libxml2

I am working on a parser to get data from an XML file. I am using libxml2 to extract data. I am a not able to get the attributes from nodes. I only found nb_attributes to get the count of the attributes.
kiri
  • 1,977
  • 5
  • 27
  • 55
6
votes
5 answers

Is it possible to disable stderr in C++?

I wrote a program for linux using libxml2 for html parsing. Although it does its job, the html parser writes lots of various errors to stderr. Is it possible to disable stderr at all (or redirect it to /dev/null while not having to run it with a…
Bartek
6
votes
1 answer

LibXML2 Sax Parsing and ampersand

I've encountered (what I think is) a strange behavior when using the sax parser, and I wanted to know if it's normal. I'm sending this XML through the SAX parser: The "&" gets converted to " &" when…
Julien Genestoux
  • 31,046
  • 20
  • 66
  • 93
6
votes
4 answers

How to use libxml2 with python on macOs?

I'm on OSX Lion and I have libxml2 installed (by default) and I have python installed (by default) but they don't talk to one another. What's the simplest way to make this work on Lion? $ python -c "import libxml2" Traceback (most recent call…
John Mee
  • 50,179
  • 34
  • 152
  • 186
6
votes
3 answers

libxml xmlNodePtr to raw xml string?

Given a valid, arbitrary xmlNodePtr, I would like the string representation of that node, including the tag, attributes, and children in the same form (recursive). FWIW, my scenario is I am using PerformXPathQuery to get a block of data from within…
Stickley
  • 4,561
  • 3
  • 30
  • 29
6
votes
6 answers

Problems installing lxml on M1 mac

So, I'm having the classic trouble install lxml. Initially I was just pip installing, but when I tried to free up memory using Element.clear() I was getting the following error: Python(58695,0x1001b4580) malloc: *** error for object 0x600000bc3f60:…
Acorn
  • 49,061
  • 27
  • 133
  • 172
6
votes
1 answer

Validating attribute uniqueness with XSD across XML document

I'm trying to validate the uniquess of an attribute across all elements that exist in an XML document. Example XML: My XSD schema:
6
votes
2 answers

Processing a large xml file with perl

I have an XML file which is about 200MB in size, i wish to extract selected information on a line by line bases. I have written a script with perl using the module XML::LibXML to parse the file contents in and then loop the contents and extract the…
fir3x
  • 157
  • 11
6
votes
2 answers

did I find a libxml2 bug (memory leak in multi-threaded parsing)?

I am working actually on a data processing code using libxml2. I am stuck on a memory leak impossible to remove . Here is a minimal code to generate it : #include #include #include #include…
Antonin Portelli
  • 688
  • 5
  • 12
6
votes
1 answer

xml indentation

I am writing an xml file using the xmlwriter api of libxml2. when I open the file using notepad, the indentation isn't right. does anybody know how to fix it? thanks a whole lot.
lean pol
  • 87
  • 1
  • 5
6
votes
1 answer

PHP LIBXML_NOWARNING not suppressing warnings?

Using the LIBXML_NOWARNING options flag doesn't stop wanrings when loading html with PHPDOMDocument->loadHTML. Other constants do work though. In the example below I add the LIBXML_HTML_NODEFDTD to prove that the constants are received(stops a…
user2782001
  • 3,380
  • 3
  • 22
  • 41
6
votes
3 answers

Why does XML::LibXML find no nodes for this xpath query when using a namespace

I'm attempting to select a node using an XPath query and I don't understand why XML::LibXML doesn't find the node when it has an xmlns atribute. Here's a script to demonstrate the issue: #!/usr/bin/perl use XML::LibXML; # 1.70 on libxml2 from…
benrifkah
  • 1,526
  • 14
  • 31
6
votes
3 answers

Validate XML using LibXML

Currently, I am using the XML::LibXML perl module to validate an XML file against a defined XML schema. At the moment, if my XML file fails to validate successfully against the defined XML Schema, I will get a list of errors informing me, for…
firefly7
  • 61
  • 1
  • 2