Re: comments on XML Pull Parsing presentation
Elliotte Rusty Harold <[email protected]>
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <p04330103ba12a77e717a@[192.168.254.4]> |
At 8:48 PM -0500 11/28/02, Aleksander Slominski wrote: >hi Elliotte, > >i looked on your presentation: > > http://www.ibiblio.org/xml/slides/sd2002east/xmlpull/XML_Pull_Parsing.html > >and i noteiced really nice collection of useful sample programs >that use XmlPull API - if you want we can add them to standard >XmlPull samples. Feel free. You may want to rewrite some of them to better fit the medium. When designing examples for a class I have to keep them small enough and the line length short enough to fit on a slide. In a less restricted environment, there are definitely some improvements that can be made. For instance, they contain almost no comments because it's assumed I'll be talking about them as the class sees them. >here are my few comments about code smaples from presentation: >in http://www.ibiblio.org/xml/slides/sd2002east/xmlpull/32.html >instead of: > > for (int event = parser.next(); > event != XmlPullParser.END_DOCUMENT ; > event = parser.next()) ; > >it is much shorter and easier to understand to write this loop like this: > > while( parser.next() != XmlPullParser.END_DOCUMENT); Yes, that is better for that example. I think I had for loops on the brain because I've been experimenting with that pattern in I/O as a way to keep variables from having too much scope. >and answering question "How to define attribute prefixes????" from: > > http://www.ibiblio.org/xml/slides/sd2002east/xmlpull/41.html > OK. I see. I'll fix that before I give this talk again. You put the prefixes into the serializer instead of the attribute. That hadn't occurred to me. >however this brings aquesiton: why would you want to declare >prefixes at all ? Imagine you're trying to output a DTD-valid document. DTDs care about the prefixes, not the namespace URIs. Also, for human legibility, it's useful to use common prefixes like xsl, fo, and xlink for their usual applications. Not essential, just nice. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | [email protected] | Writer/Programmer | +-----------------------+------------------------+-------------------+ | XML in a Nutshell, 2nd Edition (O'Reilly, 2002) | | http://www.cafeconleche.org/books/xian2/ | | http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ ------------------------ Yahoo! Groups Sponsor ---------------------~--> Get 128 Bit SSL Encryption! http://us.click.yahoo.com/CBxunD/vN2EAA/xGHJAA/2U_rlB/TM ---------------------------------------------------------------------~-> To unsubscribe from this group, send an email to: [email protected] Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/