Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A simple C XML parser

Tags:

People also ask

What is XML parser in C?

The Oracle XML parser for C reads an XML document and uses DOM or SAX APIs to provide programmatic access to its content and structure. You can use the parser in validating or nonvalidating mode. This chapter assumes that you are familiar with the following technologies: Document Object Model (DOM).

What is XML parser give example?

XML parser is a software library or a package that provides interface for client applications to work with XML documents. It checks for proper format of the XML document and may also validate the XML documents. Modern day browsers have built-in XML parsers. The goal of a parser is to transform XML into a readable code.

Which is parser in XML?

The XML DOM (Document Object Model) defines the properties and methods for accessing and editing XML. However, before an XML document can be accessed, it must be loaded into an XML DOM object. All modern browsers have a built-in XML parser that can convert text into an XML DOM object.


I need to read an XML formatted document from a C program and extract from it the elements and their values. For example in the following code:

<user name="Mark">
    <param name="Age" value="21"/>
    <param name="Country" value="NL"/>
</user>

I need to extract: name = Mark, Age = 21 and Country = NL.

Up until today I've been doing this parsing manually which is a pain.

I don't care whether the file a "proper XML" or all that, I don't care about DTD's or other standard XML requirements. I just need to read and parse the values.

Does anyone know of a library other than lib eXpat to do this or code to do this?

Thanks!