question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ml_parser - leading '&#' leads to a cryptic error

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

Any attribute value with an leading &# will throw:

Template parse errors:
Unexpected character "'" ("<hello name="{{ name }}" [icon]="'&#[ERROR ->]'"></hello>
<p>
Start editing to see some magic happen :)
"): ng:///AppModule/AppComponent.html@0:36
Unexpected closing tag "hello". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("<hello name="{{ name }}" [icon]="'&#'">[ERROR ->]</hello>
<p>
Start editing to see some magic happen :)
"): ng:///AppModule/AppComponent.html@0:39
Evaluating src/main.ts
Booting application

Expected behavior

  1. The parser should point to the exact issue that an entity was expected. The error message here should be more meaningful. or
  2. The parser should proceed and handle it as text because parser can’t know if it’s an entity. or
  3. or Handle e.g &#333 as ō that’s the behaviour of parse5

But we can definitly improve the error message.

Minimal reproduction of the problem with instructions

https://stackblitz.com/edit/angular-fjgsqz?file=src/app/app.component.html

What is the motivation / use case for changing the behavior?

User should get the correct error message

Environment

Angular version: 6.0.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
manklucommented, Sep 24, 2018

@StarpTech

The second point is that this error is very cryptic

I have never said the error message is good 😏

1reaction
manklucommented, Sep 23, 2018

The parser should proceed and handle it as text because parser can’t know if it’s an entity.

Per html definition, anything that starts with an ampersand is an entity. If you want to output one you should use &amp;.

Handle e.g &#333 as ō that’s the behaviour of parse5

If you use the correct syntax it works: &#333;

Read more comments on GitHub >

github_iconTop Results From Across the Web

XML Parser Error Codes - IBM
XML Parser Error Codes ; 2, The parser found an invalid start of a processing instruction, element, comment, or document type declaration outside...
Read more >
XML document must have a top level element" error message ...
You receive an "XML Parser Error: XML document must have a top level element" error message when you try to assign a record...
Read more >
Practical XML: Parsing - kdgregory.com
Describes how to use the JDK's DOM parser, including validation using both DTD and XML Schema.
Read more >
Cryptic "Script Error." reported in Javascript in Chrome and ...
The "Script error." happens in Firefox, Safari, and Chrome when an exception violates the browser's same-origin policy - i.e. when the error ...
Read more >
Error pushing -meta.xml to scratch org: The processing ...
There is an empty line / blank space before the XML prolog. Clearing out everything before the <xml version... resolved the somewhat cryptic...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found