예제 #1
0
        /// <summary> 	Create a Mappings child </summary>
        public Mappings CreateChild(string id)
        {
            Mappings m = new Mappings(this, id);

            try
            {
                if (fNode != null)
                {
                    m.fNode = m.ToDom(fNode.OwnerDocument);
                }
            }
            catch (Exception se)
            {
                throw new AdkMappingException(se.Message, null, se);
            }

            AddChild(m);

            return m;
        }
        public void testCreateMappings()
        {
            // Create the root instance
            Mappings root = new Mappings();
            // Create the default set of universal mappings
            Mappings defaults = new Mappings( root, "Default" );
            root.AddChild( defaults );

            // Create an ObjectMapping for StudentPersonal
            ObjectMapping studentMappings = new ObjectMapping( "StudentPersonal" );
            defaults.AddRules( studentMappings );
            // Add field rules
            studentMappings.AddRule( new FieldMapping( "FIRSTNAME",
                                                       "Name[@Type='04']/FirstName" ) );
            studentMappings.AddRule( new FieldMapping( "LASTNAME",
                                                       "Name[@Type='04']/LastName" ) );

            // Create a set of mappings for the state of Wisconsin
            Mappings wisconsin = new Mappings( defaults, "Wisconsin" );
            defaults.AddChild( wisconsin );
            // Create a set of mappings for the Neillsville School District
            Mappings neillsville = new Mappings( wisconsin, "Neillsville" );

            wisconsin.AddChild( neillsville );

            XmlDocument doc = new XmlDocument( );
            doc.LoadXml( "<agent/>");

            XmlElement n = root.ToDom( doc );
            debug( doc );
        }