Beispiel #1
0
        /// Load a file using the given filename. Returns true if successful.
        public bool LoadFile(string filename, TiXmlEncoding encoding /*= TIXML_DEFAULT_ENCODING*/)
        {
            // There was a really terrifying little bug here. The code:
            //		value = filename
            // in the STL case, cause the assignment method of the PG_string to
            // be called. What is strange, is that the PG_string had the same
            // address as it's c_str() method, and so bad things happen. Looks
            // like a bug in the Microsoft STL implementation.
            // Add an extra string to avoid the crash.
            value = filename;

            // reading in binary mode so that tinyxml can normalize the EOL
            FILE file = TiXmlFOpen(value.c_str(), "rb");

            if (file != null)
            {
                bool result = LoadFile(file, encoding);
                fclose(file);
                return(result);
            }
            else
            {
                SetError(ErrorType.TIXML_ERROR_OPENING_FILE, null, 0, null, TiXmlEncoding.TIXML_ENCODING_UNKNOWN);
                return(false);
            }
        }
Beispiel #2
0
        /** Load a file using the current document value.
         *      Returns true if successful. Will delete any existing
         *      document data before loading.
         */
        public bool LoadFile(TiXmlEncoding encoding /*= TiXmlEncoding.TIXML_ENCODING_UNKNOWN*/)
        {
            // See STL_STRING_BUG below.
            //StringToBuffer buf( value );

            return(LoadFile(Value(), encoding));
        }