A DOM parser uses SAX to built up the tree, but you don't have to do that
yourself.


    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = dbf.newDocumentBuilder();

    Document d = builder.parse(new InputSource(Your Input Stream /
Reader / Whatever goes here));

Depends on what you're asking for. Mostly the apache stuff.

On Thu, May 21, 2009 at 9:24 AM, Jason Proctor <[email protected]>wrote:

>
> thanks for the response.
>
> i use the standard (javax.xml.parser.*) SAX parser. it tells me when
> things happen so i can build a DOM tree. so in a sense, i'm using
> both.
>
> Android might use standard *interfaces* for the parser and DOM
> classes, but the actual implementations are different.
>
> i developed my application against various DOM implementations, right
> now with JDK 1.5 on MacOS X. this is how i know that the Android ones
> are different.
>
> in the DOM, attribute values are implemented as child Nodes of Attr.
> this is standard DOM behaviour.
>
> another issue i'm seeing is that the Document class, at least, does
> not allow its child nodes to be removed.
>
> and another issue i'm seeing is that the error messages on DOM errors
> are nonexistent - i have to compare DOMException.code against each
> possible value to find out what happened. other implementations give
> me chapter and verse.
>
> which DOM implementation is Android using?
>
> thanks
> j
>
>
> >So what is it you're asking for DOM or SAX?
> >
> >Android uses standard classes for both cases. Maybe you should run
> >your samples on a standard sdk  just for comparison?
> >
> >startElement() is SAX, not DOM.
> >
> >I also don't get the major issue. In XML attributes cannot have
> >children. So you probably mean something else, but I didn't get that.
> >
> >On Thu, May 21, 2009 at 1:59 AM, Jason Proctor
> ><<mailto:[email protected]>[email protected]> wrote:
> >
> >
> >i'm porting some code which talks to the org.w3c.dom.* classes to
> >Android, and i'm hitting some issues.
> >
> >i'm using javax.xml.parsers.SAXParser as my parser, then getting an
> >XMLReader and setting myself up as a DefaultHandler to get notified
> >of SAX events.
> >
> >first issue (minor) -- in startElement(), the tag name comes through
> >in the localName parameter rather than the qName parameter. this is a
> >departure from all the DOM implementations i've used so far.
> >
> >second issue (major) -- the Android DOM doesn't allow me to add a
> >Text node as a child of an Attr. attribute values are conventionally
> >held as child nodes. setAttribute() isn't good enough, as i need to
> >be able to mix Text and EntityReference as siblings under Attr.
> >
> >if the Android DOM is just storing attribute values as strings, and
> >doesn't allow manipulation of the attribute's children (or maybe
> >there aren't any), then that's a fairly serious incompatibility IMHO.
> >
> >thanks for any help with this one
> >--
> >jason.software.particle
> >
> >
> >
> >
>
> --
> jason.software.particle
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to