Beispiel #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);
        }
Beispiel #2
0
        internal void Add(SXILParserNode aParser)
        {
            int hash = aParser.GetHashCode();

            if (iNodes.ContainsKey(hash))
            {
                throw new Exception("The specified parser node already exists");
            }
            iNodes.Add(hash, aParser);
        }
Beispiel #3
0
 private SXILParserNode this[string aName]
 {
     get
     {
         SXILParserNode ret = null;
         //
         int hash = aName.GetHashCode();
         if (iNodes.ContainsKey(hash))
         {
             ret = iNodes[hash];
         }
         //
         return(ret);
     }
 }