示例#1
0
        internal void InitAsChild(XMLParser *parentParser, char *context, string encoding)
        {
            Debug.Assert(parentParser != null);
            XMLParser *parser;

            lock (this) {
                if (xmlParser != null)
                {
                    throw new ExpatException(ExpatParser <X, E, U> .InternalStateError);
                }
                RuntimeHelpers.PrepareConstrainedRegions();
                try { }
                finally {
                    parser    = LibExpat.XMLExternalEntityParserCreate(parentParser, context, encoding);
                    xmlParser = parser;
                    GC.ReRegisterForFinalize(this);
                }
            }
            if (parser == null)
            {
                throw new OutOfMemoryException();
            }
        }