JavaScript XML Parser

Peter Murray-Rust peter at
Thu Jan 1 10:33:31 GMT 1998

At 15:39 31/12/97 -0600, Jeremie Miller wrote:
>Well, I finally decided to take the plunge and learn XML.  As a learning
>project, I decided to write a simple XML parser in JavaScript(ECMAScript).

Excellent.  I think this is the first tool in ECMAScript reported on this
list. ECMAScript is likely to play an important role in XML, since it is
specifically mentioned in the current **draft** for XSL (the stylesheet
specification). Experience will be very valuable.  Is it too optimistic to
think that it may be possible to build up a library of XML-E routines?

>As it exists now, it doesn't handle many of the more advanced parts of the
>spec(PI's, CDATA, etc...) and is only trying to be a read-only well-formed

There is a real requirement for just such an application. Many of this
year's XML documents will *not* have CDATA, NOTATION, PIs, DTDs, and
entities. A question that we have to face soon is whether every parser/tool
has to cater for everything in the spec. If not, how can such a parser
gracefully handle a document beyond its capabilities?  One way might be to
have a heavier-weight tool lurking in the background, to be called only
when help was needed.
>I feel its to a point where I can let others play with it and need some good
>feedback on it.  But remember, I have not even read the XML recommendation
>more than a light glance-through, so the parser it fairly limited yet.  The
>point of it is to take XML fragments and expose them as a parsed object-tree
>to other javascripts for manipulation/display.  Its ~5k, its fast, and it
>works with any ECMAScript compliant browser(I hope).

These are excellent objectives.  IMO it is critical that the XML community
makes it easy for you and others to take this approach.  In support of this
most of the "real" examples of XML use a subset of the functionality and it
would be interesting to see what percentage you can manage.  If much XML
becomes de facto DTD-less SGML, then there is a lot you don't have to worry
>It will get updated often as I have time to read the spec and to learn more
>about DTD's.
>Go play at:
>I really need some constructive feedback about what it needs to do, the API,
>possible uses for it, etc...

It could be extremely valuable to include ECMAScript in the API
discussions. We are currently addressing how to generate a "simple" API for
XML. We have an offer of a language-independent IDL - can ECMAScript APIs
be generated from such an API (I expect the answer is yes).

>Thanks!  This list has been a very educational tool so far!  As I learn
>more, you'll probably be seeing more of me :)

Excellent.  IMO any *communal* resources that you can catalyse will be very
valuable. Up till now I have been wary of JavaScript, but as ECMAScript
becomes more robust and portable, communal XML-E resources will be very
valuable. Possibly more valuable even than Java...


Peter Murray-Rust, Director Virtual School of Molecular Sciences, domestic
net connection
VSMS, Virtual Hyperglossary

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as:
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list