当前位置: 首页>>代码示例>>C#>>正文


C# Xml.XmlElement类代码示例

本文整理汇总了C#中System.Xml.XmlElement的典型用法代码示例。如果您正苦于以下问题:C# XmlElement类的具体用法?C# XmlElement怎么用?C# XmlElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlElement类属于System.Xml命名空间,在下文中一共展示了XmlElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFilter

        public virtual Filter GetFilter(XmlElement e)
        {
            string fieldName = DOMUtils.GetAttributeWithInheritanceOrFail(e, "fieldName");
            DuplicateFilter df = new DuplicateFilter(fieldName);

            string keepMode = DOMUtils.GetAttribute(e, "keepMode", "first");
            if (keepMode.Equals("first", StringComparison.OrdinalIgnoreCase))
            {
                df.KeepMode = KeepMode.KM_USE_FIRST_OCCURRENCE;
            }
            else if (keepMode.Equals("last", StringComparison.OrdinalIgnoreCase))
            {
                df.KeepMode = KeepMode.KM_USE_LAST_OCCURRENCE;
            }
            else
            {
                throw new ParserException("Illegal keepMode attribute in DuplicateFilter:" + keepMode);
            }

            string processingMode = DOMUtils.GetAttribute(e, "processingMode", "full");
            if (processingMode.Equals("full", StringComparison.OrdinalIgnoreCase))
            {
                df.ProcessingMode = ProcessingMode.PM_FULL_VALIDATION;
            }
            else if (processingMode.Equals("fast", StringComparison.OrdinalIgnoreCase))
            {
                df.ProcessingMode = ProcessingMode.PM_FAST_INVALIDATION;
            }
            else
            {
                throw new ParserException("Illegal processingMode attribute in DuplicateFilter:" + processingMode);
            }

            return df;
        }
开发者ID:apache,项目名称:lucenenet,代码行数:35,代码来源:DuplicateFilterBuilder.cs

