blob: cb1c086c59a50b79d89baed8bb4e227d2d79b15a [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!---
MIME resolver description root element.
<p>
<samp>PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN"</samp>
</p>
-->
<!ELEMENT MIME-resolver (file)+ >
<!--
Plugin rule entities:
-->
<!ENTITY % xml-rules-component PUBLIC "-//NetBeans//DTD MIME Resolver XML Rules 1.0//EN" "https://netbeans.org/dtds/mime-resolver-xml-component-1_0.dtd">
%xml-rules-component;
<!--
Update this entity after you plug in a new component.
Update also the public ID version.
You must maintain backwards compatibility.
-->
<!ENTITY % components "(xml-rule)?">
<!---
A file (resource) represents the MIME resolver input.
The resource is tested on attributes obtained from lower layers (OS) such
as extension, header bytes and wrapping <code>FileObject</code> attributes.
Some of them must match to proceed to the <code>resolver</code> element.
<p>
Implementation Note:
Lower level MIME type is obtained by <code>FileUtil.getMIMEType()</code>. It may not be
retrieved by a call to <code>FileObject.getMIMEType</code> to avoid recursion. A better way
to determine MIME type as assigned by the OS may be introduced in the future.
</p>
<p>
Implementation Note:
All other tests are performed by calling appropriate methods on <code>FileObject</code>
so there is a danger of recursion if these call <code>this.getMIMEType()</code>.
</p>
-->
<!ELEMENT file ((ext | mime | magic | fattr)+, (resolver | exit)) >
<!---
Tests resource extension for full equality.
-->
<!ELEMENT ext EMPTY>
<!ATTLIST ext name CDATA #REQUIRED>
<!---
Tests resource MIME type for equality (RFC2045) or suffix equality if it
starts with '+' (RFC 3023).
-->
<!ELEMENT mime EMPTY>
<!ATTLIST mime name CDATA #REQUIRED>
<!---
Look at initial bytes of the file and test for a complete match of masked
bits. The default mask is the hexadecimal byte <samp>FF</samp> repeated as
many times as the <code>hex</code> attribute is long.
E.g. <samp>&lt;magic hex="0a0001" mask="FF00FF"/&gt;</samp>
-->
<!ELEMENT magic EMPTY>
<!ATTLIST magic hex CDATA #REQUIRED>
<!ATTLIST magic mask CDATA #IMPLIED>
<!---
Test on <code>FileObject</code> attributes. Matching attributes are converted
to strings via <code>Object.toString()</code> and compared to the <code>text</code>
attribute.
<p>
<code>FileObject</code> attributes can be used for out-of-band tagging of standard documents.
</p>
-->
<!ELEMENT fattr EMPTY>
<!ATTLIST fattr name CDATA #REQUIRED>
<!ATTLIST fattr text CDATA #REQUIRED>
<!---
You may apply additional rules based on resource content.
The <code>mime</code> element value is returned. Use the reserved value of <code>null</code>
to indicate you are not interested in such files (same as <samp>&lt;exit/&gt;</samp>).
-->
<!ELEMENT resolver %components;>
<!ATTLIST resolver mime CDATA #REQUIRED>
<!---
Declares that this file is not recognized by this resolver.
A shortcut for <samp>&lt;resolver mime="null"/&gt;</samp>.
-->
<!ELEMENT exit EMPTY>