コード例 #1
0
        // returns true if ns decls was added to scope
        public bool EnterScope(NsDecl nsDecl)
        {
            _lastScopes++;

            bool hasNamespaces = false;
            bool excludeAll    = false;

            for (; nsDecl != null; nsDecl = nsDecl.Prev)
            {
                if (nsDecl.NsUri == null)
                {
                    Debug.Assert(nsDecl.Prefix == null, "NS may be null only when prefix is null where it is used for extension-element-prefixes='#all'");
                    excludeAll = true;
                }
                else if (nsDecl.Prefix == null)
                {
                    AddExNamespace(nsDecl.NsUri);
                }
                else
                {
                    hasNamespaces = true;
                    AddNsDeclaration(nsDecl.Prefix, nsDecl.NsUri);
                }
            }
            if (excludeAll)
            {
                // #all should be on the top of the stack, becase all NSs on this element should be excluded as well
                AddExNamespace(null);
            }
            return(hasNamespaces);
        }
コード例 #2
0
ファイル: XslAst.cs プロジェクト: rsumner31/corefx2
        public readonly string NsUri;   // null means "#all" -- all namespace defined above this one are excluded.

        public NsDecl(NsDecl prev, string prefix, string nsUri)
        {
            Debug.Assert(nsUri != null || Prefix == null);
            this.Prev   = prev;
            this.Prefix = prefix;
            this.NsUri  = nsUri;
        }
コード例 #3
0
 public void AddNamespace(XsltInput input)
 {
     if (Ref.Equal(input.LocalName, input.Atoms.Xml))
     {
         Debug.Assert(input.Value == XmlReservedNs.NsXml, "XmlReader must check binding for 'xml' prefix");
     }
     else
     {
         nsList = new NsDecl(nsList, input.LocalName, input.Value);
     }
 }