本文整理匯總了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;
}
示例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;
}
示例3: XmlElementEventArgs
internal XmlElementEventArgs(XmlElement attr, int lineNum, int linePos, object source)
{
this.attr = attr;
this.lineNumber = lineNum;
this.linePosition = linePos;
this.obj = source;
}
示例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);
}
示例5: CssStylesheet
// Constructor
public CssStylesheet(XmlElement htmlElement)
{
if (htmlElement != null)
{
this.DiscoverStyleDefinitions(htmlElement);
}
}
示例6: getNodeValue
private string getNodeValue(XmlElement parentElement, string nodeName)
{
XmlNode node = XmlHelperFunctions.GetSubNode(parentElement, nodeName);
if (node == null) return string.Empty;
return node.InnerText;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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
{
}
}
}
示例14: LayoutConfiguration
LayoutConfiguration(XmlElement el, bool custom)
{
name = el.GetAttribute("name");
fileName = el.GetAttribute("file");
readOnly = Boolean.Parse(el.GetAttribute("readonly"));
this.custom = custom;
}
示例15: Create
public static ProjectTemplatePackageReference Create(XmlElement xmlElement)
{
return new ProjectTemplatePackageReference {
Id = GetAttribute (xmlElement, "id"),
Version = GetAttribute (xmlElement, "version")
};
}