예제 #1
0
        internal bool XmlParse(XmlNode aNode, SXILParser aMasterParser)
        {
            bool handled = false;
            //
            SXILParserNode child = this[aNode.Name];

            if (child != null)
            {
                child.Parser = aMasterParser;
                child.XmlParse(aNode);
                handled = true;
            }
            else
            {
                // No direct name-based match, check for multi entries
                foreach (KeyValuePair <int, SXILParserNode> kvp in iNodes)
                {
                    SXILParserNode parserNode = kvp.Value;
                    bool           isMulti    = parserNode.IsMulti;
                    if (isMulti)
                    {
                        bool canHandle = parserNode.CanHandle(aNode);
                        if (canHandle)
                        {
                            parserNode.Parser = aMasterParser;
                            parserNode.XmlParse(aNode);
                            handled = true;
                            break;
                        }
                    }
                }
            }
            //
            return(handled);
        }
예제 #2
0
        private SXILDocument CreateDocumentTree(string aFileName)
        {
            SXILDocument doc = new SXILDocument();

            // Read input file into document
            using (SXILParser parser = new SXILParser(aFileName, KInputFileDocumentRootNode, doc))
            {
                parser.CategoryAdd(KInputFileCategorySource, new SXILParserNodeFileSystem());
                parser.CategoryAdd(KInputFileCategoryDebugMetaData, new SXILParserNodeFileSystem());
                parser.CategoryAdd(KInputFileCategoryParameters,
                                   new SXILParserNodeCommand(KInputFileCommandNameAnalysis),
                                   new SXILParserNodeCommand(KInputFileCommandThread)
                                   );
                parser.CategoryAdd(KInputFileCategoryOutput, new SXILParserNodeFileSystem());
                parser.Parse();
            }

            return(doc);
        }