glib:gmarkup: preserve text (feature request)



The current gmarkup parse routines will throw away any whitespace
that runs before/between/after toplevel xml elements - and whatever
other non-element text chars exists in an xml file will make the
parser routine to error out when before the first element.

While that not only violates xml standards - it makes a current
project of mine a bit more complicated where I want to parse an
xml style snippet into a larger tree. (and interesting too, one
can not let some real text run in between toplevel xml elements).

All these problems - without need.

The current scheme makes my project a bit more complicated since
I have to make a fake call to promote the parser from STATE_START
to STATE_INSIDE_TEXT - issuing some "<_>" text to the parser, and
let the parser-handlers filter it out again.

See - it is not particularly complicated to make that state-promotion
a valid option of a gmarkup parser - it can be achieved with a
GMarkupParseFlag  to the _new call, so it initializes the state with
INSIDE_TEXT - and it makes people like me a bit happier who want to
look at documents with an xml syntax - and keep any text around xml
elements.

It would be nice of you to add such a flag - it's simple, it wouldn't
hurt other software you are currently chewing on, and can be reused
in a lot of projects doing some simplistic xml parsing.

thanks, guido                       (not subscribed to ML)
// mdk 9.0 with glib 2.0.6          // who am I? google for "guidod"





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]