| <?xml encoding="UTF-8" ?> |
| <!-- |
| |
| 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.1//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 | pattern | name)+, (resolver | exit)) > |
| |
| <!--- |
| Tests resource extension for full equality. If name attribute is empty string |
| (name=""), it matches all files without extension. |
| --> |
| <!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><magic hex="0a0001" mask="FF00FF"/></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> |
| |
| <!--- |
| Search in the file for given pattern in given range. If there is an inner |
| pattern element, it is used only if outer is fulfilled. Searching starts |
| always from the beginning of the file. For example: |
| <p> |
| Pattern <?php in first 255 bytes |
| <pre> |
| <pattern value="<?php" range="255"/> |
| </pre> |
| </p> |
| <p> |
| Pattern <HTML> or <html> in first 255 bytes and pattern <?php in first 4000 bytes. |
| <pre> |
| <pattern value="<HTML>" range="255" ignorecase="true"> |
| <pattern value="<?php" range="4000"/> |
| </pattern> |
| </pre> |
| </p> |
| --> |
| <!ELEMENT pattern (pattern?) > |
| <!-- Pattern to search for. It doesn't support wildcards or regular expressions. --> |
| <!ATTLIST pattern value CDATA #REQUIRED> |
| <!-- Range in bytes from beginning of the file. --> |
| <!ATTLIST pattern range CDATA #REQUIRED> |
| <!-- Whether search is case sensitive. By default it is case sensitive, i.e. ignorecase=false. --> |
| <!ATTLIST pattern ignorecase CDATA #IMPLIED> |
| |
| <!--- |
| Compare filename with given name. |
| For example: |
| <p> |
| Filename matches makefile, Makefile, MaKeFiLe, mymakefile, gnumakefile, makefile1, .... |
| <pre> |
| <name name="makefile" substring="true"/> |
| </pre> |
| </p> |
| <p> |
| Filename exactly matches rakefile or Rakefile. |
| <pre> |
| <name name="rakefile" ignorecase="false"/> |
| <name name="Rakefile" ignorecase="false"/> |
| </pre> |
| </p> |
| --> |
| <!ELEMENT name EMPTY> |
| <!-- Filename to search for. It doesn't support wildcards or regular expressions. --> |
| <!ATTLIST name name CDATA #REQUIRED> |
| <!-- Whether to search for substring or exact match. Default is exact match, i.e. substring=false. --> |
| <!ATTLIST name substring CDATA #IMPLIED> |
| <!-- Whether search is case sensitive. By default it is case insensitive, i.e. ignorecase=true. --> |
| <!ATTLIST name ignorecase CDATA #IMPLIED> |
| |
| <!--- |
| 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><exit/></samp>). |
| --> |
| <!ELEMENT resolver %components;> |
| <!ATTLIST resolver mime CDATA #REQUIRED> |
| |
| <!--- |
| Declares that this file is not recognized by this resolver. |
| A shortcut for <samp><resolver mime="null"/></samp>. |
| For example: |
| <p> |
| Do not resolve *.txt files and do time consuming magic recognition only for not-txt files. |
| <pre> |
| <file> |
| <ext name="txt"/> |
| <exit/> |
| </file> |
| <file> |
| <magic hex="0a0001" mask="FF00FF"/> |
| <resolver mime="text/plain"/> |
| </file> |
| </pre> |
| </p> |
| --> |
| <!ELEMENT exit EMPTY> |