Inheritance: ILocation
Beispiel #1
0
        private AspParser InitialiseParser(string parseText)
        {
            AspParser parser = null;

            using (StringReader reader = new StringReader(parseText)) {
                parser = new AspParser(null, reader);
            }

            parser.Error      += new ParseErrorHandler(ParseError);
            parser.TagParsed  += new TagParsedHandler(TagParsed);
            parser.TextParsed += new TextParsedHandler(TextParsed);

            return(parser);
        }
Beispiel #2
0
        /// <summary>
        /// Parses a document fragment. Processes all controls and directives and adds them to host.
        /// </summary>
        /// <param name="fragment">The document fragment to parse</param>
        /// <returns>The document with all controls, directives and script blocks replaced by placeholders</returns>
        public void ProcessFragment(string fragment, out Control[] controls, out string substText)
        {
            AspParser parser = InitialiseParser(fragment);

            rootParsingObject = new RootParsingObject(host);
            openObject        = rootParsingObject;

            parser.Parse();

            if (openObject != rootParsingObject)
            {
                throw new Exception("The tag " + openObject.TagID + " was left unclosed");
            }

            rootParsingObject.GetParsedContent(out controls, out substText);
        }
Beispiel #3
0
        /// <summary>
        /// Parses a document fragment. Processes all controls and directives and adds them to host.
        /// </summary>
        /// <param name="fragment">The document fragment to parse</param>
        /// <returns>The document with all controls, directives and script blocks replaced by placeholders</returns>
        public void ParseDocument(string fragment, out Control[] controls, out string designDocument)
        {
            AspParser parser = InitialiseParser(fragment);

            rootParsingObject = new RootParsingObject(host);
            openObject        = rootParsingObject;

            parser.Parse();

            if (openObject != rootParsingObject)
            {
                throw new Exception("The tag " + openObject.TagID + " was left unclosed");
            }

            object[] objects;
            rootParsingObject.BuildObject(out objects, out designDocument);
            controls = new Control[objects.Length];
            objects.CopyTo(controls, 0);
        }
Beispiel #4
0
        private AspParser InitialiseParser(string parseText)
        {
            AspParser parser = null;
            using (StringReader reader = new StringReader (parseText)) {
                parser = new AspParser (null, reader);
            }

            parser.Error += new ParseErrorHandler (ParseError);
            parser.TagParsed += new TagParsedHandler (TagParsed);
            parser.TextParsed += new TextParsedHandler (TextParsed);

            return parser;
        }