XMLCoder
XMLCoder copied to clipboard
Question: ways to parse <!DOCTYPE>
It may not be as important as my special use case, I want to parse MusicXML, whose top-level element might either be score-partwise or score-timewise, which is determined by the <!DOCTYPE> meta-element, an example shown below.
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
Wondering if there's any support for decoding <!DOCTYPE>. If not, what change you think might need to support this. Very appreciated.
That's a great question, thank you for raising this @DJBen. My first guess would be to have a closer look at XMLParserDelegate as that's the lowest level API that we have direct access to. If XMLParser and XMLParserDelegate can't handle this, then I'm afraid it would be hard to support it without a custom XML parser. If that's the case, a super hacky quick fix would be to match expected <!DOCTYPE> attributes (is this even called an attribute?) with a regex, otherwise we'd need to wait until a different XML parser can be integrated with XMLCoder (and first of all to decide if that's worth the effort at all).