Tickaroo / tikxml

Modern XML Parser for Android
Apache License 2.0
423 stars 44 forks source link

DOCTYPE Support #122

Open svedie opened 5 years ago

svedie commented 5 years ago

Hello,

does tikxml support DOCTYPE declaration?

For Example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE EqonomizeDoc>

If yes, how can I implement this?

If not, will it be supported or implemented?

Greetings, svedie

sockeqwe commented 5 years ago

What do you mean with support? By reading xml doctyoes are just ignored. Writing doctypes is not implemented yet if I remember correctly.

svedie notifications@github.com schrieb am Sa., 12. Jan. 2019, 19:51:

Hello,

does tikxml support DOCTYPE declaration?

For Example:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE EqonomizeDoc>

If yes, how can I implement this?

If not, will it be supported or implemented?

Greetings, svedie

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Tickaroo/tikxml/issues/122, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjnrhN6fHp1Vlbv0pC7qJoyN6RhpEmdks5vCi6igaJpZM4Z8y0p .

svedie commented 5 years ago

Yes, I was not precise enough!

I mean writing the Doctype declaration in the XML file, when I write it back to the file system. Reading of the Doctype declaration is not needed.

sockeqwe commented 5 years ago

Yeah, it's more a conceptual problem I think. How do you define doctypes in tikxml? I mean you mostly annotate classes, how do you annotate Dotype definitions? One could add them in TikXml builder globaly, but that would mean Doctypes are written always whenever you are using this instance of tikxml. The real problem is that TikXml misses the concept of a a document.

svedie notifications@github.com schrieb am So., 13. Jan. 2019, 11:40:

Yes, I was not precise enough!

I mean writing the Doctype declaration in the XML file, when I write it back to the file system. Reading of the Doctype declaration is not needed.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Tickaroo/tikxml/issues/122#issuecomment-453818902, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjnrlzQSWBcpfbVx0ow_WYg2kqZWCntks5vCw0LgaJpZM4Z8y0p .

svedie commented 5 years ago

And if the TikXml.Builder has additional method like addTypeAdapter() where the user can add additional header information and this can be what ever he wants?

Therefore if this methode is used, it will be written down, if not, no one is affected.

sockeqwe commented 5 years ago

That would work, however, the consequences are that this doctype is written for all xml output from that TikXml instance. This means if you would like to write XML you always write the doctypes. You can't say on the document X write DocType A, on document Y write DocType B and on document Z don't write any doctype. That might be a problem. Workaround would be to have a TikXml instance for Documents who should contain DocType A, a TikXml instance for Documents who want to contain DocType B and a TikXml instance for Document without doctype definitions. This can escalate quickly. Let me check how other xml parsers deal with that ...

sockeqwe commented 5 years ago

Seems like Jackson nor Simple XML support doctype for same reasons ...

We might could introduce something like interceptors

svedie commented 5 years ago

Thank you for your review.

If the effort is greater than the result, you can close this issue. The resources could be better spend on other features or bugs.

reline commented 4 years ago

@sockeqwe I'd actually be interested in implementing this feature, I'll be doing it regardless in a fork for my use case here but it would be nice to have some direction to see if I can eventually merge it in. Thoughts?