示例#1
0
        /// <summary>
        /// Carga los datos de la entrada
        /// </summary>
        /// <param name="configMap">Objeto de configuracion XML</param>
        /// <param name="configSettings">Objeto de configuracion de mapeo</param>
        public void LoadData(OwlConfigMap configMap, OwlSettings configSettings)
        {
            if (_xml == null)
            {
                _xml = new XmlDocument();
                try { _xml.Load(_pathFile); }
                catch (Exception e) { throw new OwlException(string.Format(ETexts.GT(ErrorType.ErrorLoadInputFile), _pathFile), e); }
            }

            if (_nsmgr == null)
            {
                _nsmgr = new XmlNamespaceManager(_xml.NameTable);
                if (!_prefix.IsNullOrWhiteSpace() && !_uri.IsNullOrWhiteSpace())
                {
                    AddNamespace(_prefix, _uri);
                }

                if (configSettings.LoadXmlPrefix)
                {
                    // Get the Namespaces with prefix
                    MatchCollection matches = Regex.Matches(_xml.OuterXml, "xmlns\\:(?<prefix>[A-Za-z][\\w\\d]*)\\=\\\"(?<uri>[\\w\\W][^\"]*)");
                    foreach (Match match in matches)
                    {
                        AddNamespace(match.Groups["prefix"].Value, match.Groups["uri"].Value);
                    }

                    // Get the Namespaces without prefix
                    matches = Regex.Matches(_xml.OuterXml, "xmlns\\=\\\"(?<uri>[\\w\\W][^\"]*)");
                    foreach (Match match in matches)
                    {
                        AddNamespace("def", match.Groups["uri"].Value);
                    }
                }
            }
        }
示例#2
0
        OwlHandler GetHandler(string config, string input)
        {
            OwlSettings settings = new OwlSettings
            {
                PathConfig = config
            };

            var owl = new OwlHandler(settings);

            owl.LoadConfigMap();
            owl.LoadInput(new XmlInput(input));

            return(owl);
        }