本文整理汇总了C++中NodeImpl::close方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeImpl::close方法的具体用法?C++ NodeImpl::close怎么用?C++ NodeImpl::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeImpl
的用法示例。
在下文中一共展示了NodeImpl::close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: endElement
bool XMLHandler::endElement(const QString & /*namespaceURI*/, const QString & /*localName*/, const QString & /*qName*/)
{
if(currentNode()->nodeType() == Node::TEXT_NODE)
exitText();
NodeImpl *node = popNode();
if(node)
{
node->close();
while(currentNode() && currentNode()->implicitNode()) // for the implicit HTMLTableSectionElementImpl
popNode()->close();
}
else
return false;
return true;
}
示例2: finish
void XMLTokenizer::finish()
{
m_source.setFinished(true);
if(!m_noErrors)
{
// An error occurred during parsing of the code. Display an error page to the user (the DOM
// tree is created manually and includes an excerpt from the code where the error is located)
// ### for multiple error messages, display the code for each (can this happen?)
// Clear the document
int exceptioncode = 0;
while(m_doc->hasChildNodes())
static_cast< NodeImpl * >(m_doc)->removeChild(m_doc->firstChild(), exceptioncode);
QString line, errorLocPtr;
if(m_handler.errorLine)
{
QString xmlCode = m_source.data();
QTextIStream stream(&xmlCode);
for(unsigned long lineno = 0; lineno < m_handler.errorLine - 1; lineno++)
stream.readLine();
line = stream.readLine();
for(unsigned long colno = 0; colno < m_handler.errorCol - 1; colno++)
errorLocPtr += " ";
errorLocPtr += "^";
}
// Create elements for display
DocumentImpl *doc = m_doc;
NodeImpl *html = doc->createElementNS(XHTML_NAMESPACE, "html");
NodeImpl *body = doc->createElementNS(XHTML_NAMESPACE, "body");
NodeImpl *h1 = doc->createElementNS(XHTML_NAMESPACE, "h1");
NodeImpl *headingText = doc->createTextNode(i18n("XML parsing error"));
NodeImpl *errorText = doc->createTextNode(m_handler.errorProtocol());
NodeImpl *hr = 0;
NodeImpl *pre = 0;
NodeImpl *lineText = 0;
NodeImpl *errorLocText = 0;
if(!line.isNull())
{
hr = doc->createElementNS(XHTML_NAMESPACE, "hr");
pre = doc->createElementNS(XHTML_NAMESPACE, "pre");
lineText = doc->createTextNode(line + "\n");
errorLocText = doc->createTextNode(errorLocPtr);
}
// Construct DOM tree. We ignore exceptions as we assume they will not be thrown here (due to the
// fact we are using a known tag set)
doc->appendChild(html, exceptioncode);
html->appendChild(body, exceptioncode);
if(body)
body->appendChild(h1, exceptioncode);
h1->appendChild(headingText, exceptioncode);
body->appendChild(errorText, exceptioncode);
body->appendChild(hr, exceptioncode);
body->appendChild(pre, exceptioncode);
if(pre)
{
pre->appendChild(lineText, exceptioncode);
pre->appendChild(errorLocText, exceptioncode);
}
// Close the renderers so that they update their display correctly
// ### this should not be necessary, but requires changes in the rendering code...
h1->close();
if(pre)
pre->close();
body->close();
m_doc->recalcStyle(NodeImpl::Inherit);
m_doc->updateRendering();
end();
}
else
{
// Parsing was successful. Now locate all html <script> tags in the document and execute them
// one by one
addScripts(m_doc);
m_scriptsIt = new QPtrListIterator< HTMLScriptElementImpl >(m_scripts);
executeScripts();
}
}