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

Re: Genx


genx 6.0
At 03:32 21.1.2004, you wrote:

>----- Original Message -----
>From: "Toni Uusitalo" <toni.uusitalo@p...>
> > >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?
>
>Actually, you are correct, that would be more flexible.
>I was thinking along the lines of tying the Close call to
>the genxEndDocument call, saving the programmer one call.
>But who says you need to close the stream - maybe you want to
>write several documents in succession before closing it.

Yep. And stdout doesn't need to be closed. I think this abstract output 
callback
thing isn't adding too much complexity into genx inplementation, not when 
flexibility's
taken into account.

void genxStartDocument(genxWriter w, FILE * file);

could be implemented as

void genxStartDocument(genxWriter w,
   void * outputData,
   PFNOUTPUTCALLBACK outputCallback);

where PFNOUTPUTCALLBACK was something like:
typedef int (*PFNOUTPUTCALLBACK)(void *outputData, genxByte *buf, int 
cBytes, int *cBytesWritten);

if genxStartDocument is called with outputCallback parameter being NULL i.e:
genxStartDocument(pWriter, stdout, NULL);

it could default to internal FILE* PFNOUTPUTCALLBACK which simply calls fwrite.



with respect,
Toni Uusitalo



  • References:
    • Genx
      • From: Tim Bray <tbray@t...>
    • Re: Genx
      • From: Toni Uusitalo <toni.uusitalo@p...>
    • Re: Genx
      • From: "Karl Waclawek" <karl@w...>
    • 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.