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

Re: Genx


web file browser 0.4b14
At 21:18 20.1.2004, you wrote:

>----- Original Message -----
>From: "Toni Uusitalo" <toni.uusitalo@p...>
>
> > I vote for abstract "streaming writer" callback, no FILE* streams but
> > something like:
> >
> > typedef int (*PFNOUTPUTCALLBACK)(void *UserData, utf8Byte *buf, int 
> cBytes,
> > int *cBytesWritten);
>
>I agree. I have actually implemented an XML writer API in Delphi,
>initially modelled after the one available in .NET, and I also
>decided to use an (abstract) IWriter interface for the target,
>as it allows you to plug in various output targets, like streams
>or encoding transformers.
>
>Btw, instead of void *UserData, maybe one registers an opaque
>WriterTarget pointer, using something like:
>
>   void genxSetWriterTarget(genxWriter w, const void * writertarget);

Yes. I actually intended UserData to be called OutputData and it to
be similar to your writertarget, containing FILE* or whatever and
maybe UserData as one of its members. I copied and pasted it
from one header file of mine in a hurry.

>One should have, IMO, additional calls, to enable the target to deal
>with at least the start and end of the document. For instance, some
>encoding transformer need to write a prolog (UTF-16 BOM) or maybe even an 
>epilog.

Yes. BOM and xml declaration handling should be modifiable by some settings/
callback. This is essential when user defined or libiconv etc. encoding 
transformation
would be used.

>The IWriter interface I used has these methods:
>- Reset
>- Close
>- Write
>- Flush
>- State  // returns current state, one of Initialized, Open, Closing, Closed
>
>However, the XML writer needs to deal with Write and Close only,
>since the start of the document can be inferred when Write is called
>on a "Closed" writer target. I believe, the rest is up to the application.
>
>For your call-back above this could be done with adding a boolean
>flag isLast to the parameters (indicating the last buffer).
>One could also add a separate call-back instead.

I don't understand this. Why the application couldn't be responsible for 
opening
"stream", then setting genxSetWriterTarget and then closing the "stream" after
all writing's done?

> > You could also wrap for example gnu libiconv calls in this callback to
> > output in different encoding than UTF-8/16
> > (of course you have to work with UTF-8/wchar internally for name char
> > checking etc.). There could
> > be FILE* stream callback and maybe libiconv callback provided "in the box"
> > for genx?
>
>Exactly.
>
>Karl
>
>-----------------------------------------------------------------
>The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
>initiative of OASIS <http://www.oasis-open.org>
>
>The list archives are at http://lists.xml.org/archives/xml-dev/
>
>To subscribe or unsubscribe from this list use the subscription
>manager: <http://lists.xml.org/ob/adm.pl>

with respect,
Toni Uusitalo



  • Follow-Ups:
    • Re: Genx
      • From: "Karl Waclawek" <karl@w...>
  • References:
    • Genx
      • From: Tim Bray <tbray@t...>
    • Re: Genx
      • From: Toni Uusitalo <toni.uusitalo@p...>
    • Re: Genx
      • From: "Karl Waclawek" <karl@w...>

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.