On Monday 10 August 2009 02:53:16 Tom Lane wrote: > Andres Freund <and...@anarazel.de> writes: > > On Monday 10 August 2009 01:21:35 Andrew Dunstan wrote: > >> That ";" after the attribute is almost certainly wrong. This is a > >> classic case of what I was talking about a month or two ago. Building up > >> XML (or any structured doc, really, XML is not special in this regard) > >> by ad hoc methods is horribly error prone. if you don't want to rely on > >> libxml, then I think you need to develop a lightweight abstraction > >> rather than just appending to a StringInfo. > > > > While it would be possible to add another step inbetween and generate a > > format neutral tree and generate the different formats out of it I am not > > sure that this is worthwile. > > The current text format will need to stay special cased anyway because > > its far to inconsistent to generate it from anything abstract and I don't > > see any completely new formats coming (i.e. not just optional parts)? > > The patch as-submitted does have a lightweight abstraction layer of > sorts, but the main code line feels free to ignore that and hack around > it. I agree that we can't avoid special-casing the text output, but > I'm trying to improve the encapsulation otherwise. What I've got at the > moment is attached. I'd be interested in comments on the grouping > notion in particular --- I reverse-engineered that out of what the code > was doing, and I'm sure it could use improvement. Adding the notion of opening a 'empty' Group together with X_OPENCLOSE or handling of X_OPENING|X_CLOSING would allow to handle empty tags like in ExplainOneUtility (<Notify />).
Otherwise it seems to look nice. Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers