Esempio n. 1
0
        private void LoadRoleRefs(out int numErrors)
        {
            numErrors = 0;

            XmlNodeList rolesList = theDocument.SelectNodes(RREF_KEY, theManager);

            if (rolesList == null)
            {
                return;
            }



            foreach (XmlNode role in rolesList)
            {
                if (roleRefs == null)
                {
                    roleRefs = new Hashtable();
                }

                string uri  = string.Empty;
                string href = string.Empty;

                if (!Common.GetAttribute(role, HREF_TAG, ref href, errorList) ||
                    !Common.GetAttribute(role, RURI_TAG, ref uri, errorList))
                {
                    ++numErrors;
                    continue;
                }

                RoleRef rr = new RoleRef(href, uri);
                roleRefs[uri] = rr;
            }
        }
Esempio n. 2
0
        public bool VerifyRoleReference(string xsdFile, string uri)
        {
            RoleRef rr = roleRefs[uri] as RoleRef;

            if (rr == null)
            {
                return(false);
            }

            try
            {
                return(string.Compare(xsdFile, rr.GetSchemaName(), true) == 0);
            }
            catch (AucentException)
            {
                return(false);
            }
            catch (ArgumentNullException)
            {
                return(false);
            }
        }
Esempio n. 3
0
        public void LoadRoleRefs(Dictionary <string, string> discoveredSchemas, out int numErrors)
        {
            numErrors = 0;

            XmlNodeList rolesList = theDocument.SelectNodes(RREF_KEY, theManager);

            if (rolesList == null)
            {
                return;
            }


            foreach (XmlNode role in rolesList)
            {
                if (roleRefs == null)
                {
                    roleRefs = new Hashtable();
                }
                string uri  = string.Empty;
                string href = string.Empty;

                if (!Common.GetAttribute(role, HREF_TAG, ref href, errorList) ||
                    !Common.GetAttribute(role, RURI_TAG, ref uri, errorList))
                {
                    ++numErrors;
                    continue;
                }

                RoleRef rr = new RoleRef(href, uri);
                roleRefs[uri] = rr;


                string xsdName = rr.GetSchemaName();
                LinkBase.AddDiscoveredSchema(this.schemaPath, xsdName, discoveredSchemas);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Overloaded.  Creates a new instance of <see cref="RoleRef"/>, copying 
 /// properties from a parameter-supplied <see cref="RoleRef"/>.
 /// </summary>
 /// <param name="rr">The <see cref="RoleRef"/> from which the properties 
 /// of the newly created <see cref="RoleRef"/> are to be copied.</param>
 public RoleRef(RoleRef rr)
 {
     href = rr.href;
     uri = rr.uri;
 }
Esempio n. 5
0
 /// <summary>
 /// Overloaded.  Creates a new instance of <see cref="RoleRef"/>, copying
 /// properties from a parameter-supplied <see cref="RoleRef"/>.
 /// </summary>
 /// <param name="rr">The <see cref="RoleRef"/> from which the properties
 /// of the newly created <see cref="RoleRef"/> are to be copied.</param>
 public RoleRef(RoleRef rr)
 {
     href = rr.href;
     uri  = rr.uri;
 }
Esempio n. 6
0
        public void LoadRoleRefs( Dictionary<string, string> discoveredSchemas, out int numErrors)
        {
            numErrors = 0;

            XmlNodeList rolesList = theDocument.SelectNodes(RREF_KEY, theManager);

            if (rolesList == null )
            {
                return;
            }

            foreach (XmlNode role in rolesList)
            {
                if (roleRefs == null)
                {
                    roleRefs = new Hashtable();
                }
                string uri = string.Empty;
                string href = string.Empty;

                if (!Common.GetAttribute(role, HREF_TAG, ref href, errorList) ||
                    !Common.GetAttribute(role, RURI_TAG, ref uri, errorList))
                {
                    ++numErrors;
                    continue;
                }

                RoleRef rr = new RoleRef(href, uri);
                roleRefs[uri] = rr;

                string xsdName = rr.GetSchemaName();
                LinkBase.AddDiscoveredSchema(this.schemaPath, xsdName, discoveredSchemas);

            }
        }
Esempio n. 7
0
        private void LoadRoleRefs(out int numErrors)
        {
            numErrors = 0;

            XmlNodeList rolesList = theDocument.SelectNodes(RREF_KEY, theManager);

            if (rolesList == null )
            {
                return;
            }

            foreach (XmlNode role in rolesList)
            {
                if (roleRefs == null)
                {
                    roleRefs = new Hashtable();
                }

                string uri = string.Empty;
                string href = string.Empty;

                if (!Common.GetAttribute(role, HREF_TAG, ref href, errorList) ||
                    !Common.GetAttribute(role, RURI_TAG, ref uri, errorList))
                {
                    ++numErrors;
                    continue;
                }

                RoleRef rr = new RoleRef(href, uri);
                roleRefs[uri] = rr;
            }
        }
Esempio n. 8
0
 /// <exclude/>
 public TestRoleRef(RoleRef rr)
     : base(rr)
 {
 }
Esempio n. 9
0
        public void TestAddAndMergeFileReference()
        {
            RoleRef rr = new RoleRef();
            rr.AddFileReference( null );
            Assert.IsNull( rr.GetFileReferences(), "should not have any file refs" );
            rr.AddFileReference( string.Empty );
            Assert.IsNull( rr.GetFileReferences(), "should not have any file refs" );

            rr.AddFileReference( "a.xsd" );
            Assert.AreEqual( 1, rr.GetFileReferences().Count, "wrong num file refs" );
            Assert.AreEqual( "a.xsd", rr.GetFileReferences()[0], "wrong file ref added" );
            rr.AddFileReference( "b.xsd" );
            Assert.AreEqual( 2, rr.GetFileReferences().Count, "wrong num file refs" );
            Assert.AreEqual( "b.xsd", rr.GetFileReferences()[1], "wrong file ref added" );
            rr.AddFileReference( "b.xsd" );
            Assert.AreEqual( 2, rr.GetFileReferences().Count, "wrong num file refs" );

            rr.MergeFileReferences( null );
            Assert.AreEqual( 2, rr.GetFileReferences().Count, "wrong num file refs" );
            Assert.AreEqual( "a.xsd", rr.GetFileReferences()[0], "wrong file ref added" );
            Assert.AreEqual( "b.xsd", rr.GetFileReferences()[1], "wrong file ref added" );
            rr.MergeFileReferences( new List<string>() );
            Assert.AreEqual( 2, rr.GetFileReferences().Count, "wrong num file refs" );
            Assert.AreEqual( "a.xsd", rr.GetFileReferences()[0], "wrong file ref added" );
            Assert.AreEqual( "b.xsd", rr.GetFileReferences()[1], "wrong file ref added" );

            List<string> merge = new List<string>( rr.GetFileReferences() );
            rr.MergeFileReferences( merge );
            Assert.AreEqual( 2, rr.GetFileReferences().Count, "wrong num file refs" );
            Assert.AreEqual( "a.xsd", rr.GetFileReferences()[0], "wrong file ref added" );
            Assert.AreEqual( "b.xsd", rr.GetFileReferences()[1], "wrong file ref added" );

            merge.Add( "c.xsd" );
            merge.Add( "d.xsd" );
            rr.MergeFileReferences( merge );
            Assert.AreEqual( 4, rr.GetFileReferences().Count, "wrong num file refs" );
            Assert.AreEqual( "a.xsd", rr.GetFileReferences()[0], "wrong file ref added" );
            Assert.AreEqual( "b.xsd", rr.GetFileReferences()[1], "wrong file ref added" );
            Assert.AreEqual( "c.xsd", rr.GetFileReferences()[2], "wrong file ref added" );
            Assert.AreEqual( "d.xsd", rr.GetFileReferences()[3], "wrong file ref added" );
        }