Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/tools/entity/entvalidate.pl
use strict; | use strict; | ||||
use warnings; | use warnings; | ||||
use XML::LibXML; | use XML::LibXML; | ||||
use lib "."; | |||||
use Entity; | use Entity; | ||||
my $rngschema = XML::LibXML::RelaxNG->new(location => '../../../binaries/system/entity.rng'); | my $rngschema = XML::LibXML::RelaxNG->new(location => '../../../binaries/system/entity.rng'); | ||||
sub escape_xml | sub escape_xml | ||||
{ | { | ||||
my ($t) = @_; | my ($t) = @_; | ||||
$t =~ s/&/&/g; | $t =~ s/&/&/g; | ||||
Show All 30 Lines | sub validate | ||||
my $xml = to_xml(Entity::load_inherited($vfspath)); | my $xml = to_xml(Entity::load_inherited($vfspath)); | ||||
my $doc = XML::LibXML->new->parse_string($xml); | my $doc = XML::LibXML->new->parse_string($xml); | ||||
$rngschema->validate($doc); | $rngschema->validate($doc); | ||||
} | } | ||||
sub check_all | sub check_all | ||||
{ | { | ||||
my @files = Entity::find_entities(); | my @files = Entity::find_entities("public"); | ||||
my $count = 0; | my $count = 0; | ||||
my $failed = 0; | my $failed = 0; | ||||
for my $f (sort @files) { | for my $f (sort @files) { | ||||
next if $f =~ /^template_/; | next if $f =~ /^template_/; | ||||
print "# $f...\n"; | print "# $f...\n"; | ||||
++$count; | ++$count; | ||||
eval { | eval { | ||||
Show All 12 Lines |
Wildfire Games · Phabricator