SAX: finalising org.sax.xml.Parser
Juergen Modre
jmodre at edu.uni-klu.ac.at
Wed Feb 25 15:08:56 GMT 1998
David Megginson wrote:
> This is a very good point, as was the suggestion earlier (I don't
> remember whose it was) that we rearrange arguments in order of
> decreasing importance to the programmer.
I think it was Don Park and I also like it.
> With those suggestions in
> mind, here's my current take on org.xml.sax.Parser:
>
> package org.xml.sax;
>
> public interface Parser {
>
> public abstract void setEntityHandler (EntityHandler handler);
> public abstract void setDocumentHandler (DocumentHandler handler);
> public abstract void setErrorHandler (ErrorHandler handler);
>
> public abstract void parse (String systemId, String publicId)
> throws java.lang.Exception;
>
> public abstract void parse (InputStream input, String encoding,
> String systemId, String publicId)
> throws java.lang.Exception;
>
> }
I think Don's suggestion was also to have it like
public abstract void parse (String systemId, String publicId, String encoding, InputStream
input)
so that the first parameter part is always the same.
So if another constructor will be added only the the last parameter will differ.
> I haven't included a setValidate() method yet, partly because I'm not
> certain what it would really mean. If I did
>
> setValidate(false);
>
> would that simply prevent the reporting of validation errors, or would
> it also prohibit the parser from resolving external text entities and
> the external DTD subset?
It should have the following meaning:
- setValidate(false);
That the document/stream should be parsed for well-formedness.
This should also be the default if nothing was set with the setValidate() method.
- setValidate(true);
That the document/stream should also be validated during parsing.
The question where there is exactly the border between well-formedness
parsing and validation parsing should be left to the parser. This border
can be found in the XML spec.
The SAX interface is/should be useable for both classes of XML parsers
and give also the possibility to enable/disable validation.
But I agree that it is sometimes not easy to see the clear border
between well-formedness parsing and validation parsing in the XML spec.
All the best
Juergen
-----------------------------------------------
JUERGEN MODRE
Reisdorf 6
A-9371 Brueckl
Austria (Europe)
Phone: ++43 4214 2320
Mobile: ++43 664 233 22 22
E-mail: jmodre at edu.uni-klu.ac.at
WWW: http://www.edu.uni-klu.ac.at/~jmodre
-----------------------------------------------
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list