Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator API returns incorrect line counts for schema and ruleset violations if file uses old Mac-style CR only line endings #550

Open
simon-20 opened this issue Mar 13, 2024 · 2 comments

Comments

@simon-20
Copy link
Contributor

Brief Description
Validator API will return incorrect line counts for schema and ruleset violations if file uses old Mac-style CR only line endings.

The Validator has to manually count lines for violation reporting because it splits up IATI XML activity files by activity, generating a new XML DOM object for each. The code which counts lines just counts LR characters; it is here:

idx = oneIatiActivity.indexOf(10, idx + 1);

This means line counts will be inaccurate if the file uses any single CR as line endings.

Severity
Low

@simon-20 simon-20 changed the title Validator API will return incorrect line counts for schema and ruleset violations if file uses old Mac-style CR only line endings Validator API returns incorrect line counts for schema and ruleset violations if file uses old Mac-style CR only line endings Mar 13, 2024
@simon-20
Copy link
Contributor Author

Although very few desktop/development systems use CR-only line endings, plenty of files in the IATI corpus have mixed line endings where at least some lines are CR. Such files are valid XML.

@simon-20
Copy link
Contributor Author

Problem also exists in getLineStart:

const getLineStart = (xml, subElement) => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant