This file is indexed.

/usr/bin/dtd2vim is in vim-scripts 20130814ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/usr/bin/perl
#
# Author: Mikolaj Machowski ( mikmach AT wp DOT pl )
# Version: 2.0
# License: GPL v. 2
# Date: 25 Apr 2006
#
# Script for creation XML data file for Vim7 XML omni-completion from DTDs
# Requires: perlSGML (tested against 1997Sep18 version)

# USAGE:
#
#    dtd2vim <file.dtd> [<dialectname>]
#
# This command will create file <file.vim> (remove .dtd extension and add .vim;
# other extensions will remain intact).
#
# <dialectname> (not obligatory) will be part of dictionary name and will be
# used as argument for :XMLns command (file name - sans extensions) have to be
# the same.
#
# perlSGML and this script doesn't work with multiple files. User has to
# prepare single DTD file to parse all data.
#
# In created file global variable is named g:xmldata_<dialectname>. When second
# argument wasn't provided 'xxxx' will be used.
# After that place file in:
#
#    ~/.vim/autoload/xml
#
# directory. Of course it can be also global directory or other Vim data
# hierarchy of files. Example for  DocBook 4.4:
# DTD is in file docbook.dtd, call command with
#
#    dtd2vim.pl docbook.dtd docbook44
#
# Put file as:
#   
#    ~/.vim/autoload/xml/docbook44.vim
#
#  Omni-completion for DocBook 4.4 files will be started with:
#
#    :XMLns docbook44
#
#  command.
#
# Potential problems: not always properly detected vimxmlroot.
#
# ChangeLog:
# 1.1 (19 Apr)
#     - commented out generation of * to mark required attributes - too many
#     false positives
#     - skip more DTD keywords: NAME, NUMBER


# License:
#  Copyright (C) 2006 Mikolaj Machowski <mikmach@wp.pl>
#
#  This script is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Library General Public
#  License as published by the Free Software Foundation; either
#  version 2 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Library General Public License for more details.
#
#  You should have received a copy of the GNU Library General Public License
#  along with this library; see the file COPYING.LIB.  If not, write to
#  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
#  Boston, MA 02110-1301, USA.

use SGML::DTD;

if ( $#ARGV < 0 ){
	print "Script generating XML omni completion data file for Vim7\n";
	print "USAGE:\n";
	print "  dtd2vim <filename> [<dialectname>]\n";
	exit 1;
}

open (FILE, "@ARGV[0]") or die "$!";

$dtd = new SGML::DTD;
$dtd->read_dtd(\*FILE);

close FILE;

@top_elements = $dtd->get_top_elements();
$tops = join "', '", @top_elements;
$tops = "'" . $tops . "'";


$" = ","; #" Dirty trick: highlighting cant cope with LIST_SEP. var
@entities_data = $dtd->get_gen_data_ents("0");

@entities = $dtd->get_gen_ents("0");
$ents = join "', '", @entities;
$ents = "'" . $ents . "'";

$output = @ARGV[0];
$output =~ s/\.dtd$//;
$output .= '.vim';
open (DATA, "> $output") or die "$!";

if (@ARGV > 1){
	$dialect = @ARGV[1];
} else {
	$dialect = 'xxxx';
}

print DATA "let g:xmldata_$dialect = {\n";
print DATA "\\ 'vimxmlentities': [$ents],\n";
print DATA "\\ 'vimxmlroot': [$tops],\n";

# Initialize tag info string
$taginfo = '';

@list_of_elements = $dtd->get_elements();
foreach $element (@list_of_elements) {

	# Get possible childs of current element
	@element_childs = $dtd->get_base_children($element);
	@element_childs = (@element_childs, $dtd->get_inc_children($element));
	@element_nochilds = $dtd->get_exc_children($element);
	# Remove pcdata if first value of table
	if ($element_childs[0] =~ /pcdata/) {
		shift @element_childs;
	}
	foreach $child (@element_childs) {
		$i = 0;
		foreach $nochild (@element_nochilds) {
			if ( $child eq $nochild ) {
				$i = $i + 1;
			}
		}
		if ( $i == 0 ) {
			push @children, $child;
		}
	}
	@element_childs = @children;
	undef @children;
	$childs = join "', '", @element_childs;
	$childs = "'" . $childs . "'";
	$childs =~ s/'EMPTY'//;

	if ( $childs =~ '^$') {
		$taginfo .= "\\ '$element': ['/>', ''],\n";
	}

	print DATA "\\ '".$element."': [\n\\ [$childs],\n";

	%element_attributes = $dtd->get_elem_attr($element);
	@attr_names = keys %element_attributes;
	# @attr_values = values %element_attributes;
	print DATA '\ { ';
	$attrs = '';
	foreach $attr_name (@attr_names) {
		foreach $item (@{$element_attributes{$attr_name}}) {
			if ($item !~ /(IMPLIED|FIXED|REQUIRED|CDATA|ID|ENTIT|NAME|NUMBER|NMTOKEN|NOTATION)/) {
				# IDREF, IDREFS, NMTOKENS, ENTITIES will be cared of by super-strings
				push @val, $item;
			}
			#if ($item =~ /REQUIRED/) {
				#push @req, $attr_name;
				#$req{$attr_name} = '1';
				#}
		}
		if (@val) {
			$attr_vls = join "', '", @val;
			$attr_vls = "'" . $attr_vls . "'";
			undef @val;
		}
		$attrs .= "'".$attr_name ."': [$attr_vls], ";
		undef $attr_vls;
	}
	$attrs =~ s/..$//;
	print DATA $attrs;
	print DATA "}\n\\ ],\n";
}

#$req = join "': ['*', ''],\n\\ '", keys %req;
#$req = "\\ '" . $req . "': ['*', '']";
#print DATA "\\ 'vimxmlattrinfo': {\n$req\n\\ },\n";
print DATA "\\ 'vimxmltaginfo': {\n$taginfo\\ }";

# Close big dictionary and add modeline to data file
print DATA "\n\\ }\n\" vim:ft=vim:ff=unix";

# Space necessary to get above line from default 'modelines' range
#
#
#

close DATA or die "$!";

# vim:isk+=$,%:ft=perl:ff=unix:tw=80:fo+=o: