c# - Having an XPath how to check if it will try to match element or attribute? -


What I really need is a method to identify an XPath 2.0 expression element (s) or attribute (s) that is used to identify

Assume a method with the following prototype:

  for input like XPathResultType IdentifyXPathResultType (string xpath)  

  // Parents [@ id = '1'] / child / child [@name]  

The method should return something like

<

  // Parents [@ id = '1'] / child / children for input such as   XPathResultType.Element  

/ @ Name

method

  XPathResultType.Attribute  

Applying the above example is easy But XPath 2.0 There are many features and is required to implement a smart parser.

Is there a library or feature in JavaScript that can accomplish such a thing?

I need it with client side javascript.

Further solutions are acceptable for .NET in C #. XPath 2.0 defines an example

Examine the example attribute of code> // guardian [@ id = '1'] / child / child / @ ()

in this case true < / Code> Depending on which XPath parser you are using, you may be able to define your own function, which can test for different element types and Heads response items can be returned.

If not, then you also XPath several times, each time tesing against a different data type. However, it looks less than optimal, so the first option is priority.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -