public TargetInfo GetTargetInfo (XPathNavigator linkNode, CustomContext context) { // compute the metadata file name to open XPathExpression localFileExpression = fileExpression.Clone(); localFileExpression.SetContext(context); string file = linkNode.Evaluate(localFileExpression).ToString(); if (String.IsNullOrEmpty(file)) return (null); // load the metadata file XPathDocument metadataDocument = GetDocument(file); if (metadataDocument == null) return (null); // querry the metadata file for the target url and link text XPathNavigator metadataNode = metadataDocument.CreateNavigator(); XPathExpression localUrlExpression = urlExpression.Clone(); localUrlExpression.SetContext(context); string url = metadataNode.Evaluate(localUrlExpression).ToString(); XPathExpression localTextExpression = textExpression.Clone(); localTextExpression.SetContext(context); string text = metadataNode.Evaluate(localTextExpression).ToString(); // return this information TargetInfo info = new TargetInfo(url, text, type); return (info); }
public TargetInfo GetTargetInfo (string file) { XPathDocument document = GetDocument(file); if (document == null) { return(null); } else { XPathNavigator context = document.CreateNavigator(); string url = context.Evaluate(urlExpression).ToString(); string text = context.Evaluate(textExpression).ToString(); TargetInfo info = new TargetInfo(url, text, type); return(info); } }