Questions tagged [expat-parser]

Expat is an XML parser library written in C

Expat is a stream-oriented XML parser. The programming model is based on handlers for patterns such as start tags that the parser finds in the XML document. Expat itself is written in C, but there are bindings for many languages.

94 questions
3
votes
4 answers

What is the most efficient way of extracting information from a large number of xml files in python?

I have a directory full (~103, 104) of XML files from which I need to extract the contents of several fields. I've tested different xml parsers, and since I don't need to validate the contents (expensive) I was thinking of simply using…
bgoncalves
  • 1,687
  • 3
  • 19
  • 19
3
votes
2 answers

How do I know which exceptions to catch in Python

In Python, I've read that it's better (and easier) to catch execptions, rather than check first, so that's what I'm trying to do. My script opens and parses an XMLs file using xml.dom.minidom.parse(xml_file_path) so I'm…
Grezzo
  • 2,220
  • 2
  • 22
  • 39
3
votes
3 answers

Compile EXPAT to statically-linked .a on Windows

I am writing C program on Windows with MingW and want to use EXPAT XML library. I want to compile my program statically, so I need static .a library. Is there any way to compile EXPAT to .a static, independent library on Windows?
innocenat
  • 574
  • 7
  • 21
3
votes
2 answers

64-bit libjingle failing to parse login XML with expat error: ERROR_INVALID_TOKEN

Only upon attempting to run my login code under 64-bit, am I getting a failure to login to talk.google.com for my initial tests. 32-bit works fine. Upon enabling logging macros and siginput logging, I can see that the XML it's failing on is …
Zack
  • 1,181
  • 2
  • 11
  • 26
3
votes
1 answer

expat exception handling

I had been trying hard to figure out why the exceptions thrown from StartElement event handler are not being caught by my application which makes use of expat parser( in C). The application just terminates saying that it cannot find catch blocks,…
user960573
  • 51
  • 5
2
votes
1 answer

gcc newly installed libraries (libexpat1-dev) not recognised in current terminal (debian)

I've spent quite a bit of time trying to get an expat based sample program to compile. I was receiving the following error message when I tried to compile gcc -Wall -lexpat line.c -o blah line.c: In function ‘main’: line.c:99:8: warning: format…
Bryan Hunt
  • 3,685
  • 2
  • 24
  • 36
2
votes
3 answers

What's a good way of encoding arbitrary text into XML in a human-readable way?

What I have so far is putting the text into CDATA tags, and dealing with the possibility of CDATA endings appearing in the text by splitting it into multiple adjacent CDATAs. I'm not sure about this, but XML parsers can fail to preserve newlines…
Bwmat
  • 4,314
  • 3
  • 27
  • 42
2
votes
2 answers

Library fails to build if "autoreconf -i" is run before ./configure

I'm working with a tool that is supposed to simplify the build process of Unix-based apps. One of the things it does automatically is run "autoreconf -i" before doing "./configure". However, when it tries to build the expat library on OSX (Lion),…
Lorin Hochstein
  • 57,372
  • 31
  • 105
  • 141
2
votes
0 answers

Cannot link static library after upgrading gcc to version 10

I am developing a C application that uses the expat XML library. I have built expat from source and installed it under path /opt/libexpat-2.4.8. I build my program with something like (simplified wrt. the original): gcc -I/optlibexpat-2.4.8/include…
Giorgio
  • 5,023
  • 6
  • 41
  • 71
2
votes
0 answers

Expat, pure C. How to ignore mismatched tags?

I have a malformed XML (comes from a vendor, no realistic way to fix it). Working with an expat 2.2.9 (gcc 9) I was hoping to do my own stack of tags with a hierarchy and do a forceful closer of less important tags once the more important tag is…
White Owl
  • 318
  • 1
  • 8
2
votes
3 answers

How to properly convert char* into std::string? (issues while using expat / std::string(char*))

Problem Description I'm using Expat with a custom C++ wrapper, which I already tested on other projects. I'm running into problems, because the original data (c_str) is not converted to a std::string in the right way. This concers me, because I did…
Smamatti
  • 3,901
  • 3
  • 32
  • 43
2
votes
1 answer

Does expat include quotes that delimit attribute values?

I'm learning to use Expat to parse XML. Suppose I have some XML that looks like this: When the handler that I specified for XML_SetElementHandler is called with an attribute list, do the attributes…
Daniel
  • 6,595
  • 9
  • 38
  • 70
2
votes
2 answers

getting expat to use .dtd for entity replacement in python

I'm trying to read in an xml file which looks like this José A. Blakeley The point that creates the…
Nicolas78
  • 5,124
  • 1
  • 23
  • 41
2
votes
1 answer

Any ideas on this confusing Python "No module named expat; Use SimpleXMLTreeBuilderInstead" error?

Here's the scenario - I know this question has already been asked before on StackOverflow in slightly different situations, but unfortunately none of the answers/suggestions provided have been of any help to me. I have a Python file that's being…
Codine
  • 41
  • 1
  • 6
2
votes
2 answers

Why does expat reject en dash character as invalid?

In my XML input file I have the following line: That character between 50\% and 75\% is not a hyphen but an en dash. When I parse in this XML file using expat in…
LarsH
  • 27,481
  • 8
  • 94
  • 152