Re: xxxML on top of, embedded in XML

Richard Cohn writes:

 > >As I mentioned above, the DOM is a solution to a specific problem.
 > >Every XML document implies some kind of object model -- sometimes (as
 > >in the case of a technical manual, a poem, or a novel), the DOM will
 > >be a very good match; other times (as in the cases of serialised
 > >components, vector graphics, or an XSL stylesheet), the DOM will be
 > >too far from the optimal object model.
 > 
 > Agreed, but just as the HTML DOM builds on the Core DOM, it will be useful
 > for the PGML DOM to build on common functionality.

This could turn out to be a very good solution in some cases -- I do
not know PGML well enough to judge.

More generally, though, imagine a document consisting of, say, 50
million records like these (normally, the structure should be a little
more robust):

  <contact>
    <name>David Megginson</name>
    <email>dmeggins@microstar.com</email>
    <nationality>Canadian</nationality>
    <date-of-birth>
      <year>1964</year>
      <month>November</month>
      <day>18</day>
    </date-of-birth>
    <education>Ph.D. (University of Toronto)</education>
  </contact>

It is fairly efficient to put these straight into a customised Contact
object:

  public class Contact {
    public String name;
    public String email;
    public int nationality; // assuming constants defined somewhere
    public int birth-year;
    public int birth-month;
    public int birth-day;
    public String education;
  }
  
Building a DOM as an intermediate step would make little sense, since
you would generate a painfully large number of nodes for each record
(instead of just one Contact object with a couple of strings).


All the best,


David

-- 
David Megginson                 ak117@freenet.carleton.ca
Microstar Software Ltd.         dmeggins@microstar.com
      http://home.sprynet.com/sprynet/dmeggins/

Received on Friday, 1 May 1998 12:53:31 UTC