[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

SAX-C

  • From: Peter Murray-Rust <peter@u...>
  • To: xml-dev@i...
  • Date: Tue, 13 Jan 1998 16:04:41

sax c
I am forwarding this on behalf of Stefan Wagner because he has e-mail
problems. From a very quick glance this looks very exciting Stefan - many
thanks. 
[... mail stuff deleted ...]

>Date: Tue, 13 Jan 1998 00:25:58 +0100
>To: xml-dev@i...
>From: Stefan Wagner <h8625330@o...>
>Subject: SAX-C
>
>----------------------------------------------------------------
>
>Today, David Megginson (dmeggins@m...) with the help of many
>others announced the first draft for SAX for Java.
>Unfortunately Java is currently no option for me, only C.
>To speed up the implementation of a common basic event based API for
>parsers written in C  (like rxp or xmltok) I have converted the Java
>interfaces to C. I have tried to change the names as little as necessary.
>Still there will be things which should get changed.
>Some candidates for a change:
>- replacing  sax_ with xml_
>- result type of getAttributeName()
>
>Anyone adapting a C parser or writiing a driver (instead of writing good
>documentation for the parser API)?
>
>Stefan Wagner
>
>(st.wagner@i...)
>
>
>(Read the Java draft for an explanation of the functions)
>
>/* --------------------------------------------------------------------- */
>
>/*
>    SAX-C Simple API for XML - C Language Interface
>
>    Proposal 1998-01-12
>*/
>
>
>
>/* --------------------------------------------------------------------- */
>/*  basic types */
>/* --------------------------------------------------------------------- */
>
>#define false   0
>#define true    1
>typedef int     bool;
>
>typedef char *  String;
>
>/* --------------------------------------------------------------------- */
>/*  Attribut Map
>/* --------------------------------------------------------------------- */
>
>/*
>  sax_AttributeMap_struct gets defined in the parser source code.
>  The definition is not needed by the application
>*/
>
>typedef struct sax_AttributeMap_struct *sax_AttributeMap;
>
>
>/* --------------------------------------------------------------------- */
>/*  typedefs for all the handlers */
>/* --------------------------------------------------------------------- */
>
>typedef void ( sax_EntityHandler ) ( String systemID );
>
>/* --------------------------------------------------------------------- */
>
>typedef struct
>{
>    void ( *startDocumentHandler ) ( void );
>    void ( *endDocumentHandler ) ( void );
>    void ( *doctypeHandler ) ( String name, String publicID, String
systemID );
>    void ( *startElementHandler ) ( String name, sax_AttributeMap
attributes );
>    void ( *endElementHandler ) ( String name );
>    void ( *charactersHandler ) ( char ch[], int start, int length );
>    void ( *ignorableHandler ) ( char ch[], int start, int length );
>    void ( *processingInstruction ) ( String target, String remainder );
>} sax_DocumentHandler;
>
>/* --------------------------------------------------------------------- */
>
>typedef struct
>{
>    void ( *warningHandler ) ( String message, String systemID, int line,
>int column );
>    void ( *fatalHandler )    ( String message, String systemID, int line,
>int column );
>} sax_ErrorHandler;
>
>
>/* --------------------------------------------------------------------- */
>/*  Parser Interface */
>/* --------------------------------------------------------------------- */
>
>void    sax_new_parser              ( void );
>void    sax_delete_parser           ( void );
>
>/* Default implementation will be used if never called or if called with
>handler = NULL */
>/* copies function pointers to internal table */
>void    sax_setEntityHandler        ( sax_EntityHandler   handler );
>void    sax_setDocumentHandler      ( sax_DocumentHandler handler );
>void    sax_setErrorHandler         ( sax_ErrorHandler    handler );
>
>void    sax_parse                   ( String publicID, String systemID );
>
>
>/* --------------------------------------------------------------------- */
>/*  EntityHandler Callbacks */
>/* --------------------------------------------------------------------- */
>
>void    sax_changeEntity            ( String systemID );
>
>
>/* --------------------------------------------------------------------- */
>/*  DocumentHandler Callbacks */
>/* --------------------------------------------------------------------- */
>
>void    sax_startDocument           ( void );
>void    sax_endDocument             ( void );
>
>void    sax_doctype                 ( String name, String publicID, String
>systemID );
>
>void    sax_startElement            ( String name, sax_AttributeMap
>attributes );
>void    sax_endElement              ( String name );
>
>void    sax_characters              ( char ch[], int start, int length );
>void    sax_ignorable               ( char ch[], int start, int length );
>void    sax_processingInstruction   ( String target, String remainder );
>
>
>/* --------------------------------------------------------------------- */
>/*  ErrorHandler Callbacks */
>/* --------------------------------------------------------------------- */
>
>void    sax_warning                 ( String message, String systemID, int
>line, int column );
>void    sax_fatal                   ( String message, String systemID, int
>line, int column );
>
>
>/* --------------------------------------------------------------------- */
>/*  AttributeMap Interface */
>/* --------------------------------------------------------------------- */
>
>/* returns an array of String Pointers and the number of Attribut names */
>void    sax_getAttributeNames       ( sax_AttributeMap map, int *count,
>String *atts );
>
>/* a replacement for Enumeration */
>String  sax_firstAttributeName      ( sax_AttributeMap map );
>String  sax_nextAttributeName       ( sax_AttributeMap map );
>bool    sax_hasMoreAttributeNames   ( sax_AttributeMap map );
>
>String  sax_getValue                ( sax_AttributeMap map, String
>attributeName );
>
>bool    sax_isEntity                ( sax_AttributeMap map, String
>attributeName );
>bool    sax_isNotation              ( sax_AttributeMap map, String
>attributeName );
>bool    sax_isId                    ( sax_AttributeMap map, String
>attributeName );
>bool    sax_isIdref                 ( sax_AttributeMap map, String
>attributeName );
>
>String  sax_getEntityPublicID       ( sax_AttributeMap map, String
>attributeName );
>String  sax_getEntitySystemID       ( sax_AttributeMap map, String
>attributeName );
>
>String  sax_getNotationNameID       ( sax_AttributeMap map, String
>attributeName );
>String  sax_getNotationPublicID     ( sax_AttributeMap map, String
>attributeName );
>String  sax_getNotationSystemID     ( sax_AttributeMap map, String
>attributeName );
>
>/* --------------------------------------------------------------------- */
>
>
>
>
>
>
>
>
>
>---------------------------------------------------------------------------
---
>  Stefan Wagner
>  Internet: h8625330@o...                st.wagner@i...
>  Fax: +43-1-607 71 57
>---------------------------------------------------------------------------
--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The real poster :-)


-
>
>
	P.

>
Peter Murray-Rust, Director Virtual School of Molecular Sciences, domestic
net connection
VSMS http://www.nottingham.ac.uk/vsms, Virtual Hyperglossary
http://www.venus.co.uk/vhg

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.