Error "System.Xml.XPath.XPathException: Expression must evaluate to a node set"No. KBA-01034-3DC3
Last Modified: 04.10.2009
Data Structure and Template Objects have been defined. When opening the edit newsletter page function, the above error message appears.
The field mapping expression is wrong. Verify if the field mapping expression is:
- A valid XPath expression
- Resolves to something in your HTML
- Wikipedia on XPath: http://en.wikipedia.org/wiki/XPath_1.0
- XPath evaluator: http://b-cage.net/code/web/xpath-evaluator.html
To use the XPath evaluator, copy the HTML into the left box (XML), copy the XPath expression into the top box and click Eval. Something should appear in the right 'Result' box, otherwise your XPath expression is wrong.
Fields in Datastructure
- Title field (type text)
- Text field (type HTML)
- For field 'Title' these mappings would be valid:
- //h1[@class='title'] (this approach is recommended, even if you HTML changes, the element would be found because with the class name)
- //div/h1 (this is easier to do and requires no changes in the HTML, like adding the class name, but when the HTML changes, this mapping must be updated)
- In this example, even //h1 would do, because there is only one h1 tag in the whole HTML. For obvious reasons, this doesn't work with more complex real world HTML.
- Text can be mapped in a similar way:
This did not help me!
Please write us an e-mail to email@example.com - we will help you as soon as possible.