void TiXmlElement::StreamOut( TIXML_OSTREAM * stream ) const { (*stream) << TEXT("<") << value; TiXmlAttribute* attrib; for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() ) { (*stream) << TEXT(" "); attrib->StreamOut( stream ); } // If this node has children, give it a closing tag. Else // make it an empty tag. TiXmlNode* node; if ( firstChild ) { (*stream) << TEXT(">"); for ( node = firstChild; node; node=node->NextSibling() ) { node->StreamOut( stream ); } (*stream) << TEXT("</") << value << TEXT(">"); } else { (*stream) << TEXT(" />"); } }
void TiXmlElement::StreamOut( TIXML_OSTREAM * stream, bool unclosed ) const { (*stream) << "<" << value; const TiXmlAttribute* attrib; for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() ) { (*stream) << " "; attrib->StreamOut( stream ); } // If this node has children, give it a closing tag. Else // make it an empty tag. TiXmlNode* node; if ( firstChild ) { (*stream) << ">"; for ( node = firstChild; node; node=node->NextSibling() ) { node->StreamOut( stream ); } (*stream) << (unclosed ? "<" : "</") << value << ">"; } else { if ( unclosed ) (*stream) << " >"; else (*stream) << " />"; } }
void TiXmlDocument::StreamOut( TIXML_OSTREAM * out ) const { TiXmlNode* node; for ( node=FirstChild(); node; node=node->NextSibling() ) { node->StreamOut( out ); // Special rule for streams: stop after the root element. // The stream in code will only read one element, so don't // write more than one. if ( node->ToElement() ) break; } }