summaryrefslogtreecommitdiff
path: root/other
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2013-02-20 13:11:03 +0100
committerChristian Heimes <christian@python.org>2013-02-20 13:11:03 +0100
commit97decea4eb174a9313f30c629a1afb42646d144b (patch)
tree87d5ecba50785d24bb6f6c08cfb91caacf0ab126 /other
downloaddefusedxml-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.txt3
-rwxr-xr-xother/perl.pl9
-rwxr-xr-xother/php.php13
-rwxr-xr-xother/python-genshi.py9
-rwxr-xr-xother/ruby-hpricot.rb7
-rwxr-xr-xother/ruby-libxml.rb17
-rwxr-xr-xother/ruby-rexml.rb9
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