dhodgkin / euexpat

Expat wrapper for Euphoria

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EuExpat for Linux ver 0.1.2

Copyright Info:

EuExpat - Copyright (c) 2005-2012 Damien Hodgkin.
          Released under the BSD license, see copying.txt.

Expat   - Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
          and Clark Cooper.
          Copyright (c) 2001, 2002, 2003 Expat maintainers.
          Released under the MIT/X Consortium license, see ExpatLicense.txt.

Contents:

  1. Introduction
  1. Installation
  2. Usage
  3. Function List

i. Introduction:

After hunting high and low for a wrapper for the expat library, and finding nothing I decided to write my own. It is in no way done yet, as I have only about 10% of the functions wrapped. I will continue working on it and throwing out new releases as long as the Expat Maintainers keep releasing new versions of expat.

My contact info:
Email - dracul01@gmail.com

Let me know of any major bugs, or ideas you have. I'll gladly except code contributions. If you have a contribution just email it to me.

1. Installation:

Copy euexpat.e to your euphoria include directory.

If your libexpat.so is not in /usr/lib, you need to edit the line in euexpat.e that loads the library.

ie. EXPAT = open_dll("/place/where/libexpat.so/is")

2. Usage:

This wrapper is easy to use:

first make your element handlers in an include file say "element.e", like so:

global function start_handler()
  puts (1, "in start element")
  return 0
end function

global function end_handler()
  puts (1, " in end element")
  return 0
end function

then include this above "expat.e" in your main program:

include element.e
include expat.e

then write your code to handle opening and reading the xml file:

atom parser, ret, wait, parse_ok, fn
sequence line

fn = open("test.xml", "r")
line = gets(fn)

and last create the parser and invoke it:

parser = create_parser("ISO-8859-1")
set_element_handlers(parser, "start_handler", "end_handler")
parse_ok = parse(parser, line, 1024, 0)
ret = free_parser(parser)

simple!!

3. What Works:

List of functioning functions and non-functioning functions:

Function                              Status

create_parser()                       *working
free_parser()                         *working
set_element_handlers()                *working
set_start_element_handler()           *working
set_end_element_handler()             *working
set_chardata_handler()                *working
set_default_handler()                 *working
set_comment_handler()                 *working
get_current_line_number()             *working
get_current_column_number()           *working
parse()                               *working

expat_version()                       *removed
expat_version_info()                  *removed
parse_buffer()                        *removed
get_buffer()                          *removed

About

Expat wrapper for Euphoria


Languages

Language:Eiffel 100.0%