cake-build / cake-build/cake

XmlPeek with XPath functions

Open
#1,435 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

### What You Are Seeing?

XmlPeek is not working properly with XPath functions.

### What is Expected?

It works.

### What version of Cake are you using?

0.17

### Are you running on a 32 or 64 bit system?

64bit

### What environment are you running on? Windows? Linux? Mac?

Windows 10

### Are you running on a CI Server? If so, which one?

No.

### How Did You Get This To Happen? (Steps to Reproduce)

XmlPeek seems to be not happy with XPath functions. For example, querying string works as expected:

```c#
var packageType = XmlPeek(config, "/Config/Package/@type");
```

But not with functions like `string-length`:

```c#
var packageType = XmlPeek(config, "string-length(/Config/Package/@type)");
```

It throws ` System.Xml.XPath.XPathException` saying `Expression must evaluate to a node-set`.

Contributor guide

Open the contributing guide

Research direction

Start at the XmlPeek entry point and reproduce the two XPath expressions from the issue on Cake 0.17 or the relevant current code. Compare the node-selection query with the string-length query and identify the existing handling for XPath results. Done means XPath functions no longer raise the reported node-set exception while the existing query still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.