diff options
author | Christian Heimes <christian@python.org> | 2013-02-20 13:11:03 +0100 |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2013-02-20 13:11:03 +0100 |
commit | 97decea4eb174a9313f30c629a1afb42646d144b (patch) | |
tree | 87d5ecba50785d24bb6f6c08cfb91caacf0ab126 /other | |
download | defusedxml-git-97decea4eb174a9313f30c629a1afb42646d144b.tar.gz |
Add missing parser_list argument to sax.make_parser()
The argument is ignored, though. (thanks to Florian Apolloner)
Diffstat (limited to 'other')
-rw-r--r-- | other/README.txt | 3 | ||||
-rwxr-xr-x | other/perl.pl | 9 | ||||
-rwxr-xr-x | other/php.php | 13 | ||||
-rwxr-xr-x | other/python-genshi.py | 9 | ||||
-rwxr-xr-x | other/ruby-hpricot.rb | 7 | ||||
-rwxr-xr-x | other/ruby-libxml.rb | 17 | ||||
-rwxr-xr-x | other/ruby-rexml.rb | 9 |
7 files changed, 67 insertions, 0 deletions
diff --git a/other/README.txt b/other/README.txt new file mode 100644 index 0000000..3d58b0f --- /dev/null +++ b/other/README.txt @@ -0,0 +1,3 @@ +This directory contains test and demo scripts for other frameworks and +languages. I used them to examine the characteristics of XML parsers. + diff --git a/other/perl.pl b/other/perl.pl new file mode 100755 index 0000000..00e8249 --- /dev/null +++ b/other/perl.pl @@ -0,0 +1,9 @@ +#!/usr/bin/perl + +use XML::Simple; +use Data::Dumper; + +$parser = new XML::Simple; +$xml = $parser->XMLin("$ARGV[0]"); +$data = Dumper($xml); +print $data; diff --git a/other/php.php b/other/php.php new file mode 100755 index 0000000..e35665b --- /dev/null +++ b/other/php.php @@ -0,0 +1,13 @@ +#!/usr/bin/php +<?php + +// $options = 0; +// $options = LIBXML_NONET; +$options = LIBXML_NOENT; + +$xml = simplexml_load_file($argv[1], "SimpleXMLElement", $options); +$data = (string)$xml; +echo strlen($data); +echo $data; +?> + diff --git a/other/python-genshi.py b/other/python-genshi.py new file mode 100755 index 0000000..183d1fe --- /dev/null +++ b/other/python-genshi.py @@ -0,0 +1,9 @@ +#!/usr/bin/python +import sys +from pprint import pprint +from genshi.input import XMLParser + +with open(sys.argv[1]) as f: + parser = XMLParser(f) + pprint(list(parser)) + diff --git a/other/ruby-hpricot.rb b/other/ruby-hpricot.rb new file mode 100755 index 0000000..4f47b93 --- /dev/null +++ b/other/ruby-hpricot.rb @@ -0,0 +1,7 @@ +#!/usr/bin/ruby -w +require 'hpricot' + +xml = File.read(ARGV[0]) +doc = Hpricot(xml) +puts doc + diff --git a/other/ruby-libxml.rb b/other/ruby-libxml.rb new file mode 100755 index 0000000..b4af2dd --- /dev/null +++ b/other/ruby-libxml.rb @@ -0,0 +1,17 @@ +#!/usr/bin/ruby -w +require 'libxml' + +include LibXML + +class PostCallbacks + include XML::SaxParser::Callbacks + + def on_start_element(element, attributes) + puts element + end +end + +parser = XML::SaxParser.file(ARGV[0]) +parser.callbacks = PostCallbacks.new +parser.parse + diff --git a/other/ruby-rexml.rb b/other/ruby-rexml.rb new file mode 100755 index 0000000..31727d1 --- /dev/null +++ b/other/ruby-rexml.rb @@ -0,0 +1,9 @@ +#!/usr/bin/ruby -w +require "rexml/document" + +xml = File.read(ARGV[0]) +# REXML::Document.entity_expansion_limit = 1000 +xmldoc = REXML::Document.new(xml) +data = xmldoc.root.text +#puts data.length +puts data |