示例2: BuildItemGroup

		internal BuildItemGroup (XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly, bool dynamic)
		{
			this.buildItems = new List <BuildItem> ();
			this.importedProject = importedProject;
			this.itemGroupElement = xmlElement;
			this.parentProject = project;
			this.read_only = readOnly;
			this.isDynamic = dynamic;
			
			if (!FromXml)
				return;

			foreach (XmlNode xn in xmlElement.ChildNodes) {
				if (!(xn is XmlElement))
					continue;
					
				XmlElement xe = (XmlElement) xn;
				BuildItem bi = CreateItem (project, xe);
				buildItems.Add (bi);
				project.LastItemGroupContaining [bi.Name] = this;
			}

			DefinedInFileName = importedProject != null ? importedProject.FullFileName :
						project != null ? project.FullFileName : null;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:25,代码来源:BuildItemGroup.cs

示例3: XmlElementEventArgs

		internal XmlElementEventArgs(XmlElement attr, int lineNum, int linePos, object source)
		{
			this.attr		= attr;
			this.lineNumber = lineNum;
			this.linePosition = linePos;
			this.obj		= source;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:XmlElementEventArgs.cs

示例4: Config

        public static void Config(XmlElement
		    xmlElement, ref LogConfig logConfig, bool compulsory)
        {
            uint uintValue = new uint();
            int intValue = new int();

            Configuration.ConfigBool(xmlElement, "AutoRemove",
                ref logConfig.AutoRemove, compulsory);
            if (Configuration.ConfigUint(xmlElement, "BufferSize",
                ref uintValue, compulsory))
                logConfig.BufferSize = uintValue;
            Configuration.ConfigString(xmlElement, "Dir",
                ref logConfig.Dir, compulsory);
            if (Configuration.ConfigInt(xmlElement, "FileMode",
                ref intValue, compulsory))
                logConfig.FileMode = intValue;
            Configuration.ConfigBool(xmlElement, "ForceSync",
                ref logConfig.ForceSync, compulsory);
            Configuration.ConfigBool(xmlElement, "InMemory",
                ref logConfig.InMemory, compulsory);
            if (Configuration.ConfigUint(xmlElement, "MaxFileSize",
                ref uintValue, compulsory))
                logConfig.MaxFileSize = uintValue;
            Configuration.ConfigBool(xmlElement, "NoBuffer",
                ref logConfig.NoBuffer, compulsory);
            if (Configuration.ConfigUint(xmlElement, "RegionSize",
                ref uintValue, compulsory))
                logConfig.RegionSize = uintValue;
            Configuration.ConfigBool(xmlElement, "ZeroOnCreate",
                ref logConfig.ZeroOnCreate, compulsory);
        }
开发者ID:bohrasd,项目名称:windowsrtdev,代码行数:31,代码来源:LogConfigTest.cs

示例5: CssStylesheet

 // Constructor
 public CssStylesheet(XmlElement htmlElement)
 {
     if (htmlElement != null)
     {
         this.DiscoverStyleDefinitions(htmlElement);
     }
 }
开发者ID:Amichai,项目名称:Prax,代码行数:8,代码来源:HtmlCssParser.cs

示例6: getNodeValue

        private string getNodeValue(XmlElement parentElement, string nodeName)
        {
            XmlNode node = XmlHelperFunctions.GetSubNode(parentElement, nodeName);
              if (node == null) return string.Empty;

              return node.InnerText;
        }
开发者ID:dstrucl,项目名称:Tangenta40,代码行数:7,代码来源:ProtectiveMark.cs

示例7: Task

 //Initialize task from Weak variables
 public Task(XmlElement Element)
 {
     if (Element.Name != "Task")
         throw new Exception("Incorrect XML markup");
     this.Name = Element.GetElementsByTagName("Name")[0].InnerText;
     this.GroupName = Element.GetElementsByTagName("GroupName")[0].InnerText;
     this.Description = Element.GetElementsByTagName("Description")[0].InnerText;
     this.Active = Element.GetElementsByTagName("Active")[0].InnerText == "1";
     XmlElement TriggersElement = (XmlElement)Element.GetElementsByTagName("Triggers")[0];
     foreach (XmlElement TriggerElement in TriggersElement.ChildNodes)
     {
         Trigger Trigger = new Trigger(TriggerElement);
         Triggers.Add(Trigger);
         Trigger.AssignTask(this);
     }
     XmlElement ConditionsElement = (XmlElement)Element.GetElementsByTagName("Conditions")[0];
     foreach (XmlElement ConditionElement in ConditionsElement.ChildNodes)
     {
         Condition Condition = new Condition(ConditionElement);
         Conditions.Add(Condition);
         Condition.AssignTask(this);
     }
     XmlElement ActionsElement = (XmlElement)Element.GetElementsByTagName("Actions")[0];
     foreach (XmlElement ActionElement in ActionsElement.ChildNodes)
     {
         Actions.Action Action = new Actions.Action(ActionElement);
         Actions.Add(Action);
         Action.AssignTask(this);
     }
 }
开发者ID:TimeToogo,项目名称:WIDA-Tasks,代码行数:31,代码来源:Task.cs

示例8: CreateXmlElement

 public void CreateXmlElement()
 {
     XmlDocument xmlDoc = new XmlDocument();
     string xmlData = "<objects xmlns=\"http://www.springframework.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd\"><object name=\"TestVersion\"  type=\"System.Version, Mscorlib\"></object></objects>";
     xmlDoc.Load(new StringReader(xmlData));
     _xmlElement = xmlDoc.DocumentElement;
 }
开发者ID:fgq841103,项目名称:spring-net,代码行数:7,代码来源:ObjectFactorySectionHandlerTests.cs

示例9: GObjectVM

 public GObjectVM(XmlElement elem, ObjectBase container_type)
     : base(elem, container_type)
 {
     parms.HideData = false;
     this.Protection = "protected";
     class_struct_name = container_type.ClassStructName;
 }
开发者ID:Gravecorp,项目名称:gtk-sharp,代码行数:7,代码来源:GObjectVM.cs

示例10: ManagedProjectReference

        public ManagedProjectReference(XmlElement xmlDefinition, ReferencesResolver referencesResolver, ProjectBase parent, SolutionBase solution, TempFileCollection tfc, GacCache gacCache, DirectoryInfo outputDir)
            : base(referencesResolver, parent)
        {
            if (xmlDefinition == null) {
                throw new ArgumentNullException("xmlDefinition");
            }
            if (solution == null) {
                throw new ArgumentNullException("solution");
            }
            if (tfc == null) {
                throw new ArgumentNullException("tfc");
            }
            if (gacCache == null) {
                throw new ArgumentNullException("gacCache");
            }

            XmlAttribute privateAttribute = xmlDefinition.Attributes["Private"];
            if (privateAttribute != null) {
                _isPrivateSpecified = true;
                _isPrivate = bool.Parse(privateAttribute.Value);
            }

            // determine path of project file
            string projectFile = solution.GetProjectFileFromGuid(
                xmlDefinition.GetAttribute("Project"));

            // load referenced project
            _project = LoadProject(solution, tfc, gacCache, outputDir, projectFile);
        }
开发者ID:smaclell,项目名称:NAnt,代码行数:29,代码来源:ManagedProjectReference.cs

示例11: DoParse

        protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
        {

            builder.AddPropertyReference(TxNamespaceUtils.TRANSACTION_MANAGER_PROPERTY,
                GetAttributeValue(element, TxNamespaceUtils.TRANSACTION_MANAGER_ATTRIBUTE));
            XmlNodeList txAttributes = element.SelectNodes("*[local-name()='attributes' and namespace-uri()='" + element.NamespaceURI + "']");
            if (txAttributes.Count > 1 )
            {
                parserContext.ReaderContext.ReportException(element, "tx advice", "Element <attributes> is allowed at most once inside element <advice>");
            }
            else if (txAttributes.Count == 1)
            {
                //using xml defined source
                XmlElement attributeSourceElement = txAttributes[0] as XmlElement;
                AbstractObjectDefinition attributeSourceDefinition =
                    ParseAttributeSource(attributeSourceElement, parserContext);
                builder.AddPropertyValue(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE, attributeSourceDefinition);
            }
            else
            {
                //Assume attibutes source
                ObjectDefinitionBuilder txAttributeSourceBuilder = 
                    parserContext.ParserHelper.CreateRootObjectDefinitionBuilder(typeof (AttributesTransactionAttributeSource));

                builder.AddPropertyValue(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE,
                                         txAttributeSourceBuilder.ObjectDefinition);

            }
        }
开发者ID:fgq841103,项目名称:spring-net,代码行数:29,代码来源:TxAdviceObjectDefinitionParser.cs

示例12: AddCompositeIdGenerator

        protected override void AddCompositeIdGenerator(XmlDocument xmldoc, XmlElement idElement, List<ColumnDetail> compositeKey, ApplicationPreferences applicationPreferences)
        {
            foreach (ColumnDetail column in compositeKey)
            {
                var keyElement = xmldoc.CreateElement("key-property");
                string propertyName =
                    column.ColumnName.GetPreferenceFormattedText(applicationPreferences);

                if (applicationPreferences.FieldGenerationConvention == FieldGenerationConvention.Property)
                {
                    idElement.SetAttribute("name", propertyName.MakeFirstCharLowerCase());
                }
                else
                {
                    if (applicationPreferences.FieldGenerationConvention == FieldGenerationConvention.AutoProperty)
                    {
                        propertyName = column.ColumnName.GetFormattedText();
                    }

                    keyElement.SetAttribute("name", propertyName);
                }
                var mapper = new DataTypeMapper();
                Type mapFromDbType = mapper.MapFromDBType(column.DataType, column.DataLength,
                                                          column.DataPrecision,
                                                          column.DataScale);
                keyElement.SetAttribute("type", mapFromDbType.Name);
                keyElement.SetAttribute("column", column.ColumnName);
                if (applicationPreferences.FieldGenerationConvention != FieldGenerationConvention.AutoProperty)
                {
                    keyElement.SetAttribute("access", "field");
                }
                idElement.AppendChild(keyElement);
            }
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:34,代码来源:SqlMappingGenerator.cs

示例13: Load

        public static void Load( XmlElement xml )
        {
            DisableAll();

            if ( xml == null )
                return;

            foreach( XmlElement el in xml.GetElementsByTagName( "filter" ) )
            {
                try
                {
                    LocString name = (LocString)Convert.ToInt32( el.GetAttribute( "name" ) );
                    string enable = el.GetAttribute( "enable" );

                    for(int i=0;i<m_Filters.Count;i++)
                    {
                        Filter f = (Filter)m_Filters[i];
                        if ( f.Name == name )
                        {
                            if ( Convert.ToBoolean( enable ) )
                                f.OnEnable();
                            break;
                        }
                    }
                }
                catch
                {
                }
            }
        }
开发者ID:herculesjr,项目名称:razor,代码行数:30,代码来源:Filter.cs

示例14: LayoutConfiguration

		LayoutConfiguration(XmlElement el, bool custom)
		{
			name       = el.GetAttribute("name");
			fileName   = el.GetAttribute("file");
			readOnly   = Boolean.Parse(el.GetAttribute("readonly"));
			this.custom = custom;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:LayoutConfiguration.cs

示例15: Create

 public static ProjectTemplatePackageReference Create(XmlElement xmlElement)
 {
     return new ProjectTemplatePackageReference {
         Id = GetAttribute (xmlElement, "id"),
         Version = GetAttribute (xmlElement, "version")
     };
 }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:ProjectTemplatePackageReference.cs


注:本文中的System.Xml.XmlElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。