OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Breadth-First XML Serialization

[ Lists Home | Date Index | Thread Index ]
  • To: xml-dev@lists.xml.org
  • Subject: Breadth-First XML Serialization
  • From: Simon Kissane <skissane@gmail.com>
  • Date: Wed, 8 Dec 2004 19:10:02 +1100
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=BdN9BJQ5AOFK5k0GNMjkH15AZfsj7fqAfpJL4cOZ206ntQ5T199DYoMix6oqJJQ1Il+XVFD/y3Jz+JQbXUCnwS07cAMSDMHL+ElIxoXuT2OxZagiNw4u1mSr6M7sl44+Z54Otqr3YoGnbunU40PaWIZjX/sUUolwdEPMQaL4RHE=
  • Reply-to: Simon Kissane <skissane@gmail.com>


The standard text-based XML serialization is depth-first. So, for
example, if the tree structure of my document is:
|--- ElementA
|         |- ElementB1
|         |         |- "Some text"
|         |- ElementB2
|---- ElementC

The standard depth-first XML serialization looks like:
<ElementA><ElementB1>Some text</ElementB1><ElementB2/></ElementA>
<ElementC><ElementD /></ElementC>

But a breadth-first serialization could be something like:
1 0 Root
2 1 ElementA
3 1 ElementC
4 2 ElementB1
5 2 ElementB2
6 3 ElementD
7 4 "Some text"
where the first number is the number of the DOM node in breadth-first
document order, and the second number is the number of the parent DOM

Such a serialization might be useful in some cases. Suppose for
example I have a huge XHTML document, with Javascript enabling
drill-down to show/hide sections and subsections of the document, and
initially all the sections are hidden. Using the standard depth-first
serialization, I have to wait until the whole document loads to see
the entirety of the top-level, whereas with a breadth-first
serialization I could see the top-level immediately.

More generally, one could imagine a transfer mechanism for XML which
enabled the application to prioritise part of the DOM tree. So, for
example, I click the "expand" button the last section of my huge HTML
document, while it is loading. The renderering engine now needs to
know what is under that node urgently. So it could send a request to
the server saying "send DOM nodes under this node urgently, then keep
on sending me the rest." The server would interrupt its normal
transfer order to send those DOM nodes straight away, and then would
resume sending the document as usual.

Simon Kissane

Simon Kissane


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS