本文整理汇总了C++中nsCOMPtr::GetDTD方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::GetDTD方法的具体用法?C++ nsCOMPtr::GetDTD怎么用?C++ nsCOMPtr::GetDTD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::GetDTD方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSpec
NS_IMETHODIMP
txStylesheetSink::OnDataAvailable(nsIRequest *aRequest, nsISupports *aContext,
nsIInputStream *aInputStream,
uint64_t aOffset, uint32_t aCount)
{
if (!mCheckedForXML) {
nsCOMPtr<nsIDTD> dtd;
mParser->GetDTD(getter_AddRefs(dtd));
if (dtd) {
mCheckedForXML = true;
if (!(dtd->GetType() & NS_IPARSER_FLAG_XML)) {
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
nsAutoString spec;
getSpec(channel, spec);
mCompiler->cancel(NS_ERROR_XSLT_WRONG_MIME_TYPE, nullptr,
spec.get());
return NS_ERROR_XSLT_WRONG_MIME_TYPE;
}
}
}
return mListener->OnDataAvailable(aRequest, mParser, aInputStream,
aOffset, aCount);
}
示例2: if
NS_IMETHODIMP
txStylesheetSink::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext,
nsresult aStatusCode)
{
bool success = true;
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aRequest);
if (httpChannel) {
httpChannel->GetRequestSucceeded(&success);
}
nsresult result = aStatusCode;
if (!success) {
// XXX We sometimes want to use aStatusCode here, but the parser resets
// it to NS_ERROR_NOINTERFACE because we don't implement
// nsIHTMLContentSink.
result = NS_ERROR_XSLT_NETWORK_ERROR;
}
else if (!mCheckedForXML) {
nsCOMPtr<nsIDTD> dtd;
mParser->GetDTD(getter_AddRefs(dtd));
if (dtd && !(dtd->GetType() & NS_IPARSER_FLAG_XML)) {
result = NS_ERROR_XSLT_WRONG_MIME_TYPE;
}
}
if (NS_FAILED(result)) {
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
nsAutoString spec;
getSpec(channel, spec);
mCompiler->cancel(result, nullptr, spec.get());
}
nsresult rv = mListener->OnStopRequest(aRequest, mParser, aStatusCode);
mListener = nullptr;
mParser = nullptr;
return rv;
}