Bug 191327, make internalSubset not include delimiting brackets (was not defined in DOM 2 but is now defined in DOM 3 drafts). Also fix bug 191482, external entity definitions should be included in internal subset. r=harishd, jst, sr=peterv.

This commit is contained in:
heikki%netscape.com 2003-03-07 23:40:51 +00:00
Родитель 873d778fa2
Коммит d6f0927520
5 изменённых файлов: 56 добавлений и 4000 удалений

Просмотреть файл

@ -281,11 +281,12 @@ nsXMLContentSerializer::AppendDoctype(nsIDOMDocumentType *aDoctype,
}
if (!internalSubset.IsEmpty()) {
AppendToString(PRUnichar(' '), aStr);
AppendToString(NS_LITERAL_STRING(" ["), aStr);
AppendToString(internalSubset, aStr);
AppendToString(PRUnichar(']'), aStr);
}
AppendToString(NS_LITERAL_STRING(">"), aStr);
AppendToString(PRUnichar('>'), aStr);
return NS_OK;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -530,9 +530,9 @@ nsExpatDriver::HandleEndDoctypeDecl()
// let the sink know any additional knowledge that we have about the document
// (currently, from bug 124570, we only expect to pass additional agent sheets
// needed to layout the XML vocabulary of the document)
nsIURI* data = nsnull;
nsCOMPtr<nsIURI> data;
if (mCatalogData && mCatalogData->mAgentSheet) {
NS_NewURI(&data, mCatalogData->mAgentSheet);
NS_NewURI(getter_AddRefs(data), mCatalogData->mAgentSheet);
}
nsAutoString name;
@ -548,15 +548,26 @@ nsExpatDriver::HandleEndDoctypeDecl()
GetDocTypeToken(mDoctypeText, systemId, PR_TRUE);
}
// The rest is the internal subset (minus whitespace)
// The rest is the internal subset with [] (minus whitespace)
mDoctypeText.Trim(kWhitespace);
// Take out the brackets too, if any
if (mDoctypeText.Length() > 2) {
const nsAString& internalSubset = Substring(mDoctypeText, 1,
mDoctypeText.Length() - 2);
mInternalState = mSink->HandleDoctypeDecl(internalSubset,
name,
systemId,
publicId,
data);
} else {
// There's nothing but brackets, don't include them
mInternalState = mSink->HandleDoctypeDecl(nsString(),// !internalSubset
name,
systemId,
publicId,
data);
}
mInternalState = mSink->HandleDoctypeDecl(mDoctypeText,
name,
systemId,
publicId,
data);
NS_IF_RELEASE(data);
}
mDoctypeText.SetCapacity(0);
@ -570,6 +581,12 @@ nsExpatDriver::HandleExternalEntityRef(const PRUnichar *openEntityNames,
const PRUnichar *systemId,
const PRUnichar *publicId)
{
if (mInDoctype && !mInExternalDTD && openEntityNames) {
mDoctypeText.Append(PRUnichar('%'));
mDoctypeText.Append(nsDependentString(openEntityNames));
mDoctypeText.Append(PRUnichar(';'));
}
int result = 1;
// Load the external entity into a buffer

Просмотреть файл

@ -2713,7 +2713,7 @@ doProlog(XML_Parser parser,
dtd.complete = 0;
entity->open = 1;
if (!externalEntityRefHandler(externalEntityRefHandlerArg,
0,
entity->name, /* Mozilla bug 191482 */
entity->base,
entity->systemId,
entity->publicId)) {

Просмотреть файл

@ -530,9 +530,9 @@ nsExpatDriver::HandleEndDoctypeDecl()
// let the sink know any additional knowledge that we have about the document
// (currently, from bug 124570, we only expect to pass additional agent sheets
// needed to layout the XML vocabulary of the document)
nsIURI* data = nsnull;
nsCOMPtr<nsIURI> data;
if (mCatalogData && mCatalogData->mAgentSheet) {
NS_NewURI(&data, mCatalogData->mAgentSheet);
NS_NewURI(getter_AddRefs(data), mCatalogData->mAgentSheet);
}
nsAutoString name;
@ -548,15 +548,26 @@ nsExpatDriver::HandleEndDoctypeDecl()
GetDocTypeToken(mDoctypeText, systemId, PR_TRUE);
}
// The rest is the internal subset (minus whitespace)
// The rest is the internal subset with [] (minus whitespace)
mDoctypeText.Trim(kWhitespace);
// Take out the brackets too, if any
if (mDoctypeText.Length() > 2) {
const nsAString& internalSubset = Substring(mDoctypeText, 1,
mDoctypeText.Length() - 2);
mInternalState = mSink->HandleDoctypeDecl(internalSubset,
name,
systemId,
publicId,
data);
} else {
// There's nothing but brackets, don't include them
mInternalState = mSink->HandleDoctypeDecl(nsString(),// !internalSubset
name,
systemId,
publicId,
data);
}
mInternalState = mSink->HandleDoctypeDecl(mDoctypeText,
name,
systemId,
publicId,
data);
NS_IF_RELEASE(data);
}
mDoctypeText.SetCapacity(0);
@ -570,6 +581,12 @@ nsExpatDriver::HandleExternalEntityRef(const PRUnichar *openEntityNames,
const PRUnichar *systemId,
const PRUnichar *publicId)
{
if (mInDoctype && !mInExternalDTD && openEntityNames) {
mDoctypeText.Append(PRUnichar('%'));
mDoctypeText.Append(nsDependentString(openEntityNames));
mDoctypeText.Append(PRUnichar(';'));
}
int result = 1;
// Load the external entity into a buffer