comp.text.xml
[Top] [All Lists]

Re: SAX Parser for creating (not parsing) XML document

Subject: Re: SAX Parser for creating (not parsing) XML document
From: Tony Lavinio
Date: Tue, 22 Jul 2008 09:16:29 -0400
Newsgroups: comp.text.xml


Stefan Ram wrote:
Martin Honnen <mahotrash@xxxxxxxx> writes:
Java 6 has XMLStreamWriter

  Often, people use »tag« for »element«.

  Here, it seems to be the other way round:

xtw.writeStartElement("http://www.w3.org/TR/REC-html40";, "a");
xtw.writeAttribute("href", "                                www.java2s.com"">http://www.java2s.com";);
xtw.writeCharacters("here");
xtw.writeEndElement();

  . It seems as »writeEndElement« is supposed
  to write the end /tag/, i.e., "</a>".

  So, more correct names to me would be:

      »writeEndTag()«,
      »writeEndOfElement()«, or
      »writeElementEnding()«.

You're not writing tags with this, you're writing /events/.

So writeStartElement means you are sending the StartElement
/event/ into the stream.  writeEndElement means you are
sending the EndElement /event/ into the stream.

When using XMLStreamWriter, you must remember that you are
acting as the parser.


--
Tony Lavinio <> DataDirect <> Stylus Studio XML <> alavinio@xxxxxxxxxxxx
XQuery, XSLT, XML Schema and EDI Toolset <>                                 www.stylusstudio.com/">http://www.stylusstudio.com/
<> There is no problem that brute force and ignorance cannot overcome <>

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy