コード例 #1
0
        // ----------------------------------------------------------------------------------------
        /// <!-- _ParentSchema -->
        /// <summary>
        ///      Identifies the calling schema
        /// </summary>
        /// <param name="schema"></param>
        /// <returns></returns>
        public SimpleSchema _ParentSchema(SimpleSchema schema)
        {
            SimpleSchema parent;


            if (_CallerListContainsFilename(schema._FileName))
            {
                string fileName = _CallerByFileName(schema._FileName);
                if (_ContainsFile(fileName))
                {
                    parent = _ByFileName(fileName);
                }
                else
                {
                    parent = null;
                }
            }
            else
            {
                throw new KeyNotFoundException("missing file '" + schema._FileName + "' in caller list _callerByFileName");
            }


            return(parent);
        }
コード例 #2
0
        // ----------------------------------------------------------------------------------------
        /// <!-- _ByFileName -->
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public SimpleSchema _ByFileName(string fileName)
        {
            SimpleSchema schema = null;


            if (schema == null)
            {
                schema = TryFileName(fileName);
            }
            if (schema == null)
            {
                schema = TryFileName(fileName + ".xsd");
            }
            if (schema == null)
            {
                schema = TryFileName(Regex.Replace(fileName, "\\.xsd$", ""));
            }
            if (schema == null)
            {
                throw new Exception("schema not found in _schemasByFileName");
            }


            return(schema);
        }
コード例 #3
0
        // ----------------------------------------------------------------------------------------
        /// <!-- TryFileName -->
        /// <summary>
        ///
        /// </summary>
        /// <param name="tryMe"></param>
        /// <returns></returns>
        private SimpleSchema TryFileName(string tryMe)
        {
            SimpleSchema schema = null;

            if (_schemasByFileName.ContainsKey(tryMe))
            {
                schema = _schemasByFileName[tryMe];
            }
            return(schema);
        }
コード例 #4
0
 public void _RegisterSchema(string fileName, string fileNameSpace, SimpleSchema schema)
 {
     _schemasByFileName[fileName]       = schema;
     _schemasByNameSpace[fileNameSpace] = schema;
 }