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

Re: SAX C/C++ Implementations?

  • From: <mlepage@a...>
  • To: xml-dev@i...
  • Date: Tue, 28 Sep 1999 11:51:23 -0400

sax c
On Tue, Sep 28, 1999 at 12:44:49PM +0200, Steinar Bang wrote:
> >>>>> Holger Flörke <hf@d...>:
> 
> > At 11:08 24.09.99 -0400, you wrote:
> >> I occasionally receive e-mail about people who've attempted SAX
> >> implementations in C or C++.  I know about IBM's and a couple of
> >> private ones, but I'd like to try to smoke out any others that might
> >> be lurking.  Please reply if you have one.
> 
> > Based upon Expat I recently started working on a C++ implementation
> > of SAX.  Currently only the basic things (as DocumentHandler,
> > Parser, Locator and SAXExcpetion) are designed, implemented and
> > *seem* to work well.
> 
> > I hope there will be a standardized C++ interface in the
> > future. Feel free to contact for more information.
> 
> After looking at 
>         http://www.jezuk.demon.co.uk/SAX/
> and
>         http://www.cgocable.net/~mlepage/minion/doc/
> I wrote my own implementation, which like the one above and the two in 
> the URLs also includes an expat wrapper.

Expat seems particularly suited for quick wrapping in SAX.
 
> It's not for me to make the code public, but if anybody are
> interested, I can ask my employer if I'm allowed to.
> 
> Since I had to make this work on some parsers without proper namespace
> support I prefixed the classes with "sax_".

You mean compilers? Sounds reasonable, but I'd like to see any C++ implementations account for the possibility of using C++ namespaces. That's what they're for!

> Like Jez Higgins I'm returning "const string&" in the attribute list,
> rather than the "const string*" of the Minion SAX implementation.  If
> I'm accessing a non-existing attribute the returned value is a
> reference to an empty string.

How can the application tell the difference between a non-existent attribute, and an empty attribute?

I can think of cases where, if not available, an application might find an attribute value using some other mechanism (e.g. ask the user). How can the XML document set the attribute to an empty string, without invoking that other behaviour?

> Wrt. to the issues raised in
>         http://www.cgocable.net/~mlepage/minion/doc/class_nand__xml__sax__parser.html#_details
> I'm also using the iostream classes instead of the iowstream classes,
> and string instead of wstring (issues 2, 3, and 4).
> 
> This is because I don't have iowstream and not full std::iostream
> compliance on any of the platforms I'm working on, and our program is
> currently using string internally.
> 
> Right now I'm decoding UTF-8 into ISO-8859-1 and throwing away
> everything that doesn't fit.  This is not a long term strategy, but
> for now it'll do.

That all sounds reasonable, especially for a private (protected?) implementation. My personal feeling is that as long as we are close, if a standardized version becomes available, it shouldn't be too hard to get in line with the standard. More so than if we just used whatever parser interface was available, and not a SAX-like interface.

Still, it would be nice to work out some of these issues. Is Jez, or any of the IBM alphaworks developers, on this list? I emailed Jez before about compilation problems, he seemed keen on helping and improving his work.

-- 
Marc Lepage  (aka SEGV)
http://www.antimeta.com/
RTS game programming info, Minion open source game, etc.

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/ and on CD-ROM/ISBN 981-02-3594-1
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.