System.Xml.Xsl.XsltOld.Compiler.GetSingleAttribute C# (CSharp) Method

GetSingleAttribute() private method

private GetSingleAttribute ( string attributeAtom ) : string
attributeAtom string
return string
        internal string GetSingleAttribute(string attributeAtom)
        {
            NavigatorInput input = Input;
            string element = input.LocalName;
            string value = null;

            if (input.MoveToFirstAttribute())
            {
                do
                {
                    string nspace = input.NamespaceURI;
                    string name = input.LocalName;

                    if (nspace.Length != 0) continue;

                    if (Ref.Equal(name, attributeAtom))
                    {
                        value = input.Value;
                    }
                    else
                    {
                        if (!this.ForwardCompatibility)
                        {
                            throw XsltException.Create(SR.Xslt_InvalidAttribute, name, element);
                        }
                    }
                }
                while (input.MoveToNextAttribute());
                input.ToParent();
            }

            if (value == null)
            {
                throw XsltException.Create(SR.Xslt_MissingAttribute, attributeAtom);
            }
            return value;
        }

Usage Example

Ejemplo n.º 1
0
        // SxS: This method does not take any resource name and does not expose any resources to the caller.
        // It's OK to suppress the SxS warning.
        private void CompileInclude(Compiler compiler)
        {
            Uri    uri      = compiler.ResolveUri(compiler.GetSingleAttribute(compiler.Input.Atoms.Href));
            string resolved = uri.ToString();

            if (compiler.IsCircularReference(resolved))
            {
                throw XsltException.Create(SR.Xslt_CircularInclude, resolved);
            }

            NavigatorInput input = compiler.ResolveDocument(uri);

            compiler.PushInputDocument(input);

            try
            {
                CompileDocument(compiler, /*inInclude*/ true);
            }
            catch (XsltCompileException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new XsltCompileException(e, input.BaseURI, input.LineNumber, input.LinePosition);
            }
            finally
            {
                compiler.PopInputDocument();
            }
            CheckEmpty(compiler);
        }
All Usage Examples Of System.Xml.Xsl.XsltOld.Compiler::GetSingleAttribute