This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Please consider producing a revised MIME resolver DTD that would be easier to understand. Even after having used it, I cannot remember how it is supposed to work without referring to the docs, and even then it is hard to follow. There would be no compatibility problem with making a new DTD since we would just provide a different processor. Problems with the current version (syntactic, not feature complaints): 1. <exit/> or <resolver mime="null"/>: first, there ought not be equivalent ways of saying the same thing, this just increases confusion. Second, does this exit out of the entire <MIME-resolver>? If so, it is not clearly documented to do so. 2. <MIME-resolver> is mixed-case whereas all other elements and attrs are lower-case. 3. <file> is an odd name for one rule. 4. Why are most rules children of <file> but <xml-rule> is a child of <resolver>? This seems very counterintuitive. If you have resolved it, why are there then more rules inside? Why not just make <pi>, <doctype>, and <element> children of <file> like other things? 5. It is not obvious when reading things what is conjunctive and what disjunctive. I.e. it seems that at least one rule beneath <file> must match - disjunction. It does not appear to be document in the case of <xml-rule>. It would be hard to guess what was meant without carefully reading DTD documentation. This is perhaps the major thing. 6. Messy that ns can be an attr or child of <element> - pick one (child) and stick to it. Suggest a more uniform syntax based more on boolean logic, such as: <mime-resolver> <resolver mime="text/x-ant+xml"> <and> <ext name="xml"/> <xml-element name="project"> <attr name="default"/> <xml-element> </and> </resolver> </mime-resolver> It would be much easier to understand what was meant IMHO. Minor changes would work intuitively, e.g. match a different extension too but check in XML: <mime-resolver> <resolver mime="text/x-ant+xml"> <and> <or> <ext name="xml"/> <ext name="ant"/> </or> <xml-element name="project"> <attr name="default"/> <xml-element> </and> </resolver> </mime-resolver> vs. match a different extension and trust it: <mime-resolver> <resolver mime="text/x-ant+xml"> <or> <and> <ext name="xml"/> <xml-element name="project"> <attr name="default"/> <xml-element> </and> <ext name="ant"/> </or> </resolver> </mime-resolver> cancel with file attrs: <mime-resolver> <exit> <fattr name="not-ant" text="true"/> </exit> <resolver mime="text/x-ant+xml"> <and> <ext name="xml"/> <xml-element name="project"> <attr name="default"/> <xml-element> </and> </resolver> </mime-resolver> Something more like Lisp might even be better: <mime-resolver> <if> <test><fattr name="not-ant" text="true"/></test> <then><fail/></then> <else> <if> <test> <and> <ext name="xml"/> <xml-element name="project"> <attr name="default"/> <xml-element> </and> </test> <then><succeed mime="text/x-ant+xml"/></then> <else><fail/></else> </if> </else> </if> </mime-resolver> where % rule = fattr | ext | xml-element | ... % boolterm = %rule; | and | or | not % mimeterm = succeed | fail | if mime-resolver: (%mimeterm;) if: (test, then, else) test: (%boolterm;) then: (%mimeterm;) else: (%mimeterm;) and: (%boolterm;)+ or: (%boolterm;)+ not: (%boolterm;) succeed: EMPTY; ATTLIST: mime fail: EMPTY
A good proposal, I appreciate mainly explicit <and> and <or> that are not obvious from current doc. 1) <exit/> exits a <file>. 3) <file> rules represents out of band information accessible without reading a file content (except <magic>). 4) <resolver> rules represents a second stage - a file content test for files that passed the first stage. 5) original idea was: element content is disjunctive element attributes are conjunctive. 6) ns attribute is a shortcut for one namespace child. Every element that allows children can contain an attribute if only one choice is required instead of a single child element.
4. - makes sense for performance but with an explicit boolean logic flow, writers of resolvers can do this manually (list out-of-band tests first in the hope that they will short-circuit the in-band tests); and since the resolver is purely declarative, the impl is free to rearrange clauses too (and merge clauses from different resolvers...). 6. - OK but I think it is better to have a simpler DTD that can be understood a little more quickly than to save a little bit of typing, if the semantics are the same.
Set target milestone to TBD
See issue #31977 for justification of increased priority.
Reassigning to new module owner jskrivanek.
I know we have two DTDs. One is simpler, second is complex. The wizard generates the simpler one. If you want something even simpler, feel free to design 3rd DTD and read it.