コード例 #1
0
	//---------------------------------------------------------------
	void StreamWriter::closeElements( ElementIndexType elementIndex )
	{
		// we need to determine how many elements need to be close
		// we search from the end until we find the first element index  <= elementIndex and count the elements
		// If this is == elementIndex, we need close elmentsToClose elements
		// If it is < elementIndex, the element has been close before, nothing to do 
		ElementIndexType elmentsToClose = 0;
		OpenTagStack::reverse_iterator it = mOpenTags.rbegin();
		for ( ; it != mOpenTags.rend(); ++it)
		{
			elmentsToClose++;
			const ElementIndexType& currentTagIndex = it->mElementIndex;
			if ( currentTagIndex < elementIndex)
			{
				// the element is not in the stack, i.e. has already been closed
				return;
			}
			if ( currentTagIndex == elementIndex)
			{
				// we need to close elmentsToClose elements
				for ( ElementIndexType i = 0; i < elmentsToClose; ++i)
				{
					closeElement();
				}
				return;
			}
		}
		// if we reach this point, the searched element is not in the stack, i.e. already, nothing to do
	}
コード例 #2
0
void XMLTreeBuilder::processStartTag(const AtomicXMLToken& token)
{
    exitText();

    bool isFirstElement = !m_sawFirstElement;
    m_sawFirstElement = true;

    NodeStackItem top = m_currentNodeStack.last();

    processNamespaces(token, top);

    QualifiedName qName(token.prefix(), token.name(), top.namespaceForPrefix(token.prefix(), top.namespaceURI()));
    RefPtr<Element> newElement = m_document->createElement(qName, true);

    processAttributes(token, top, newElement);

    newElement->beginParsingChildren();
    m_currentNodeStack.last().node()->parserAddChild(newElement.get());

    top.setNode(newElement);
    pushCurrentNode(top);

    if (!newElement->attached())
        newElement->attach();

    if (isFirstElement && m_document->frame())
        m_document->frame()->loader()->dispatchDocumentElementAvailable();

    if (token.selfClosing())
        closeElement(newElement);
}
コード例 #3
0
void XMLTreeBuilder::processEndTag(const AtomicXMLToken& token)
{
    exitText();

    RefPtr<ContainerNode> node = m_currentNodeStack.last().node();

    if (!node->hasTagName(QualifiedName(token.prefix(), token.name(), m_currentNodeStack.last().namespaceForPrefix(token.prefix(), m_currentNodeStack.last().namespaceURI()))))
        m_parser->stopParsing();

    closeElement(toElement(node.get()));
}
コード例 #4
0
 //---------------------------------------------------------------
 void StreamWriter::appendTextElement ( const String& elementName, const String& text )
 {
     openElement ( elementName );
     appendText ( COLLADABU::StringUtils::translateToXML(text) );
     closeElement();
 }
コード例 #5
0
 //---------------------------------------------------------------
 void StreamWriter::endDocument()
 {
     while ( !mOpenTags.empty() )
         closeElement();
 }
コード例 #6
0
    //---------------------------------------------------------------
    void StreamWriter::appendURIElement ( const String& elementName, const COLLADABU::URI& uri )
    {
        openElement ( elementName );
		appendText ( COLLADABU::StringUtils::translateToXML(uri.getURIString()) );
        closeElement();
    }
コード例 #7
0
void PrefabPlant::closeElement( const wstring & prefix, const wstring & name )
{
	closeElement(name);
}