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

Preserve doctype nodes #81

Closed
kddnewton opened this issue Jan 19, 2020 · 9 comments
Closed

Preserve doctype nodes #81

kddnewton opened this issue Jan 19, 2020 · 9 comments
Labels

Comments

@kddnewton
Copy link
Contributor

Hi there!

I've started using the parser in prettier's XML plugin (https://github.com/prettier/plugin-xml). It's really great, thanks for this!

One thing - I can't get doctype nodes from the parser at all (presumably due to https://github.com/SAP/xml-tools/blob/master/packages/parser/lib/lexer.js#L58). I don't know chevrotain's API very well, but does it support adding configuration options or overrides such that I could get those kinds of nodes?

Thanks!

@bd82
Copy link
Member

bd82 commented Jan 20, 2020

Thanks for reporting this @kddeisz 👍

I found the relevant grammar specification:

And will attempt to implement it later today (hopefully).

@kddnewton
Copy link
Contributor Author

@bd82 no worries take your time!

@bd82
Copy link
Member

bd82 commented Jan 20, 2020

no worries take your time!

Hopefully it would not be a large time investment to fix this issue
and also I am interested in having a high quality XML plugin for prettier.

@marceloschreiber even started exploring implementing such a plugin in this repo.

However it is much preferred if it is developed as part of the prettier organization...
and contribute fixes/improvements there...

@kddnewton
Copy link
Contributor Author

Oh nice - yeah very much open to PRs over at prettier/plugin-xml

@bd82
Copy link
Member

bd82 commented Jan 20, 2020

5b4db21

@kddnewton
Copy link
Contributor Author

kddnewton commented Jan 20, 2020 via email

@bd82
Copy link
Member

bd82 commented Jan 20, 2020

Try version 1.0.0 of the Parser.

Note the DOCType may have a full DTD schema specified inline
e.g:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
  <!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>

This is intentionally not supported at this time as it would add too much complexity.
However I think the external DTD schema reference, e.g:

<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
                         "http://docbook.org/xml/4.5/docbookx.dtd">

is the scenario which is more common and important...

@bd82 bd82 added the Parser label Jan 20, 2020
@kddnewton
Copy link
Contributor Author

We can cross that bridge when we come to it. In the meantime I'll close this since it's definitely working for what it needs to do. Thanks so much!

@bd82
Copy link
Member

bd82 commented Jan 21, 2020

You are welcome 😄

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

No branches or pull requests

2 participants