mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1416038 (part 6) - Slim down nsISAXContentHandler. r=erahm
This patch removes three methods that are no-ops (or missing) in all our implementations. --HG-- extra : rebase_source : e29b4cfbbc71d549744fcfd6481c449231316c1d
This commit is contained in:
parent
d8552a4ef9
commit
c33420edb2
@ -134,9 +134,11 @@ interface nsISAXContentHandler : nsISupports
|
||||
* the same external entity so that the Locator provides useful
|
||||
* information.
|
||||
*
|
||||
* Note that some parsers will report whitespace in element
|
||||
* Note that some parsers would report whitespace in element
|
||||
* content using the ignorableWhitespace method rather than this one
|
||||
* (validating parsers must do so).
|
||||
* (validating parsers must do so). But this interface no longer has an
|
||||
* ignorableWhitespace method, so in that case such whitespace is not
|
||||
* reported at all.
|
||||
*
|
||||
* @param value the characters from the XML document
|
||||
*/
|
||||
@ -159,67 +161,4 @@ interface nsISAXContentHandler : nsISupports
|
||||
* whitespace separating it from the target
|
||||
*/
|
||||
void processingInstruction(in AString target, in AString data);
|
||||
|
||||
/**
|
||||
* Receive notification of ignorable whitespace in element content.
|
||||
*
|
||||
* Validating Parsers must use this method to report each chunk of
|
||||
* whitespace in element content (see the W3C XML 1.0
|
||||
* recommendation, section 2.10): non-validating parsers may also
|
||||
* use this method if they are capable of parsing and using content
|
||||
* models.
|
||||
*
|
||||
* SAX parsers may return all contiguous whitespace in a single
|
||||
* chunk, or they may split it into several chunks; however, all of
|
||||
* the characters in any single event must come from the same
|
||||
* external entity, so that the Locator provides useful information.
|
||||
*
|
||||
* @param whitespace the characters from the XML document
|
||||
*/
|
||||
void ignorableWhitespace(in AString whitespace);
|
||||
|
||||
/**
|
||||
* Begin the scope of a prefix-URI Namespace mapping.
|
||||
*
|
||||
* The information from this event is not necessary for normal
|
||||
* Namespace processing: the SAX XML reader will automatically
|
||||
* replace prefixes for element and attribute names when the
|
||||
* http://xml.org/sax/features/namespaces feature is
|
||||
* true (the default).
|
||||
*
|
||||
* There are cases, however, when applications need to use prefixes
|
||||
* in character data or in attribute values, where they cannot
|
||||
* safely be expanded automatically; the start/endPrefixMapping
|
||||
* event supplies the information to the application to expand
|
||||
* prefixes in those contexts itself, if necessary.
|
||||
*
|
||||
* Note that start/endPrefixMapping events are not guaranteed to be
|
||||
* properly nested relative to each other: all startPrefixMapping
|
||||
* events will occur immediately before the corresponding
|
||||
* startElement event, and all endPrefixMapping events will occur
|
||||
* immediately after the corresponding endElement event, but their
|
||||
* order is not otherwise guaranteed.
|
||||
*
|
||||
* There should never be start/endPrefixMapping events for the
|
||||
* "xml" prefix, since it is predeclared and immutable.
|
||||
*
|
||||
* @param prefix The Namespace prefix being declared. An empty
|
||||
* string is used for the default element namespace,
|
||||
* which has no prefix.
|
||||
* @param uri The Namespace URI the prefix is mapped to.
|
||||
*/
|
||||
void startPrefixMapping(in AString prefix, in AString uri);
|
||||
|
||||
/**
|
||||
* End the scope of a prefix-URI mapping.
|
||||
*
|
||||
* See startPrefixMapping for details. These events will always
|
||||
* occur immediately after the corresponding endElement event, but
|
||||
* the order of endPrefixMapping events is not otherwise guaranteed.
|
||||
*
|
||||
* @param prefix The prefix that was being mapped. This is the empty
|
||||
* string when a default mapping scope ends.
|
||||
*/
|
||||
void endPrefixMapping(in AString prefix);
|
||||
//XXX documentLocator
|
||||
};
|
||||
|
@ -177,29 +177,13 @@ NS_IMETHODIMP
|
||||
nsSAXXMLReader::HandleStartNamespaceDecl(const char16_t *aPrefix,
|
||||
const char16_t *aUri)
|
||||
{
|
||||
if (!mContentHandler)
|
||||
return NS_OK;
|
||||
|
||||
char16_t nullChar = char16_t(0);
|
||||
if (!aPrefix)
|
||||
aPrefix = &nullChar;
|
||||
if (!aUri)
|
||||
aUri = &nullChar;
|
||||
|
||||
return mContentHandler->StartPrefixMapping(nsDependentString(aPrefix),
|
||||
nsDependentString(aUri));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSAXXMLReader::HandleEndNamespaceDecl(const char16_t *aPrefix)
|
||||
{
|
||||
if (!mContentHandler)
|
||||
return NS_OK;
|
||||
|
||||
if (aPrefix)
|
||||
return mContentHandler->EndPrefixMapping(nsDependentString(aPrefix));
|
||||
|
||||
return mContentHandler->EndPrefixMapping(EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -51,22 +51,11 @@ function updateDocumentSourceMaps(source) {
|
||||
do_parse_check(aNodeName, "Missing element node name (endElement)");
|
||||
},
|
||||
|
||||
inCDataSection: false,
|
||||
|
||||
characters: function characters(aData) {
|
||||
},
|
||||
|
||||
processingInstruction: function processingInstruction(aTarget, aData) {
|
||||
do_parse_check(aTarget, "Missing processing instruction target");
|
||||
},
|
||||
|
||||
ignorableWhitespace: function ignorableWhitespace(aWhitespace) {
|
||||
},
|
||||
|
||||
startPrefixMapping: function startPrefixMapping(aPrefix, aURI) {
|
||||
},
|
||||
|
||||
endPrefixMapping: function endPrefixMapping(aPrefix) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -934,10 +934,6 @@ XHTMLHandler.prototype = {
|
||||
characters: function XH_characters(data) {
|
||||
this._buf += xmlEscape(data);
|
||||
},
|
||||
startPrefixMapping: function XH_startPrefixMapping(prefix, uri) {
|
||||
},
|
||||
endPrefixMapping: function FP_endPrefixMapping(prefix) {
|
||||
},
|
||||
processingInstruction: function XH_processingInstruction() {
|
||||
},
|
||||
};
|
||||
@ -992,10 +988,6 @@ ExtensionHandler.prototype = {
|
||||
if (!this._hasChildElements)
|
||||
this._buf += data;
|
||||
},
|
||||
startPrefixMapping: function EH_startPrefixMapping() {
|
||||
},
|
||||
endPrefixMapping: function EH_endPrefixMapping() {
|
||||
},
|
||||
processingInstruction: function EH_processingInstruction() {
|
||||
},
|
||||
};
|
||||
@ -1465,14 +1457,6 @@ FeedProcessor.prototype = {
|
||||
characters: function FP_characters(data) {
|
||||
this._buf += data;
|
||||
},
|
||||
// TODO: It would be nice to check new prefixes here, and if they
|
||||
// don't conflict with the ones we've defined, throw them in a
|
||||
// dictionary to check.
|
||||
startPrefixMapping: function FP_startPrefixMapping(prefix, uri) {
|
||||
},
|
||||
|
||||
endPrefixMapping: function FP_endPrefixMapping(prefix) {
|
||||
},
|
||||
|
||||
processingInstruction: function FP_processingInstruction(target, data) {
|
||||
if (target == "xml-stylesheet") {
|
||||
|
Loading…
Reference in New Issue
Block a user