本文整理汇总了C#中XmlHelper.GetElements方法的典型用法代码示例。如果您正苦于以下问题:C# XmlHelper.GetElements方法的具体用法?C# XmlHelper.GetElements怎么用?C# XmlHelper.GetElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlHelper
的用法示例。
在下文中一共展示了XmlHelper.GetElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetDefinition
public void SetDefinition(System.Xml.XmlElement definition)
{
XmlHelper h = new XmlHelper(definition);
_initialized = false;
//Check Basic Tab
chkBasic.Checked = CheckEnable(h.GetElement("Authentication/Basic"), true);
cbHashProvider.Text = h.GetText("Authentication/Basic/PasswordHashProvider/@DriverClass");
txtGetUserDataQuery.Text = h.GetText("Authentication/Basic/UserInfoStorage/DBSchema/GetUserDataQuery");
txtGetUserRoleQuery.Text = h.GetText("Authentication/Basic/UserInfoStorage/DBSchema/GetUserRolesQuery");
//Check Session Tab
chkSession.Checked = h.TryGetBoolean("Authentication/Session/@Enabled", true);
txtTimeout.Text = h.TryGetInteger("Authentication/Session/@Timeout", 20).ToString();
//Check Passport Tab
chkPassport.Checked = CheckEnable(h.GetElement("Authentication/Passport"), false);
txtIssuer.Text = h.GetText("Authentication/Passport/Issuer/@Name");
txtCertProvider.Text = h.GetText("Authentication/Passport/Issuer/CertificateProvider");
cbALTable.Text = h.GetText("Authentication/Passport/AccountLinking/TableName");
cboMappingField.Text = h.GetText("Authentication/Passport/AccountLinking/MappingField");
cbUserNameField.Text = h.GetText("Authentication/Passport/AccountLinking/UserNameField");
dgExtProp.Rows.Clear();
foreach (XmlElement pe in h.GetElements("Authentication/Passport/AccountLinking/Properties/Property"))
{
int index = dgExtProp.Rows.Add();
DataGridViewRow row = dgExtProp.Rows[index];
row.Cells[colAlias.Name].Value = pe.GetAttribute("Alias");
row.Cells[colDBField.Name].Value = pe.GetAttribute("Field");
}
CheckTabs();
_initialized = true;
}
示例2: UDSHandler
public UDSHandler(ProjectHandler project, XmlElement source)
{
Parent = project;
Contracts = new List<ContractHandler>();
AllContracts = new List<ContractHandler>();
XmlHelper ph = new XmlHelper(project.Preference);
List<string> list = new List<string>();
foreach (XmlElement e in ph.GetElements("Property/Contract"))
{
string name = e.GetAttribute("Name");
list.Add(name);
}
XmlHelper h = new XmlHelper(source);
foreach (XmlElement contractElement in h.GetElements("Contract"))
{
ContractHandler ch = new ContractHandler(contractElement);
if (list.Contains(ch.Name))
Contracts.Add(ch);
AllContracts.Add(ch);
}
}
示例3: UDTHandler
internal UDTHandler(ProjectHandler project, XmlElement source)
{
Parent = project;
Tables = new List<UDTTable>();
AllUDTTables = new List<UDTTable>();
_allUDTs = new List<string>();
XmlHelper h = new XmlHelper(source);
XmlHelper ph = new XmlHelper(project.Preference);
List<string> list = new List<string>();
foreach (XmlElement e in ph.GetElements("Property/UDT"))
{
string name = e.GetAttribute("Name");
list.Add(name.ToLower());
_allUDTs.Add(name);
}
foreach (XmlElement tableElement in h.GetElements("TableName"))
{
UDTTable table = new UDTTable(tableElement.InnerText);
if (list.Contains(table.Name.ToLower()))
Tables.Add(table);
_allUDTs.Add(table.Name.ToLower());
AllUDTTables.Add(table);
}
}
示例4: ListProjects
internal List<string> ListProjects()
{
if (_projects != null)
return _projects;
XmlHelper req = new XmlHelper("<Request/>");
req.AddElement(".", "Condition");
req.AddElement("Condition", "Name", PROJECT_LIST_PS_NAME);
Envelope evn = MainForm.LoginArgs.GreeningConnection.SendRequest("GetMySpace", new Envelope(req));
XmlHelper rsp = new XmlHelper(evn.Body);
_projects = new List<string>();
if (rsp.GetElement("Space") == null)
{
req = new XmlHelper("<Request/>");
req.AddElement(".", "Space");
req.AddElement("Space", "Name", PROJECT_LIST_PS_NAME);
XmlElement content = req.AddElement("Space", "Content");
XmlCDataSection section = content.OwnerDocument.CreateCDataSection("<ProjectList/>");
content.AppendChild(section);
MainForm.LoginArgs.GreeningConnection.SendRequest("CreateSpace", new Envelope(req));
}
else
{
string content = rsp.GetText("Space/Content");
XmlHelper h = new XmlHelper(content);
foreach (XmlElement projectElement in h.GetElements("Project"))
_projects.Add(projectElement.GetAttribute("Name"));
}
return _projects;
}
示例5: TableEditor_Load
private void TableEditor_Load(object sender, EventArgs e)
{
txtName.Text = TableNodeHandler.Table.Name;
_tableContent = new XmlHelper(TableNodeHandler.Table.GetContent());
dgFields.Rows.Clear();
foreach (XmlElement field in _tableContent.GetElements("Field"))
{
int index = dgFields.Rows.Add();
DataGridViewRow row = dgFields.Rows[index];
row.Cells[colName.Name].Value = field.GetAttribute("Name");
row.Cells[colDataType.Name].Value = field.GetAttribute("DataType");
row.Cells[colIndexed.Name].Value = field.GetAttribute("Indexed");
row.Cells[colAllowNull.Name].Value = field.GetAttribute("AllowNull");
row.Cells[colDefault.Name].Value = field.GetAttribute("Default");
row.Tag = field;
if (UDTTable.IsDefaultField(field))
row.ReadOnly = true;
}
foreach (XmlElement uniq in _tableContent.GetElements("Unique"))
{
XmlHelper uniqHelper = new XmlHelper(uniq);
string uniqFields = "";
foreach (XmlElement field in uniqHelper.GetElements("FieldName"))
uniqFields += "+" + field.InnerText;
if (!string.IsNullOrWhiteSpace(uniqFields))
uniqFields = uniqFields.Substring(1);
int index = dgUniq.Rows.Add(uniq.Name);
DataGridViewRow row = dgUniq.Rows[index];
row.Cells[colUniqName.Name].Value = uniq.GetAttribute("Name");
row.Cells[colFields.Name].Value = uniqFields;
}
foreach (XmlElement fk in _tableContent.GetElements("ForeignKey"))
{
this.AddForeignKey(fk);
}
this.TableNodeHandler.Table.Renamed += new EventHandler(Table_Renamed);
_initialized = true;
}
示例6: FilterConditionForm_Load
private void FilterConditionForm_Load(object sender, EventArgs e)
{
cboFields.Items.Clear();
cboFields.Items.Add(string.Empty);
XmlHelper h = new XmlHelper(_editForm.Table.GetContent());
foreach (XmlElement field in h.GetElements("Field"))
cboFields.Items.Add(field.GetAttribute("Name"));
txtCondition.Document.LoadLanguageFromXml(Assembly.GetExecutingAssembly().GetManifestResourceStream("ProjectManager.ActiproSoftware.SQL.xml"), 0);
}
示例7: ImportNode
private void ImportNode(XmlElement element, TreeNode treeNode)
{
XmlHelper h = new XmlHelper(element);
decimal size = h.TryGetDecimal("@Size", 0);
treeNode.ToolTipText = "Size :" + CalcUtil.GetVisualSize(size);
foreach (XmlElement dirElement in h.GetElements("Directory"))
{
TreeNode tn = treeNode.Nodes.Add(dirElement.GetAttribute("Name"));
tn.Tag = dirElement;
ImportNode(dirElement, tn);
tn.ImageIndex = 0;
tn.SelectedImageIndex = 1;
}
foreach (XmlElement fileElement in h.GetElements("File"))
{
string name = fileElement.GetAttribute("Name");
FileInfo fileInfo = new FileInfo(name);
string ext = fileInfo.Extension.ToLower();
if (ext.StartsWith("."))
ext = ext.Remove(0, 1);
TreeNode tn = treeNode.Nodes.Add(fileElement.GetAttribute("Name"));
tn.Tag = fileElement;
if (imgs.Images.ContainsKey(ext))
{
tn.ImageKey = ext;
tn.SelectedImageKey = ext;
}
else
{
tn.ImageIndex = 2;
tn.SelectedImageIndex = 2;
}
XmlHelper fh = new XmlHelper(fileElement);
decimal fsize = fh.TryGetDecimal("@Size", 0);
tn.ToolTipText = "Size :" + CalcUtil.GetVisualSize(fsize);
}
}
示例8: PackageHandler
internal PackageHandler(ContractHandler contract, XmlElement packageDefinition)
{
this.Contract = contract;
this.Name = packageDefinition.GetAttribute("Name");
_service = new List<string>();
XmlHelper ph = new XmlHelper(packageDefinition);
foreach (XmlElement each in ph.GetElements("Service"))
{
string serviceName = each.GetAttribute("Name");
_service.Add(serviceName);
}
}
示例9: OrderList
internal OrderList(XmlElement orderElement)
{
this.Orders = new List<Order>();
this.Name = string.Empty;
this.Source = string.Empty;
if (orderElement == null) return;
this.Name = orderElement.GetAttribute("Name");
this.Source = orderElement.GetAttribute("Source");
XmlHelper h = new XmlHelper(orderElement);
foreach (XmlElement xml in h.GetElements("Order"))
Orders.Add(new Order(xml));
}
示例10: btnSave_Click
private void btnSave_Click(object sender, EventArgs e)
{
_dgView.Rows.Clear();
XmlHelper h = new XmlHelper(this.xmlEditor1.Text);
foreach (XmlElement element in h.GetElements("Command"))
{
string type = element.GetAttribute("Type");
IUDTCommand cmd = UDTCmdProvider.GetCmd(type);
cmd.Result = element;
int index = _dgView.Rows.Add();
DataGridViewRow row = _dgView.Rows[index];
row.Tag = cmd;
row.Cells["colType"].Value = cmd.Type;
row.Cells["colDesc"].Value = cmd.Description;
}
this.Close();
}
示例11: FieldList
internal FieldList(XmlElement fieldListElement)
{
Fields = new List<Field>();
this.Name = string.Empty;
this.Source = string.Empty;
if (fieldListElement == null)
return;
this.Name = fieldListElement.GetAttribute("Name");
this.Source = fieldListElement.GetAttribute("Source");
XmlHelper h = new XmlHelper(fieldListElement);
foreach (XmlElement fieldElement in h.GetElements("Field"))
{
Field field = new Field(fieldElement);
Fields.Add(field);
}
}
示例12: Load
public void Load(XmlElement source)
{
Name = source.GetAttribute("Name");
XmlHelper h = new XmlHelper(source);
if (h.GetElement("Default") != null)
DefaultValue = h.GetText("Default");
else
DefaultValue = null;
Map = new Dictionary<string, string>();
foreach (XmlElement e in h.GetElements("Item"))
{
string key = e.GetAttribute("If");
string value = e.InnerText;
Map.Add(key, value);
}
}
示例13: ListFields
internal List<string> ListFields(string tableName)
{
if (PhysicalTables == null)
PhysicalTables = MainForm.CurrentProject.ListPhysicalTables();
List<string> fields = new List<string>();
if (PhysicalTables.Contains(tableName))
{
XmlElement result = MainForm.CurrentProject.Query("select * from \"" + tableName + "\" where 1=0");
XmlHelper h = new XmlHelper(result);
foreach (XmlElement column in h.GetElements("Metadata/Column"))
fields.Add(column.GetAttribute("Field"));
}
else
{
tableName = tableName.Substring(1);
foreach (UDTTable table in AllUDTTables)
{
if (table.Name != tableName) continue;
XmlElement content = table.GetContent();
XmlHelper h = new XmlHelper(content);
foreach (XmlElement field in h.GetElements("Field"))
fields.Add(field.GetAttribute("Name"));
}
}
return fields;
}
示例14: dif_Completed
void dif_Completed(object sender, ExportEventArgs e)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(e.Result);
XmlHelper h = new XmlHelper(doc.DocumentElement);
List<XmlElement> list = new List<XmlElement>(h.GetElements("Command"));
BatchImportForm bf = new BatchImportForm(list);
bf.Completed += new EventHandler(bf_Completed);
bf.ShowDialog();
}
示例15: worker_RunWorkerCompleted
void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
dgData.Rows.Clear();
dgData.Columns.Clear();
XmlHelper rsp = e.Result as XmlHelper;
string uidColumnName = string.Empty;
string lastUpdateColName = string.Empty;
foreach (XmlElement col in rsp.GetElements("Metadata/Column"))
{
string fieldName = col.GetAttribute("Field");
string type = col.GetAttribute("Type");
if (fieldName == "uid" && !string.IsNullOrWhiteSpace(uidColumnName))
continue;
if (fieldName == "last_update" && !string.IsNullOrWhiteSpace(lastUpdateColName))
continue;
string fieldName2 = fieldName + "\n" + type;
string columnName = "col" + col.GetAttribute("Index");
int index = dgData.Columns.Add(columnName, fieldName2);
DataGridViewColumn column = dgData.Columns[index];
column.Tag = col;
if (fieldName == "uid")
uidColumnName = columnName;
if (fieldName == "last_update")
lastUpdateColName = columnName;
if (UDTTable.IsDefaultField(fieldName))
column.ReadOnly = true;
}
foreach (XmlElement record in rsp.GetElements("Record"))
{
int rowIndex = dgData.Rows.Add();
DataGridViewRow row = dgData.Rows[rowIndex];
row.HeaderCell.Value = rowIndex;
XmlHelper h = new XmlHelper(record);
foreach (XmlElement col in h.GetElements("Column"))
{
string columnName = "col" + col.GetAttribute("Index");
string value = col.InnerText;
if (!dgData.Columns.Contains(columnName)) continue;
DataGridViewCell cell = row.Cells[columnName];
cell.Value = value;
cell.Tag = value;
if (columnName == uidColumnName)
row.Tag = value;
}
}
}