W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1999

Re: Methods Request

From: <keshlam@us.ibm.com>
Date: Fri, 19 Nov 1999 09:24:37 -0500
To: Andrew n marshall <amarshal@zig.usc.edu>
cc: www-dom@w3c.org
Message-ID: <8525682E.004F2748.00@D51MTA03.pok.ibm.com>
Serialization of a DOM to XML syntax is one of the topics under
consideration for DOM Level 3. I don't know if anyone has considered
whether that should be able to generate the start and end tags separately
as well as rendering a complete subtree; that's probably worth considering.

You _can_ "recreate an empty element" from the DOM; it just requires having
your XML-syntax generator check whether the node has children or not.
Pseudocode for your proposed functions:

     getStartTag(Element e)
               print "<"+e.getNodeName+" "+printAttributes(e)+">"
               print "<"+e.getNodeName+" "+printAttributes(e)+" />"

     getEndTag(Element e)
               print "</"+e.getNodeName+">"

What you can't do is distinguish between the two ways of writing an empty
element: <foo></foo> and <foo/>. According to the XML spec, these are
semantically identical, and the DOM doesn't maintain the distinction
between them.

Joe Kesselman  / IBM Research
Received on Friday, 19 November 1999 09:24:52 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:06 UTC