[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Fast text output from SAX?


tag length value
Rick Marshall wrote:
> if you use a binary format how do you know
> the end of the data is the end of the data?
	Depends on the format. There are a couple of different ways to
do this...
	1. Use "tag-length-value" encodings. i.e. each element is
preceded by a tag and a length. Since you know the length, you know
where the value ends. Of course, there is no problem with nesting
elements -- you just increase the length of the outer tags. This is
real nice for fast parsing since you never have to scan for an "end
tag." You always know the size of the elements you are reading.
	2. Use start/stop tags. i.e. define something that serves like
a null value does in null-terminated strings. You insert that value
into the binary and then scan for it. (This is less efficient but
works well when your lengths are not known when you start an element
-- you might be streaming)
	3. Use schema data to figure it out. i.e. if I have a
structure of n integers and each integer takes four bytes, then assume
that the structure ends after n*4 bytes. (This can be fragile...)

On determining well-formedness:
	It all depends. The range of solutions is probably too large
to iterate through in something short of a text book.

> it wasn't until agreement was reached on 8 bit
> bytes that a lot of processor design could take off
	I think you have just alienated all the PDP-8, 10, and 20
programmers who thought that 6 bits was just fine. You can still run
across ex-PDP/8 assembly programmers who will wax on poetic about the
beauty of that instruction set...

		bob wyman


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.