Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

XmlForClause object has wrong FirstTokenIndex value in some cases

Open
#119 0 comments 6 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Assessment

This issue has not been assessed yet.

Description

ScriptDom version: 161.9142.1
Compatibility level: 150

Sample code:

SELECT *
    FROM dbo.foo
    FOR XML PATH(''), ROOT ('x'), TYPE

SET @x = (SELECT *
    FROM dbo.foo
    FOR XML PATH(''), ROOT ('x'), TYPE);

Here, in the first case everything is ok: XmlForClause.FirstTokenIndex points to the token representing FOR keyword, the first option points to PATH.

But in the second case (FOR XML used in subquery) XmlForClause.FirstTokenIndex has the same value as for the first option and points to the token representing word PATH which is wrong

Image

XmlForClause.FirstTokenIndex should always point to the FOR keyword.


The same issue applies to JsonForClause.

See also token-index related bug-reports: #118, #90, #91

Dominant language
GAP
Stars
277
Forks
43
Avg merge
6d 17h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/SqlScriptDOM

All issues in microsoft/SqlScriptDOM

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.