Exemplo n.º 1
0
        internal NavigatorInput(XPathNavigator navigator, string baseUri, InputScope?rootScope)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException(nameof(navigator));
            }
            if (baseUri == null)
            {
                throw new ArgumentNullException(nameof(baseUri));
            }
            Debug.Assert(navigator.NameTable != null);
            _Next         = null;
            _Href         = baseUri;
            _Atoms        = new KeywordsTable(navigator.NameTable);
            _Navigator    = navigator;
            _Manager      = new InputScopeManager(_Navigator, rootScope);
            _PositionInfo = PositionInfo.GetPositionInfo(_Navigator);

            /*BeginReading:*/
            AssertInput();
            if (NodeType == XPathNodeType.Root)
            {
                _Navigator.MoveToFirstChild();
            }
        }
Exemplo n.º 2
0
        internal void Init(InputScope?parent)
        {
            this.scopes = null;
            _parent     = parent;

            if (_parent != null)
            {
                _forwardCompatibility = _parent._forwardCompatibility;
                _canHaveApplyImports  = _parent._canHaveApplyImports;
            }
        }
Exemplo n.º 3
0
 internal bool IsExcludedNamespace(string nspace)
 {
     Debug.Assert(_scopeStack != null, "PushScope wasn't called");
     for (InputScope?inputScope = _scopeStack; inputScope != null; inputScope = inputScope.Parent)
     {
         if (inputScope.IsExcludedNamespace(nspace))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
        //
        // The World of Compile
        //
        internal void Compile(NavigatorInput input, XmlResolver xmlResolver)
        {
            Debug.Assert(input != null);
            Debug.Assert(xmlResolver != null);
            Debug.Assert(_input == null && _atoms == null);
            _xmlResolver = xmlResolver;

            PushInputDocument(input);
            _rootScope  = _scopeManager.PushScope();
            _queryStore = new List <TheQuery>();

            try
            {
                this.rootStylesheet = new Stylesheet();
                PushStylesheet(this.rootStylesheet);

                Debug.Assert(_input != null && _atoms != null);

                try
                {
                    this.CreateRootAction();
                }
                catch (XsltCompileException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    throw new XsltCompileException(e, this.Input !.BaseURI, this.Input.LineNumber, this.Input.LinePosition);
                }

                this.stylesheet !.ProcessTemplates();
                _rootAction.PorcessAttributeSets(this.rootStylesheet);
                this.stylesheet.SortWhiteSpace();

                if (_globalNamespaceAliasTable != null)
                {
                    this.stylesheet.ReplaceNamespaceAlias(this);
                    _rootAction.ReplaceNamespaceAlias(this);
                }
            }
            finally
            {
                PopInputDocument();
            }

            Debug.Assert(_rootAction != null);
            Debug.Assert(this.stylesheet != null);
            Debug.Assert(_queryStore != null);
            Debug.Assert(_input == null && _atoms == null);
        }
Exemplo n.º 5
0
        internal void PopScope()
        {
            Debug.Assert(_scopeStack != null, "Push/Pop disbalance");
            if (_scopeStack == null)
            {
                return;
            }

            for (NamespaceDecl?scope = _scopeStack.Scopes; scope != null; scope = scope.Next)
            {
                _defaultNS = scope.PrevDefaultNsUri;
            }

            _scopeStack = _scopeStack.Parent;
        }
Exemplo n.º 6
0
        private string ResolveNonEmptyPrefix(string prefix)
        {
            Debug.Assert(_scopeStack != null, "PushScope wasn't called");
            Debug.Assert(!string.IsNullOrEmpty(prefix));
            if (prefix == "xml")
            {
                return(XmlReservedNs.NsXml);
            }
            else if (prefix == "xmlns")
            {
                return(XmlReservedNs.NsXmlNs);
            }

            for (InputScope?inputScope = _scopeStack; inputScope != null; inputScope = inputScope.Parent)
            {
                string?nspace = inputScope.ResolveNonAtom(prefix);
                if (nspace != null)
                {
                    return(nspace);
                }
            }
            throw XsltException.Create(SR.Xslt_InvalidPrefix, prefix);
        }
Exemplo n.º 7
0
 internal InputScope PushScope()
 {
     _scopeStack = new InputScope(_scopeStack);
     return(_scopeStack);
 }
Exemplo n.º 8
0
 public InputScopeManager(XPathNavigator navigator, InputScope?rootScope)
 {
     _navigator  = navigator;
     _scopeStack = rootScope;
 }
Exemplo n.º 9
0
 internal InputScope(InputScope?parent)
 {
     Init(parent);
 }