//---------------------------------------------------------------
    void StreamWriter::appendURIAttribute ( const String &name, const COLLADABU::URI &uri )
    {
        COLLADABU_ASSERT ( !mOpenTags.back().mHasContents );

		appendChar ( ' ' );
		appendNCNameString ( name );
		appendChar ( '=' );
		appendChar ( '\"' );
		appendString ( COLLADABU::StringUtils::translateToXML(uri.getURIString()) );
		appendChar ( '\"' );
    }
    //---------------------------------------------------------------
    void StreamWriter::appendURIElement ( const String& elementName, const COLLADABU::URI& uri )
    {
        openElement ( elementName );
		appendText ( COLLADABU::StringUtils::translateToXML(uri.getURIString()) );
        closeElement();
    }
    // ------------------------------
    MStatus FileTranslator::importFromFile ( const String& importFileName )
    {
        MStatus status = MS::kSuccess;

        // Get the time 
        clock_t startClock, endClock;
        startClock = clock();

        // TODO Ask the user where to save the maya file.
//         MString command = "fileBrowserDialog -m 0 -fc \"importFromFile\" -ft \"mayaAscii\" -fl \"*.ma\" -an \"Save_import_as\" -om \"SaveAs\"";
//         MString mayaAsciiFileNameM = MGlobal::executeCommandStringResult ( command );
//         String mayaAsciiFileName ( mayaAsciiFileNameM.asChar () );
//         MGlobal::displayInfo ( mayaAsciiFileName.c_str() );

        // Set the imported file name and path.
//        COLLADABU::URI mayaAsciiFileURI ( mayaAsciiFileName );
        COLLADABU::URI mayaAsciiFileURI ( importFileName );
#ifdef NDEBUG
        mayaAsciiFileURI.setPathExtension ( ASCII_PATH_EXTENSION );
#else
        mayaAsciiFileURI.setPathExtension ( ASCII_PATH_EXTENSION_DEBUG );
#endif
        String mayaAsciiFileName = mayaAsciiFileURI.getURIString ();
		const char* cpMayaAsciiFileName = mayaAsciiFileName.c_str();

        // Get the current maya version
        String mayaVersion ( MGlobal::mayaVersion ().asChar () );

        // We have to change the name on 64 bit machines. 
        // For example from "2008 x64" to "2008" or from "2008 Extension 2" to "2008".
        std::vector<String> words;
        String separator (" ");
        COLLADABU::Utils::split ( mayaVersion, separator, words );
        if ( words.size () > 1 ) 
        {
            mayaVersion = words[0];
        }

        // Actually import the document
		{
			DAE2MA::DocumentImporter documentImporter ( importFileName, mayaAsciiFileURI.getURIString (), mayaVersion.c_str () );
			documentImporter.importCurrentScene ();
		}

        // Display some closing information.
        endClock = clock();

        std::ostringstream stream; 
        stream << "Time to import into file \"" << mayaAsciiFileName << "\": " << endClock - startClock << std::endl;
        String message( stream.str() );
        std::cerr << message << std::endl;

        // TODO Open the maya ascii file in the maya instance
		MFileIO::importFile ( cpMayaAsciiFileName );
		//MFileIO::open ( mayaAsciiFileName.c_str (), "mayaAscii", true ); 

		//         mayaAsciiFileURI.setPathExtension ( ".opencollada.mb" );
		//         mayaFileName = mayaAsciiFileURI.getURIString ();
		//         MFileIO::saveAs ( mayaFileName.c_str () );
		//         MGlobal::displayInfo ( "File saved as maya binary: " );
		//         MGlobal::displayInfo ( mayaFileName.c_str () 
        
        return status;
    }