Skip to content

Conversation

@RyosukeFukatani
Copy link
Contributor

@RyosukeFukatani RyosukeFukatani commented Mar 19, 2024

Purpose / Goal

Fixes #620

fxparser -V a.xml with input.xml.

</html> 

On current master.

 if (tagName !== otg.tagName) { ^ TypeError: Cannot read property 'tagName' of undefined at Object.exports.validate (/Users/ryosukefukatani/work/fast-xml-parser/src/validator.js:108:33) at callback (/Users/ryosukefukatani/work/fast-xml-parser/src/cli/cli.js:51:29) at /Users/ryosukefukatani/work/fast-xml-parser/src/cli/cli.js:78:9 at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3) 

With this change.

{ err: { code: 'InvalidTag', msg: "Closing tag 'html' has not been opened.", line: 1, col: 1 } } 

Type

Please mention the type of PR

  • Bug Fix
  • Refactoring / Technology upgrade
  • New Feature

Note : Please ensure that you've read contribution guidelines before raising this PR. If your PR is in progress, please prepend [WIP] in PR title. Your PR will be reviewed when [WIP] will be removed from the PR title.

Bookmark this repository for further updates.

@RyosukeFukatani RyosukeFukatani changed the title [WIP] fix validator bag the case tag is not opened. fix validator bag the case tag is not opened. Mar 19, 2024
@RyosukeFukatani RyosukeFukatani changed the title fix validator bag the case tag is not opened. fix: validator bag when closing tag is not opened. Mar 19, 2024
@RyosukeFukatani RyosukeFukatani changed the title fix: validator bag when closing tag is not opened. [WIP] fix: validator bag when closing tag is not opened. Mar 19, 2024
@amitguptagwl
Copy link
Member

Thanks for your changes. Will wait until the PR is marked as WIP

@RyosukeFukatani
Copy link
Contributor Author

RyosukeFukatani commented Mar 19, 2024

@amitguptagwl
Sorry, I found I should benchmark this PR, but I can't finish benchmark successfully.
Could you help me?

I believe that this PR will make the benchmark hardly any worse.

ryosukefukatani@ryosukenoMacBook-Pro ~/w/fast-xml-parser (master) [1]> node benchmark/XmlParser.js internal/modules/cjs/loader.js:883 throw err; ^ Error: Cannot find module 'benchmark' Require stack: - /Users/ryosukefukatani/work/fast-xml-parser/benchmark/XmlParser.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) at Function.Module._load (internal/modules/cjs/loader.js:725:27) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at Object.<anonymous> (/Users/ryosukefukatani/work/fast-xml-parser/benchmark/XmlParser.js:3:19) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/ryosukefukatani/work/fast-xml-parser/benchmark/XmlParser.js' ] } 
@amitguptagwl
Copy link
Member

You can ignore benchmarking for this change :)

@RyosukeFukatani RyosukeFukatani changed the title [WIP] fix: validator bag when closing tag is not opened. fix: validator bag when closing tag is not opened. Mar 20, 2024
@RyosukeFukatani
Copy link
Contributor Author

@amitguptagwl
Thx! OK, WIP was removed.

@amitguptagwl
Copy link
Member

Failures: 1) XML Validator should not validate xml with unexpected closing tag Message: Expected $.msg = 'Expected closing tag 'tag' (opened in line 1, col 11) instead of closing tag 'tag1'.' to equal 'Closing tag 'tag1' has not been opened.'. Stack: error properties: Object({ something: 'strange' }) Error: Expected $.msg = 'Expected closing tag 'tag' (opened in line 1, col 11) instead of closing tag 'tag1'.' to equal 'Closing tag 'tag1' has not been opened.'. at <Jasmine> at validate (/home/runner/work/fast-xml-parser/fast-xml-parser/spec/validator_spec.js:4:234) at UserContext.<anonymous> (/home/runner/work/fast-xml-parser/fast-xml-parser/spec/validator_spec.js:4:5005) at <Jasmine> 
@RyosukeFukatani
Copy link
Contributor Author

@amitguptagwl
Thx!
I fixed test and checked test result locally.

@amitguptagwl amitguptagwl merged commit a96b968 into NaturalIntelligence:master Mar 24, 2024
@coveralls
Copy link

Coverage Status

coverage: 98.26% (+0.003%) from 98.257%
when pulling b03c968 on RyosukeFukatani:fix/not_opened_tag
into 3ab1b3b on NaturalIntelligence:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants