public List <ComingledXPathExpressionResult> Calculate(Project project, ElementType elementType, string filterXPath, string valueXPath) { List <IComingledXPathExpressionPart> parts = XmlUtil.ParseComingledXPathExpression(valueXPath); List <ComingledXPathExpressionResult> results = XmlUtil.ComputeComingledXPathExpression(project, elementType, filterXPath, parts); return(results); }
private void UpdatePreview() { EnumValue <ElementType> elementType = (elementTypeComboBox.SelectedItem as EnumValue <ElementType>); previewListView.Items.Clear(); okButton.Enabled = false; if (elementType != null) { List <ComingledXPathExpressionResult> results = null; if (elementTypeComboBox.SelectedIndex < 0 || valueXPathTextBox.Text.IsNullOrEmpty()) { return; } try { results = XmlUtil.ComputeComingledXPathExpression(ProjectContext.Project, elementType.Value, filterXPathTextBox.Text, valueXPathTextBox.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } results.ForEach(o => previewListView.Items.Add(new ListViewItem(new[] { o.ElementName, o.Value }))); okButton.Enabled = true; } }
public List <TemplateOutputDefinitionFilenameResult> Compute(Project project, ElementType elementType, string filterXPath, string rootPath) { string startingPath = rootPath; List <ComingledXPathExpressionResult> results = XmlUtil.ComputeComingledXPathExpression(project, elementType, filterXPath, this); if (!rootPath.EndsWith(@"\")) { startingPath += @"\"; } return(results.Select(r => new TemplateOutputDefinitionFilenameResult(r.Element, r.ElementName, "{0}{1}".FormatString(startingPath, r.Value))).ToList()); }
public ComingledXPathExpressionResult GetValue(XElement element, XmlNamespaceManager nsm, ElementType elementType) { return(XmlUtil.ComputeComingledXPathExpression(element, nsm, elementType, this.XPathParts)); }