/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This method will fail if no document
nsresult rv = encoder->NativeInit(
doc, u"application/xhtml+xml"_ns,
nsIDocumentEncoder::OutputRaw |
nsIDocumentEncoder::OutputDontRewriteEncodingDeclaration);
if (NS_FAILED(rv)) {
aRv.Throw(rv); return nullptr;
}
NS_ConvertUTF16toUTF8 charset(aCharset); if (charset.IsEmpty()) {
doc->GetDocumentCharacterSet()->Name(charset);
}
rv = encoder->SetCharset(charset); if (NS_FAILED(rv)) {
aRv.Throw(rv); return nullptr;
}
// If we are working on the entire document we do not need to // specify which part to serialize if (!entireDocument) {
rv = encoder->SetNode(&aRoot);
}
if (NS_FAILED(rv)) {
aRv.Throw(rv); return nullptr;
}
// The charset arg can be empty, in which case we get the document's // charset and use that when serializing.
// No point doing a CanCallerAccess check, because we can only be // called by system JS or C++.
nsCOMPtr<nsIDocumentEncoder> encoder = SetUpEncoder(aRoot, aCharset, aRv); if (aRv.Failed()) { return;
}
nsresult rv = encoder->EncodeToStream(aStream); if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.