Ejemplo n.º 1
0
        internal void InitAsParent(string encoding, bool namespaces)
        {
            XMLParser *parser;

            lock (this) {
                if (xmlParser != null)
                {
                    throw new ExpatException(ExpatParser <X, E, U> .InternalStateError);
                }
                RuntimeHelpers.PrepareConstrainedRegions();
                try { }
                finally {
                    if (namespaces)
                    {
                        parser = LibExpat.XMLParserCreateNS(encoding, ExpatUtils.NSSep);
                    }
                    else
                    {
                        parser = LibExpat.XMLParserCreate(encoding);
                    }
                    xmlParser = parser;
                    GC.ReRegisterForFinalize(this);
                }
            }
            if (parser == null)
            {
                throw new OutOfMemoryException();
            }
        }