Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - RFC, an ugly parser hack (and a bin-xml variant) >Thread Next - Re: RFC, an ugly parser hack (and a bin-xml variant) Re: RFC, an ugly parser hack (and a bin-xml variant)To: NULL Date: 9/7/2005 2:52:00 AM cr88192 wrote: > for various reasons, I added an imo ugly hack to my xml parser. > basically, I wanted the ability to have binary payload within the xml parse > trees. > > this was partly because I came up with a binary xml format (mentioned more > later), and thought it would be "useful" to be able to store binary data > inline with this format, and still wanted to keep things balanced (whatever > the binary version can do, the textual version can do as well). > > the approach involved, well, a bastardized subset of xml-data. > the attribute 'dt:dt' now has a special meaning (along with the rest of the > 'dt' namespace prefix), and the contents of such nodes are parsed specially > (though still within xml's syntactic rules, eg, as a normal xml text glob). My comment: Why don't you use the normal namespace mechanism, instead of magic prefixes? The parser must store the namespace prefix-->URI bindings is had encountered so far at some place anyway (if it's a namespace aware parser). It should then also be possible to modify it to go to binary mode when entering elements in your special namespace -- and leave it again when exiting (keep a counter of the nesting depth, increment, decrement). In binary mode, it will decode text to binary. Søren | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
