void CollisionShapeManager::SaveShapesToXMLFile(const String& FileName, ShapeVector& ShapesToSave) { XML::Document ShapesDoc; XML::Node DeclNode = ShapesDoc.AppendChild(XML::NodeDeclaration); XML::Attribute VerAttrib = DeclNode.AppendAttribute("version"); if( DeclNode.SetName("xml") && VerAttrib.SetValue("1.0") ) { XML::Node ShapesRoot = ShapesDoc.AppendChild( "ShapesRoot" ); for( ShapeVectorIterator ShapeIt = ShapesToSave.begin() ; ShapeIt != ShapesToSave.end() ; ++ShapeIt ) { (*ShapeIt)->ProtoSerialize( ShapesRoot ); } /// @todo Replace this stack allocated stream for one initialized from the Resource Manager, after the system is ready. Resource::FileStream SettingsStream(FileName,".",Resource::SF_Truncate | Resource::SF_Write); ShapesDoc.Save(SettingsStream,"\t",XML::FormatIndent); }else{ MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"Failed to create XML document declaration for file \"" + FileName + "\"."); } }