NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #589 most downloaded on npm
An evented streaming XML parser in JavaScript
Last release 5 years ago
no release in 18 months
Ships unpredictably
gaps range from 8 days to 1.6 years
Some releases are documented
notes for 7 of 23 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
30 releases · first in 2018
Nothing published for this version
fixing linting errors for eslint 8
One column per quarter.
Nothing published for this version
<a name="5.0.0-rc.2"></a>
<a name="5.0.0-rc.1"></a>
disallow BOM characters at the beginning of subsequent chunks
on and off to set handlers. Upcoming features require
that saxes know when handlers are added and removed, and it may be necessary in
the future to qualify how to add or remove a handler. Getters/setters are too
restrictives so we bite the bullet now and move to actual methods.column field. If you need the old behavior of column you can use the new
columnIndex field which behaves like the old column and may be useful in
some contexts. Ultimately you should decide whether your application needs to
know column numbers by Unicode character count or by JavaScript index. (And you
need to know the difference between the two. You can see this
page for a detailed
discussion of the Unicode problem in JavaScript. Note that the numbers put in
the error messages that fail produce are still based on the column field
and thus use the new meaning of column. If you want error message that use
columnIndex you may override the fail method.<a name="4.0.2"></a>
<a name="4.0.1"></a>
<a name="4.0.0"></a>
Nothing published for this version
Nothing published for this version
<a name="4.0.0-rc.4"></a>
implement attribute normalization (be51114), closes #24
implement attribute normalization (6580844), closes #24
drop the originalNL flag in favor of a NL_LIKE fake character
<a name="4.0.0-rc.1"></a>
don't serialize the fileName as undefined: when not present
fileName is undefined in the parser options saxes does
not show a file name in error messages. Previously it was showing the name
undefined. To get the previous behavior, in all cases where you'd leave
fileName undefined, you must set it to the string "undefined" instead.<a name="3.1.11"></a>
<a name="3.1.10"></a>
<a name="3.1.9"></a>
<a name="3.1.8"></a>
<a name="3.1.7"></a>
<a name="3.1.6"></a>
<a name="3.1.5"></a>
<a name="3.1.4"></a>
<a name="3.1.3"></a>
<a name="3.1.2"></a>
<a name="3.1.1"></a>
<a name="3.1.0"></a>
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
add emitNodes to skip checking text buffer more than needed
name field (c7dffd5)<a name="3.0.0"></a>
process the xmlns attribute the customary way
xmlns (as in <foo xmlns="some-uri"> would
be reported as having the prefix "xmlns" and the local name "". This
behavior was inherited from sax. There was some logic to it, but this behavior
was surprising to users of the library. The principle of least surprise favors
eliminating that surprising behavior in favor of something less surprising.This commit makes it so that xmlns is not reported as having a prefix of ""
and a local name of "xmlns". This accords with how people interpret attribute
names like foo, bar, moo which all have no prefix and a local name.
Code that deals with namespace bindings or cares about xmlns probably needs to
be changed.
<a name="2.2.1"></a>
isNameChar for later chars in PI target (83d2b61)<a name="2.2.0"></a>
Nothing published for this version
### Features * add the resolvePrefix option
add support for parsing fragments
<a name="2.0.0"></a>
"X" is not a valid hex prefix for char references
parser function, rename SAXParser (0878a6c)strict argument anywhere. This also
effectively removes support for HTML processing, or allow processing
without errors anything which is less than full XML. It also removes
special processing of script elements.attribute is not a particularly useful event for parsing XML. The only thing
it adds over looking at attributes on tag objects is that you get the order of
the attributes from the source, but attribute order in XML is irrelevant.parser function is removed. Just create a new instance with
new.SAXParser is now SaxesParser. So new require("saxes").SaxesParser(...).
The API based on Stream is gone. There were multiple issues with it. It was Node-specific. It used an ancient Node API (the so-called "classic streams"). Its behavior was idiosyncratic.
Sax had no default error handler but if you wanted to continue calling
write() after an error you had to call resume(). We do away with
resume() and instead install a default onerror which throws. Replace
with a no-op handler if you want to continue after errors.
The "processinginstruction" now produces a "target" field instead of a "name" field. The nomenclature "target" is the one used in the XML literature.
ns field is no longer using the prototype trick that sax used. The
ns field of a tag contains only those namespaces that the tag declares.We no longer have opennamespace and closenamespace events. The
information they provide can be obtained by examining the tags passed to tag
events.
SGML declaration is not supported by XML. This is an XML parser. So we remove support for SGML declarations. They now cause errors.
We removed support for the code that checked buffer sizes and would
raise errors if a buffer was close to an arbitrary limit or emitted
multiple text or cdata events in order avoid passing strings
greater than an arbitrary size. So MAX_BUFFER_LENGTH is gone.
The feature always seemed a bit awkward. Client code could limit the
size of buffers to 1024K, for instance, and not get a text event
with a text payload greater than 1024K... so far so good but if the
same document contained a comment with more than 1024K that would
result in an error. Hmm.... why? The distinction seems entirely
arbitrary.
The upshot is that client code needs to be ready to handle strings of any length supported by the platform.
If there's a clear need to reintroduce it, we'll reassess.
script element. It needs building.The library now assumes a modern runtime. It no longer contains any code to polyfill what's missing. It is up to developers using this code to deal with polyfills as needed.
trim option. It is up to client code to trip text if
it needs it.normalize option. It is up to client code
to perform whatever normalization it wants.lowercase option makes no sense for XML. It is removed.In the process of making this change, we've removed support for the
on... properties on streams objects. Their existence was not
warranted by any standard API provided by Node. (EventEmitter does
not have on... properties for events it supports, nor does
Stream.) Their existence was also undocumented. And their
functioning was awkward. For instance, with sax, this:
const s = sax.createStream();
const handler = () => console.log("moo");
s.on("cdata", handler);
console.log(s.oncdata === handler);
would print false. If you examine s.oncdata you see it is glue
code instead of the handler assigned. This is just bizarre, so we
removed it.
Your coding agent can read these notes before it upgrades. Set up the MCP server →