-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
How to whitelist characters in attribute name? #614
Comments
I believe the error must be thrown by the validator. So you can disable validator. Can you share your sample XML please? |
I'm parsing a superset of HTML; see below for snippet. The error is thrown by the
|
For now I worked around this by modifying my node_modules, but that is not maintainable solution in the long run. const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD@\$'; // Note the additional @ and $ I added to fit my needs. Preferably an option which I can pass to the XML parser gets added where I can specify more characters to be valid in the attribute name. |
When you're calling |
Yes; const config = {
allowBooleanAttributes: true,
alwaysCreateTextNode: true,
preserveOrder: true,
parseAttributeValue: false,
htmlEntities: false,
isArray: true,
attributeNamePrefix: '',
ignoreAttributes: false,
unpairedTags: ["hr", "br", "link", "meta"],
stopNodes : [ "*.pre", "*.script"],
processEntities: false,
} |
You shared the config. I was asking what 2nd parameter you're passing in parse method? |
Sorry, I misunderstood your question; this is what I pass to the second parameter in the parse method:
|
pass |
I want to parse markup where there are
$
and other characters in the attribute names.How can I add these characters? Is there already an option?
Right now the parser throws:
Error: Attribute '$banana' is an invalid name
The text was updated successfully, but these errors were encountered: