]> matita.cs.unibo.it Git - helm.git/commitdiff
* basic infrastructure for collecting statistics
authorLuca Padovani <luca.padovani@unito.it>
Tue, 23 Nov 2004 13:38:52 +0000 (13:38 +0000)
committerLuca Padovani <luca.padovani@unito.it>
Tue, 23 Nov 2004 13:38:52 +0000 (13:38 +0000)
37 files changed:
helm/papers/use_case/stats/CANDIDATI [new file with mode: 0644]
helm/papers/use_case/stats/Makefile
helm/papers/use_case/stats/download_candidates.sh [new file with mode: 0755]
helm/papers/use_case/stats/download_candidates_c1.sh [new file with mode: 0755]
helm/papers/use_case/stats/extract.xsl [new file with mode: 0644]
helm/papers/use_case/stats/group.xsl [new file with mode: 0644]
helm/papers/use_case/stats/groups_dependent_depth.xsl [new file with mode: 0644]
helm/papers/use_case/stats/groups_dependent_size.xsl [new file with mode: 0644]
helm/papers/use_case/stats/mkdiff.cc [new file with mode: 0644]
helm/papers/use_case/stats/mkhtml.xsl
helm/papers/use_case/stats/parse/.cvsignore
helm/papers/use_case/stats/parse/DOMCount/.cvsignore [new file with mode: 0644]
helm/papers/use_case/stats/parse/DOMCount/DOMCount.cpp [new file with mode: 0644]
helm/papers/use_case/stats/parse/DOMCount/DOMCount.hpp [new file with mode: 0644]
helm/papers/use_case/stats/parse/DOMCount/Makefile [new file with mode: 0644]
helm/papers/use_case/stats/parse/DOMCount/Makefile.incl [new file with mode: 0644]
helm/papers/use_case/stats/parse/Makefile
helm/papers/use_case/stats/parse/SAX2Print/.cvsignore [new file with mode: 0644]
helm/papers/use_case/stats/parse/SAX2Print/Makefile [new file with mode: 0644]
helm/papers/use_case/stats/parse/SAX2Print/Makefile.incl [new file with mode: 0644]
helm/papers/use_case/stats/parse/SAX2Print/SAX2Print.cpp [new file with mode: 0644]
helm/papers/use_case/stats/parse/SAX2Print/SAX2Print.hpp [new file with mode: 0644]
helm/papers/use_case/stats/parse/SAX2Print/SAX2PrintHandlers.cpp [new file with mode: 0644]
helm/papers/use_case/stats/parse/SAX2Print/SAX2PrintHandlers.hpp [new file with mode: 0644]
helm/papers/use_case/stats/parse/parse_xmltree.c [new file with mode: 0644]
helm/papers/use_case/stats/parsing_time_expat.sh [new file with mode: 0755]
helm/papers/use_case/stats/parsing_time_libxml2_reader.sh [new file with mode: 0755]
helm/papers/use_case/stats/parsing_time_libxml2_sax2.sh [new file with mode: 0755]
helm/papers/use_case/stats/parsing_time_libxml2_tree.sh [new file with mode: 0755]
helm/papers/use_case/stats/parsing_time_xerces_sax2.sh [new file with mode: 0755]
helm/papers/use_case/stats/parsing_time_xerces_tree.sh [new file with mode: 0755]
helm/papers/use_case/stats/parsing_times.gpscript [new file with mode: 0644]
helm/papers/use_case/stats/parsing_times.sh [new file with mode: 0755]
helm/papers/use_case/stats/serialize_into_text.xsl [new file with mode: 0644]
helm/papers/use_case/stats/stats_candidates.sh [new file with mode: 0755]
helm/papers/use_case/stats/stats_candidates_c1.sh [new file with mode: 0755]
helm/papers/use_case/stats/validating_times.gpscript [new file with mode: 0644]

diff --git a/helm/papers/use_case/stats/CANDIDATI b/helm/papers/use_case/stats/CANDIDATI
new file mode 100644 (file)
index 0000000..9cc2619
--- /dev/null
@@ -0,0 +1,191 @@
+# 
+# CANDIDATI
+# =========
+# 
+# 500  
+#
+cic:/Coq/Reals/Rgeom/isometric_rotation.con.body
+cic:/CoRN/reals/IVT/b_mon'.con.body
+cic:/CoRN/reals/NRootIR/AbsIR_bnd_AbsIR.con.body
+# 
+# 1000
+#
+cic:/Rocq/TreeAutomata/lattice_fixpoint/map_maxi_maxi.con.body
+cic:/Sophia-Antipolis/Float/FroundPlus/radixRangeBoundExp_subproof5.con.body
+cic:/Sophia-Antipolis/Float/FroundPlus/radixRangeBoundExp_subproof0.con.body
+# 
+# 1500
+# 
+cic:/Sophia-Antipolis/MATHS/GROUPS/g2/T4R1.con.body
+cic:/Coq/Reals/RList/RList_P15.con.body
+cic:/Rocq/THREE_GAP/Nat_compl/ge_trans.con.body
+# 
+# 2000
+# 
+cic:/Sophia-Antipolis/Algebra/Parts2/compl_comp_rev.con.body
+cic:/Cachan/SMC/make/BDDmake_node_height_le.con.body
+cic:/Orsay/ExactRealArithmetic/Zsqrt_complements/Zsqrt_sqrt_bis.con.body
+# 
+# 2500
+# 
+cic:/Eindhoven/POCKLINGTON/modprime/techlemma3.con.body
+cic:/Sophia-Antipolis/Cours-de-Coq/Fil/Pairs_are_enough_finite_case.con.body
+cic:/Nijmegen/QArith/Qquadratic_sign/Qquadratic_sign_One_y.con.body
+# 
+# 3000
+# 
+cic:/CoRN/ftc/Integral/partition_join_aux'.con.body
+cic:/Sophia-Antipolis/geometry/reflexion_plane/reflexion_projete_orthogonal_milieu.con.body
+cic:/Sophia-Antipolis/geometry/trigo/trigo_Pythagore.con.body
+# 
+# 3500
+# 
+cic:/CoRN/algebra/CPolynomials/nexp_apply.con.body
+cic:/Sophia-Antipolis/Angles/point_cocyclicite/reciproque_cocyclique.con.body
+cic:/Coq/Reals/Rtrigo/sin_increasing_0.con.body
+# 
+# 4000
+# 
+cic:/CoRN/algebra/CAbGroups/nmult_plus'.con.body
+cic:/CoRN/fta/KeyLemma/lem_1a.con.body
+cic:/Coq/Reals/Exp_prop/exp_form.con.body
+# 
+# 4500
+# 
+cic:/Utrecht/ABP/abp_lem1/CommLs5.con.body
+cic:/CoRN/complex/NRootCC/nrCC4_a1.con.body
+cic:/Coq/Reals/Rpower/ln_continue.con.body
+# 
+# 5000
+# 
+cic:/Sophia-Antipolis/geometry/barycentre/unicite_coor_bar.con.body
+cic:/Dyade/Otway-Rees/inv1rel5/POinv1rel5.con.body
+cic:/CoRN/algebra/CRings/nring_different.con.body
+# 
+# 5500
+# 
+cic:/Sophia-Antipolis/geometry/milieu/milieu_distinct2.con.body
+cic:/Utrecht/ABP/abp_proc/LemLin3.con.body
+cic:/Utrecht/ABP/abp_proc/LemLin6.con.body
+# 
+# 6000
+# 
+cic:/Montevideo/FSSecModel/chownIsSecure/ChownPSP.con.body
+cic:/Sophia-Antipolis/Bertrand/Knuth_why/Prime_po_9_subproof46.con.body
+cic:/Montevideo/FSSecModel/chmodIsSecure/ChmodPSP.con.body
+# 
+# 6500
+# 
+cic:/CoRN/fta/CC_Props/seq_yields_zero.con.body
+cic:/Sophia-Antipolis/Bertrand/Knuth_why/Prime_po_9_subproof58.con.body
+cic:/Nijmegen/QArith/Qpositive_sub/le_minus_left_subproof.con.body
+# 
+# 7000
+# 
+cic:/Nijmegen/QArith/Qpositive_sub/Qpositive_sub_correct.con.body
+cic:/CoRN/algebra/Cauchy_COF/R_inv_ext.con.body
+cic:/Cachan/SMC/config/bs_node_height_right.con.body
+# 
+# 7500
+# 
+cic:/Sophia-Antipolis/Huffman/PBTree2BTree/to_btree_inb.con.body
+cic:/CoRN/reals/Series/ratio_test_div.con.body
+cic:/Sophia-Antipolis/Buchberger/Pminus/minusP_inv3b.con.body
+# 
+# 8000
+# 
+cic:/Rocq/COC/Termes/mem_sort_subst.con.body
+cic:/Sophia-Antipolis/geometry/orthocentre/deux_hauteurs_trois.con.body
+cic:/Rocq/GRAPHS/cgraph/ad_1_path_dist_big_enough_1.con.body
+# 
+# 8500
+# 
+cic:/CoRN/reals/Series/aew_series_conv.con.body
+cic:/Nijmegen/QArith/homographicAcc_Qhomographic_sign/Qhomographic_Qpositive_to_Q_homographicAcc_pos_1.con.body
+cic:/Sophia-Antipolis/Buchberger/Pspoly/fconfl_top.con.body
+# 
+# 9000
+# 
+cic:/Coq/Reals/Ranalysis2/maj_term3.con.body
+cic:/Sophia-Antipolis/geometry/representant_unitaire/unicite_representant_unitaire.con.body
+cic:/Sophia-Antipolis/MATHS/DOMAINS/triple/Triples_are_enough_finite_case.con.body
+# 
+# 9500
+# 
+cic:/CoRN/reals/CauchySeq/str_Archimedes.con.body
+cic:/Coq/romega/ReflOmegaCore/T_OMEGA13_stable.con.body
+cic:/Orsay/Maths/divide/divide_1.con.body
+# 
+# 10000
+# 
+cic:/Nijmegen/QArith/general_Q/Qpositive_c_equal_subproof1.con.body
+cic:/Rocq/TreeAutomata/inter_correct/preDTA_produit_l_ref_ok.con.body
+cic:/Rocq/AILS/ails/step2.con.body
+# 
+# 20000
+# 
+cic:/Sophia-Antipolis/geometry/mesure_algebrique/barycentre_mes_alg.con.body
+cic:/Coq/Reals/Ranalysis1/deriv_maximum.con.body
+cic:/CoRN/ftc/Integral/integral_empty.con.body
+# 
+# 30000
+# 
+cic:/CoRN/reals/iso_CReals/less_pres_Lim.con.body
+cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_plus.con.body
+cic:/CoRN/tactics/RingReflection/PM_plus_corr_R.con.body
+# 
+# 40000
+# 
+cic:/Nijmegen/QArith/Qquadratic_Qpositive_to_Q_properties/Qquadratic_Qpositive_to_Q_0_subproof.con.body
+cic:/Sophia-Antipolis/geometry/barycentre/unicite_coor_bar_aux.con.body
+cic:/CoRN/algebra/COrdCauchy/CS_seq_mult.con.body
+# 
+# 50000
+# 
+cic:/CoRN/transc/Pi/pi_seq_Cauchy.con.body
+cic:/Rocq/TreeAutomata/inter/predta_produit_5.con.body
+cic:/CoRN/ftc/MoreIntervals/compact_in_interval_y_lft.con.body
+# 
+# 60000
+# 
+cic:/CoRN/tactics/FieldReflection/FF_plus_corr_F.con.body
+cic:/Orsay/ExactRealArithmetic/Lemmes_generaux/Zsqr_cond.con.body
+cic:/Rocq/COMPILER/Mini_ML/ML_DS_determ.con.body
+# 
+# 70000
+# 
+cic:/CoRN/reals/IVT/intervals_small''.con.body
+cic:/Sophia-Antipolis/geometry/Plans_paralleles/para_plan_sym.con.body
+cic:/CoRN/ftc/MoreIntegrals/Integral_plus_Integral.con.body
+# 
+# 80000
+# 
+cic:/CoRN/ftc/WeakIVT/a_seq_b_seq_dist_n.con.body
+cic:/Nijmegen/QArith/Qquadratic_Qpositive_to_Qpositive/Qquadratic_Qpositive_to_Qpositive_equal.con.body
+cic:/Sophia-Antipolis/geometry/Droite_plan_espace/points_plan_espace.con.body
+# 
+# 90000
+# 
+cic:/Sophia-Antipolis/Bertrand/Knuth_why/Prime_po_9.con.body
+cic:/CoRN/transc/InvTrigonom/Tan_ilim.con.body
+cic:/Nijmegen/QArith/Qquadratic_Qpositive_to_Q_properties/Qquadratic_Qpositive_to_Q_4_subproof.con.body
+# 
+# 100000
+# 
+cic:/CoRN/tactics/GroupReflection/MM_plus_corr_G.con.body
+cic:/Nijmegen/QArith/Qquadratic_Qpositive_to_Q_properties/Qquadratic_Qpositive_to_Q_5_subproof.con.body
+cic:/Rocq/DEMOS/Demo_AutoRewrite/ResAck0.con.body
+# 
+# 200000
+# 
+cic:/CoRN/ftc/Composition/Derivative_I_comp.con.body
+cic:/CoRN/metrics/Equiv/inv_isopsmetry.con.body
+cic:/Cachan/SMC/mu/mu_eval_lemma2.con.body
+#
+# A NOI CARI
+# ==========
+# 
+# 7211 cic:/Coq/Reals/Rlimit/limit_inv.con.body
+# 3054 cic:/Coq/Reals/Rlimit/limit_mul.con.body
+# 1172 cic:/Coq/Reals/Rlimit/limit_plus.con.body
+# 
index 390a3059a8604a8e9b31e106e9e742c1dc6870e6..1eb180dce9d11fbdf78cc167fa749363c932773f 100644 (file)
@@ -1,4 +1,8 @@
 
+SORT_SIZE = sort -n
+
+SORT_NODES = sort -t ' ' -k 2 -n
+
 TARGETS = con ind var body types proof_tree
 
 STATS_TARGETS = \
@@ -9,9 +13,17 @@ all_xml: $(STATS_TARGETS)
 
 all_html: $(STATS_TARGETS:%.xml=%.html)
 
+all_txt: $(STATS_TARGETS:%.xml=%.txt)
+
 stats: stats.cc
        g++ -o $@ `pkg-config gdome2-cpp-smart --cflags --libs` $<
 
+#%.xml.gz: %.xml
+#      gzip $<
+
+stats_%.xml.gz: stats_%.xml
+       gzip $<
+
 stats_%.xml:
        @echo "<statistics>" >$@
        @find /local/helm/library/coq_contribs/$(CONTRIB) -name "*."$(@:stats_%.xml=%)".xml.gz" -type f -exec ./stats.sh {} \; >>$@
@@ -22,12 +34,82 @@ stats_theories.xml:
        @find /local/helm/library/theories -name "*.xml" -type f -exec ./stats.sh {} \; >>$@
        @echo "</statistics>" >>$@
 
-stats_%.html: stats_%.xml
+stats_%.html: stats_%.xml.gz
        xsltproc mkhtml.xsl $< >$@
 
-stats_%.txt: stats_%.html
-       w3m -cols 132 -dump $< >$@
+stats_%.txt: stats_%.xml.gz extract.xsl
+       xsltproc extract.xsl $< >$@
+
+stats_candidates.xml.gz:
+       ./stats_candidates.sh
+       
+stats_candidates_c1.xml.gz:
+       ./stats_candidates_c1.sh
+
+mkdiff: mkdiff.cc
+       g++ -o $@ $<
+
+parsing_times_%_candidates.txt: parsing_times.sh stats_candidates.txt
+       @echo "Collecting parsing times in CICXML_NOBLANKS_NODTD for $(@:parsing_times_%_candidates.txt=%)..."
+       @./$< CICXML_NOBLANKS_NODTD parsing_time_$(@:parsing_times_%_candidates.txt=%).sh stats_candidates.txt | $(SORT_SIZE) >$@
+
+parsing_times_%_candidates_c1.txt: parsing_times.sh stats_candidates_c1.txt
+       @echo "Collecting parsing times in CONTENTNB for $(@:parsing_times_%_candidates_c1.txt=%)..."
+       @./$< CONTENTNB parsing_time_$(@:parsing_times_%_candidates_c1.txt=%).sh stats_candidates_c1.txt | $(SORT_SIZE) >$@
+
+#parsing_times_%_candidates: parsing_times_%_candidates.sh
+#      sh $< >$@
+
+#parsing_times_%_candidates_c1: parsing_times_%_candidates_c1.sh
+#      sh $< >$@
+
+PARSING_TIMES_TARGETS = libxml2_reader libxml2_sax2 libxml2_tree expat xerces_sax2 xerces_tree
+
+PARSING_TIMES_TARGETS_TXT = \
+  $(PARSING_TIMES_TARGETS:%=parsing_times_%_candidates.txt) \
+  $(PARSING_TIMES_TARGETS:%=parsing_times_%_candidates_c1.txt)
+
+parsing_times_candidates.ps parsing_times_candidates_c1.ps: $(PARSING_TIMES_TARGETS_TXT) parsing_times.gpscript
+       gnuplot parsing_times.gpscript
+
+parsing_times: parsing_times_candidates.ps parsing_times_candidates_c1.ps
+
+stats_candidates_localdtd.txt: stats_candidates.txt
+       sed s/_NODTD/_LOCALDTD/ $< >$@
+
+parsing_validating_times_%_candidates.txt: validating_times.sh stats_candidates_localdtd.txt
+       @echo "Collecting validating times in CICXML_NOBLANKS_LOCALDTD for $(@:parsing_validating_times_%_candidates.txt=%)..."
+       @./$< CICXML_NOBLANKS_LOCALDTD validating_time_$(@:parsing_validating_times_%_candidates.txt=%).sh stats_candidates_localdtd.txt | $(SORT_NODES) >$@
+
+PARSING_VALIDATING_TIMES_TARGETS = libxml2_tree xerces_sax2 xerces_tree flea
+
+PARSING_VALIDATING_TIMES_TARGETS_TXT = \
+  $(PARSING_VALIDATING_TIMES_TARGETS:%=parsing_validating_times_%_candidates.txt)
+
+validating_times_libxml2_tree_candidates.txt: parsing_validating_times_libxml2_tree_candidates.txt parsing_times_libxml2_tree_candidates.txt
+       @$(SORT_NODES) parsing_times_libxml2_tree_candidates.txt | ./mkdiff $^ >$@
+
+validating_times_xerces_sax2_candidates.txt: parsing_validating_times_xerces_sax2_candidates.txt parsing_times_xerces_sax2_candidates.txt
+       @$(SORT_NODES) parsing_times_xerces_sax2_candidates.txt | ./mkdiff $^ >$@
+
+validating_times_xerces_tree_candidates.txt: parsing_validating_times_xerces_tree_candidates.txt parsing_times_xerces_tree_candidates.txt
+       @$(SORT_NODES) parsing_times_xerces_tree_candidates.txt | ./mkdiff $^ >$@
+
+validating_times_flea_candidates.txt: parsing_validating_times_flea_candidates.txt parsing_times_libxml2_sax2_candidates.txt
+       @$(SORT_NODES) parsing_times_libxml2_sax2_candidates.txt | ./mkdiff $^ >$@
+
+VALIDATING_TIMES_TARGETS = libxml2_tree xerces_sax2 xerces_tree flea
+
+VALIDATING_TIMES_TARGETS_TXT = \
+  $(VALIDATING_TIMES_TARGETS:%=validating_times_%_candidates.txt)
+
+parsing_validating_times_candidates.ps validating_times_candidates.ps: $(VALIDATING_TIMES_TARGETS_TXT) $(PARSING_VALIDATING_TIMES_TARGETS_TXT) validating_times.gpscript
+       gnuplot validating_times.gpscript
+
+validating_times: parsing_validating_times_candidates.ps validating_times_candidates.ps
 
 clean:
-       rm -f stats.{xml,html,txt}
+       rm -f stats_candidates*.{xml,html,txt} \
+         $(PARSING_TIMES_TARGETS_TXT) \
+         $(VALIDATING_TIMES_TARGETS_TXT)
 
diff --git a/helm/papers/use_case/stats/download_candidates.sh b/helm/papers/use_case/stats/download_candidates.sh
new file mode 100755 (executable)
index 0000000..e2265c4
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+for i in `fgrep -v '#' CANDIDATI`; do
+  DEST=`echo $i | tr ":/'" '_' `
+  wget -O CICXML/$DEST "http://mowgli.cs.unibo.it:58081/getxml?uri="$i
+  gzip CICXML/$DEST
+done
diff --git a/helm/papers/use_case/stats/download_candidates_c1.sh b/helm/papers/use_case/stats/download_candidates_c1.sh
new file mode 100755 (executable)
index 0000000..9dfaade
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+for i in `fgrep -v '#' CANDIDATI`; do
+  DEST=`echo $i | tr ":/'" '_' `
+  #wget -O CONTENT/$DEST "http://mowgli.cs.unibo.it:58080/apply?profile=default&param.profile=default&prop.media-type=text/xml&prop.method=xml&prop.encoding=utf-8&keys=C1&xmluri=http://mowgli.cs.unibo.it:58081/getxml%3Furi%3D"$i
+  wget -O CONTENTNB/$DEST "http://mowgli.cs.unibo.it:58080/apply?profile=default&param.profile=default&prop.media-type=text/xml&prop.method=xml&prop.encoding=utf-8&keys=C1&xmluri=http://mowgli.cs.unibo.it/~lpadovan/CICXMLNB/"$DEST
+  gzip CONTENTNB/$DEST
+done
+
diff --git a/helm/papers/use_case/stats/extract.xsl b/helm/papers/use_case/stats/extract.xsl
new file mode 100644 (file)
index 0000000..74d2865
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="1.0"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xlink="http://www.w3.org/1999/xlink"
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:box="http://helm.cs.unibo.it/2003/BoxML"
+>
+
+<xsl:param name="uri" select="''"/>
+
+<xsl:output method="text"/>
+
+<xsl:template match="/">
+ <xsl:choose>
+  <xsl:when test="$uri=''">
+   <xsl:apply-templates select="statistics/stats"/>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:apply-templates select="statistics/stats[@for=$uri]"/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="stats">
+  <xsl:value-of select="@for"/>
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="size"/>
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="number(elements/total) + number(text-nodes/total)"/>
+  <!--<xsl:text> </xsl:text>
+  <xsl:value-of select="depth/max"/>-->
+  <xsl:text>
+</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/helm/papers/use_case/stats/group.xsl b/helm/papers/use_case/stats/group.xsl
new file mode 100644 (file)
index 0000000..8d25fee
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:param name="cluster" select="50000"/>
+<xsl:param name="upper_limit" select="1200000"/>
+
+<xsl:output method="xml"/>
+
+<xsl:template match="/">
+<groups>
+  <xsl:call-template name="group-by-nodes"/>
+</groups>
+</xsl:template>
+
+<xsl:template name="group-by-nodes">
+  <xsl:param name="base" select="0"/>
+  <xsl:if test="$base &lt;= $upper_limit">
+    <xsl:variable name="count" select="count(//stats[number(elements/total) + number(text-nodes/total) &gt;= $base
+                                                     and number(elements/total) + number(text-nodes/total) &lt; $base + $cluster])"/>
+    <group begin="{$base}" end="{$base + $cluster}">
+      <xsl:value-of select="$count"/>
+    </group>
+    <xsl:call-template name="group-by-nodes">
+      <xsl:with-param name="base" select="$base + $cluster"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/helm/papers/use_case/stats/groups_dependent_depth.xsl b/helm/papers/use_case/stats/groups_dependent_depth.xsl
new file mode 100644 (file)
index 0000000..ff3439c
--- /dev/null
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="1.0"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xlink="http://www.w3.org/1999/xlink"
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:box="http://helm.cs.unibo.it/2003/BoxML"
+>
+
+<xsl:param name="size_min" select="500"/>
+<xsl:param name="size_max" select="10000"/>
+<xsl:param name="perc" select="0.01"/>
+<xsl:param name="step" select="500"/>
+
+<xsl:template match="/">
+  <html>
+    <body>
+      <xsl:call-template name="find-dep"/>
+    </body>
+  </html>  
+</xsl:template>
+
+<xsl:template name="find-dep">
+  <xsl:param name="size" select="$size_min"/>
+  <xsl:variable name="range" select="$size * $perc"/>
+  <xsl:if test="$size &lt;= $size_max">
+    <table border="1">
+      <tr>
+        <th>N</th>
+         <th>Size (bytes)</th>
+         <th>Elements</th>
+         <th>Max depth</th>
+         <!--
+         <th>Text nodes</th>
+         <th>Total nodes</th>
+         <th>Leaf avg</th>
+         <th>Max width</th>
+         <th>Inner avg width</th>
+         <th>Max attributes</th>
+         <th>Total attributes</th>
+         -->
+         <th>Object</th>
+       </tr>
+      <xsl:apply-templates select="statistics/stats[number(elements/total) &gt;= $size - $range
+                                                    and number(elements/total) &lt;= $size + $range]">
+        <xsl:sort order="ascending" data-type="number" select="number(depth/max)"/>
+      </xsl:apply-templates>
+    </table>
+    <xsl:call-template name="find-dep">
+      <xsl:with-param name="size" select="$size + $step"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="stats">
+  <tr>
+    <td align="left">
+      <xsl:value-of select="position()"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="size"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="number(elements/total)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="depth/max"/>
+    </td>
+    <!--
+    <td align="left">
+      <xsl:value-of select="number(text-nodes/total)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="number(elements/total) + number(text-nodes/total)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="round(depth/leaf-avg)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="width/max"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="round(width/inner-avg)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="attributes/max"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="attributes/total"/>
+    </td>
+    -->
+    <th align="left">
+      <xsl:value-of select="substring(@for,21)"/>
+    </th>
+  </tr>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/helm/papers/use_case/stats/groups_dependent_size.xsl b/helm/papers/use_case/stats/groups_dependent_size.xsl
new file mode 100644 (file)
index 0000000..48ff697
--- /dev/null
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="1.0"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xlink="http://www.w3.org/1999/xlink"
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:box="http://helm.cs.unibo.it/2003/BoxML"
+>
+
+<xsl:param name="size_min" select="1"/>
+<xsl:param name="size_max" select="200"/>
+<xsl:param name="perc" select="0.03"/>
+<xsl:param name="step" select="10"/>
+
+<xsl:template match="/">
+  <html>
+    <body>
+      <xsl:call-template name="find-dep"/>
+    </body>
+  </html>  
+</xsl:template>
+
+<xsl:template name="find-dep">
+  <xsl:param name="size" select="$size_min"/>
+  <xsl:variable name="range" select="$size * $perc"/>
+  <xsl:if test="$size &lt;= $size_max">
+    <table border="1">
+      <tr>
+        <th>N</th>
+         <th>Size (bytes)</th>
+         <th>Elements</th>
+         <th>Max depth</th>
+         <!--
+         <th>Text nodes</th>
+         <th>Total nodes</th>
+         <th>Leaf avg</th>
+         <th>Max width</th>
+         <th>Inner avg width</th>
+         <th>Max attributes</th>
+         <th>Total attributes</th>
+         -->
+         <th>Object</th>
+       </tr>
+      <xsl:apply-templates select="statistics/stats[number(depth/max) &gt;= $size - $range
+                                                    and number(depth/max) &lt;= $size + $range]">
+        <xsl:sort order="ascending" data-type="number" select="number(elements/total)"/>
+      </xsl:apply-templates>
+    </table>
+    <xsl:call-template name="find-dep">
+      <xsl:with-param name="size" select="$size + $step"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="stats">
+  <tr>
+    <td align="left">
+      <xsl:value-of select="position()"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="size"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="number(elements/total)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="depth/max"/>
+    </td>
+    <!--
+    <td align="left">
+      <xsl:value-of select="number(text-nodes/total)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="number(elements/total) + number(text-nodes/total)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="round(depth/leaf-avg)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="width/max"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="round(width/inner-avg)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="attributes/max"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="attributes/total"/>
+    </td>
+    -->
+    <th align="left">
+      <xsl:value-of select="substring(@for,21)"/>
+    </th>
+  </tr>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/helm/papers/use_case/stats/mkdiff.cc b/helm/papers/use_case/stats/mkdiff.cc
new file mode 100644 (file)
index 0000000..aed015d
--- /dev/null
@@ -0,0 +1,26 @@
+
+#include <iostream>
+#include <fstream>
+#include <cassert>
+
+main(int argc, char* argv[])
+{
+       std::ifstream f(argv[1]);
+
+       int size, nodes, parsing_time;
+       int size1, nodes1, validating_time;
+
+       while (std::cin >> size) {
+               std::cin >> nodes;
+               std::cin >> parsing_time;
+
+               f >> size1;
+               f >> nodes1;
+               f >> validating_time;
+
+               assert(size == size1);
+               assert(nodes == nodes1);
+               std::cout << size << " " << nodes << " " << (validating_time - parsing_time) << std::endl;
+       }
+}
+
index 597d15e412ec1ec6ca136945964612b7b889194a..a61576aecfa3cca7d248d9549faccaf00f59d8e9 100644 (file)
         <tr>
          <th>N</th>
          <th>Size (bytes)</th>
-         <th>Nodes</th>
-         <th>Inner nodes</th>
-         <th>Leaf elements</th>
-         <th>Text nodes</th>
+         <th>Elements</th>
          <th>Max depth</th>
+         <!--
+         <th>Text nodes</th>
+         <th>Total nodes</th>
          <th>Leaf avg</th>
          <th>Max width</th>
          <th>Inner avg width</th>
          <th>Max attributes</th>
          <th>Total attributes</th>
+         -->
          <th>Object</th>
        </tr>
         <xsl:apply-templates select="statistics/stats">
-         <xsl:sort order="descending" data-type="number" select="number(elements/total) + number(text-nodes/total)"/>
+         <xsl:sort order="descending" data-type="number" select="number(elements/total)"/>
        </xsl:apply-templates>
       </table>
     </body>
       <xsl:value-of select="size"/>
     </td>
     <td align="left">
-      <xsl:value-of select="number(elements/total) + number(text-nodes/total)"/>
-    </td>
-    <td align="left">
-      <xsl:value-of select="number(elements/total) - number(elements/leaf)"/>
+      <xsl:value-of select="number(elements/total)"/>
     </td>
     <td align="left">
-      <xsl:value-of select="number(elements/leaf)"/>
+      <xsl:value-of select="depth/max"/>
     </td>
+    <!--
     <td align="left">
       <xsl:value-of select="number(text-nodes/total)"/>
     </td>
     <td align="left">
-      <xsl:value-of select="depth/max"/>
+      <xsl:value-of select="number(elements/total) + number(text-nodes/total)"/>
     </td>
     <td align="left">
       <xsl:value-of select="round(depth/leaf-avg)"/>
@@ -73,8 +72,9 @@
     <td align="left">
       <xsl:value-of select="attributes/total"/>
     </td>
+    -->
     <th align="left">
-      <xsl:value-of select="substring(@for,21)"/>
+      <xsl:value-of select="@for"/>
     </th>
   </tr>
 </xsl:template>
index 866398111b6987d9e47d955a174f4927e20ced63..b84979dd269ffa635f17034ca85fc92fc30addfc 100644 (file)
@@ -1,3 +1,4 @@
 parse_expat
 parse_xmlreader
 parse_xmlsax
+parse_xmltree
diff --git a/helm/papers/use_case/stats/parse/DOMCount/.cvsignore b/helm/papers/use_case/stats/parse/DOMCount/.cvsignore
new file mode 100644 (file)
index 0000000..4783afa
--- /dev/null
@@ -0,0 +1 @@
+DOMCount
diff --git a/helm/papers/use_case/stats/parse/DOMCount/DOMCount.cpp b/helm/papers/use_case/stats/parse/DOMCount/DOMCount.cpp
new file mode 100644 (file)
index 0000000..8a5b4f5
--- /dev/null
@@ -0,0 +1,460 @@
+/*
+ * Copyright 1999-2002,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+/*
+ * $Id$
+ */
+
+// ---------------------------------------------------------------------------
+//  Includes
+// ---------------------------------------------------------------------------
+#include <xercesc/util/PlatformUtils.hpp>
+#include <xercesc/parsers/AbstractDOMParser.hpp>
+#include <xercesc/dom/DOMImplementation.hpp>
+#include <xercesc/dom/DOMImplementationLS.hpp>
+#include <xercesc/dom/DOMImplementationRegistry.hpp>
+#include <xercesc/dom/DOMBuilder.hpp>
+#include <xercesc/dom/DOMException.hpp>
+#include <xercesc/dom/DOMDocument.hpp>
+#include <xercesc/dom/DOMNodeList.hpp>
+#include <xercesc/dom/DOMError.hpp>
+#include <xercesc/dom/DOMLocator.hpp>
+#include <xercesc/dom/DOMNamedNodeMap.hpp>
+#include <xercesc/dom/DOMAttr.hpp>
+#include "DOMCount.hpp"
+#include <string.h>
+#include <stdlib.h>
+
+#if defined(XERCES_NEW_IOSTREAMS)
+#include <fstream>
+#else
+#include <fstream.h>
+#endif
+
+
+// ---------------------------------------------------------------------------
+//  This is a simple program which invokes the DOMParser to build a DOM
+//  tree for the specified input file. It then walks the tree and counts
+//  the number of elements. The element count is then printed.
+// ---------------------------------------------------------------------------
+static void usage()
+{
+    XERCES_STD_QUALIFIER cout << "\nUsage:\n"
+            "    DOMCount [options] <XML file | List file>\n\n"
+            "This program invokes the DOMBuilder, builds the DOM tree,\n"
+            "and then prints the number of elements found in each XML file.\n\n"
+            "Options:\n"
+            "    -l          Indicate the input file is a List File that has a list of xml files.\n"
+            "                Default to off (Input file is an XML file).\n"
+            "    -v=xxx      Validation scheme [always | never | auto*].\n"
+            "    -n          Enable namespace processing. Defaults to off.\n"
+            "    -s          Enable schema processing. Defaults to off.\n"
+            "    -f          Enable full schema constraint checking. Defaults to off.\n"
+            "    -locale=ll_CC specify the locale, default: en_US.\n"
+            "    -p          Print out names of elements and attributes encountered.\n"
+                   "    -?          Show this help.\n\n"
+            "  * = Default if not provided explicitly.\n"
+         << XERCES_STD_QUALIFIER endl;
+}
+
+
+
+// ---------------------------------------------------------------------------
+//
+//  Recursively Count up the total number of child Elements under the specified Node.
+//  Process attributes of the node, if any.
+//
+// ---------------------------------------------------------------------------
+static int countChildElements(DOMNode *n, bool printOutEncounteredEles)
+{
+    DOMNode *child;
+    int count = 0;
+    if (n) {
+        if (n->getNodeType() == DOMNode::ELEMENT_NODE)
+               {
+            if(printOutEncounteredEles) {
+                char *name = XMLString::transcode(n->getNodeName());
+                XERCES_STD_QUALIFIER cout <<"----------------------------------------------------------"<<XERCES_STD_QUALIFIER endl;
+                XERCES_STD_QUALIFIER cout <<"Encountered Element : "<< name << XERCES_STD_QUALIFIER endl;
+                
+                XMLString::release(&name);
+                       
+                if(n->hasAttributes()) {
+                    // get all the attributes of the node
+                    DOMNamedNodeMap *pAttributes = n->getAttributes();
+                    int nSize = pAttributes->getLength();
+                    XERCES_STD_QUALIFIER cout <<"\tAttributes" << XERCES_STD_QUALIFIER endl;
+                    XERCES_STD_QUALIFIER cout <<"\t----------" << XERCES_STD_QUALIFIER endl;
+                    for(int i=0;i<nSize;++i) {
+                        DOMAttr *pAttributeNode = (DOMAttr*) pAttributes->item(i);
+                        // get attribute name
+                        char *name = XMLString::transcode(pAttributeNode->getName());
+                        
+                        XERCES_STD_QUALIFIER cout << "\t" << name << "=";
+                        XMLString::release(&name);
+                        
+                        // get attribute type
+                        name = XMLString::transcode(pAttributeNode->getValue());
+                        XERCES_STD_QUALIFIER cout << name << XERCES_STD_QUALIFIER endl;
+                        XMLString::release(&name);
+                    }
+                }
+            }
+                       ++count;
+               }
+        for (child = n->getFirstChild(); child != 0; child=child->getNextSibling())
+            count += countChildElements(child, printOutEncounteredEles);
+    }
+    return count;
+}
+
+// ---------------------------------------------------------------------------
+//
+//   main
+//
+// ---------------------------------------------------------------------------
+int main(int argC, char* argV[])
+{
+
+    // Check command line and extract arguments.
+    if (argC < 2)
+    {
+        usage();
+        return 1;
+    }
+
+    const char*                xmlFile = 0;
+    AbstractDOMParser::ValSchemes valScheme = AbstractDOMParser::Val_Auto;
+    bool                       doNamespaces       = false;
+    bool                       doSchema           = false;
+    bool                       schemaFullChecking = false;
+    bool                       doList = false;
+    bool                       errorOccurred = false;
+    bool                       recognizeNEL = false;
+    bool                       printOutEncounteredEles = false;
+    char                       localeStr[64];
+    memset(localeStr, 0, sizeof localeStr);
+
+    int argInd;
+    for (argInd = 1; argInd < argC; argInd++)
+    {
+        // Break out on first parm not starting with a dash
+        if (argV[argInd][0] != '-')
+            break;
+
+        // Watch for special case help request
+        if (!strcmp(argV[argInd], "-?"))
+        {
+            usage();
+            return 2;
+        }
+         else if (!strncmp(argV[argInd], "-v=", 3)
+              ||  !strncmp(argV[argInd], "-V=", 3))
+        {
+            const char* const parm = &argV[argInd][3];
+
+            if (!strcmp(parm, "never"))
+                valScheme = AbstractDOMParser::Val_Never;
+            else if (!strcmp(parm, "auto"))
+                valScheme = AbstractDOMParser::Val_Auto;
+            else if (!strcmp(parm, "always"))
+                valScheme = AbstractDOMParser::Val_Always;
+            else
+            {
+                XERCES_STD_QUALIFIER cerr << "Unknown -v= value: " << parm << XERCES_STD_QUALIFIER endl;
+                return 2;
+            }
+        }
+         else if (!strcmp(argV[argInd], "-n")
+              ||  !strcmp(argV[argInd], "-N"))
+        {
+            doNamespaces = true;
+        }
+         else if (!strcmp(argV[argInd], "-s")
+              ||  !strcmp(argV[argInd], "-S"))
+        {
+            doSchema = true;
+        }
+         else if (!strcmp(argV[argInd], "-f")
+              ||  !strcmp(argV[argInd], "-F"))
+        {
+            schemaFullChecking = true;
+        }
+         else if (!strcmp(argV[argInd], "-l")
+              ||  !strcmp(argV[argInd], "-L"))
+        {
+            doList = true;
+        }
+         else if (!strcmp(argV[argInd], "-special:nel"))
+        {
+            // turning this on will lead to non-standard compliance behaviour
+            // it will recognize the unicode character 0x85 as new line character
+            // instead of regular character as specified in XML 1.0
+            // do not turn this on unless really necessary
+
+             recognizeNEL = true;
+        }
+         else if (!strcmp(argV[argInd], "-p")
+              ||  !strcmp(argV[argInd], "-P"))
+        {
+            printOutEncounteredEles = true;
+        }
+         else if (!strncmp(argV[argInd], "-locale=", 8))
+        {
+             // Get out the end of line
+             strcpy(localeStr, &(argV[argInd][8]));
+        }                      
+         else
+        {
+            XERCES_STD_QUALIFIER cerr << "Unknown option '" << argV[argInd]
+                 << "', ignoring it\n" << XERCES_STD_QUALIFIER endl;
+        }
+    }
+
+    //
+    //  There should be only one and only one parameter left, and that
+    //  should be the file name.
+    //
+    if (argInd != argC - 1)
+    {
+        usage();
+        return 1;
+    }
+
+    // Initialize the XML4C system
+    try
+    {
+        if (strlen(localeStr))
+        {
+            XMLPlatformUtils::Initialize(localeStr);
+        }
+        else
+        {
+            XMLPlatformUtils::Initialize();
+        }
+
+        if (recognizeNEL)
+        {
+            XMLPlatformUtils::recognizeNEL(recognizeNEL);
+        }
+    }
+
+    catch (const XMLException& toCatch)
+    {
+         XERCES_STD_QUALIFIER cerr << "Error during initialization! :\n"
+              << StrX(toCatch.getMessage()) << XERCES_STD_QUALIFIER endl;
+         return 1;
+    }
+
+    // Instantiate the DOM parser.
+    static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
+    DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS);
+    DOMBuilder        *parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
+
+    parser->setFeature(XMLUni::fgDOMNamespaces, doNamespaces);
+    parser->setFeature(XMLUni::fgXercesSchema, doSchema);
+    parser->setFeature(XMLUni::fgXercesSchemaFullChecking, schemaFullChecking);
+
+    if (valScheme == AbstractDOMParser::Val_Auto)
+    {
+        parser->setFeature(XMLUni::fgDOMValidateIfSchema, true);
+    }
+    else if (valScheme == AbstractDOMParser::Val_Never)
+    {
+        parser->setFeature(XMLUni::fgDOMValidation, false);
+    }
+    else if (valScheme == AbstractDOMParser::Val_Always)
+    {
+        parser->setFeature(XMLUni::fgDOMValidation, true);
+    }
+
+    // enable datatype normalization - default is off
+    parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
+
+    // And create our error handler and install it
+    DOMCountErrorHandler errorHandler;
+    parser->setErrorHandler(&errorHandler);
+
+    //
+    //  Get the starting time and kick off the parse of the indicated
+    //  file. Catch any exceptions that might propogate out of it.
+    //
+    unsigned long duration;
+
+    bool more = true;
+    XERCES_STD_QUALIFIER ifstream fin;
+
+    // the input is a list file
+    if (doList)
+        fin.open(argV[argInd]);
+
+    if (fin.fail()) {
+        XERCES_STD_QUALIFIER cerr <<"Cannot open the list file: " << argV[argInd] << XERCES_STD_QUALIFIER endl;
+        return 2;
+    }
+
+    while (more)
+    {
+        char fURI[1000];
+        //initialize the array to zeros
+        memset(fURI,0,sizeof(fURI));
+
+        if (doList) {
+            if (! fin.eof() ) {
+                fin.getline (fURI, sizeof(fURI));
+                if (!*fURI)
+                    continue;
+                else {
+                    xmlFile = fURI;
+                    XERCES_STD_QUALIFIER cerr << "==Parsing== " << xmlFile << XERCES_STD_QUALIFIER endl;
+                }
+            }
+            else
+                break;
+        }
+        else {
+            xmlFile = argV[argInd];
+            more = false;
+        }
+
+        //reset error count first
+        errorHandler.resetErrors();
+
+        XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc = 0;
+
+        try
+        {
+            // reset document pool
+            parser->resetDocumentPool();
+
+            const unsigned long startMillis = XMLPlatformUtils::getCurrentMillis();
+            doc = parser->parseURI(xmlFile);
+            const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis();
+            duration = endMillis - startMillis;
+        }
+
+        catch (const XMLException& toCatch)
+        {
+            XERCES_STD_QUALIFIER cerr << "\nError during parsing: '" << xmlFile << "'\n"
+                 << "Exception message is:  \n"
+                 << StrX(toCatch.getMessage()) << "\n" << XERCES_STD_QUALIFIER endl;
+            errorOccurred = true;
+            continue;
+        }
+        catch (const DOMException& toCatch)
+        {
+            const unsigned int maxChars = 2047;
+            XMLCh errText[maxChars + 1];
+
+            XERCES_STD_QUALIFIER cerr << "\nDOM Error during parsing: '" << xmlFile << "'\n"
+                 << "DOMException code is:  " << toCatch.code << XERCES_STD_QUALIFIER endl;
+
+            if (DOMImplementation::loadDOMExceptionMsg(toCatch.code, errText, maxChars))
+                 XERCES_STD_QUALIFIER cerr << "Message is: " << StrX(errText) << XERCES_STD_QUALIFIER endl;
+
+            errorOccurred = true;
+            continue;
+        }
+        catch (...)
+        {
+            XERCES_STD_QUALIFIER cerr << "\nUnexpected exception during parsing: '" << xmlFile << "'\n";
+            errorOccurred = true;
+            continue;
+        }
+
+        //
+        //  Extract the DOM tree, get the list of all the elements and report the
+        //  length as the count of elements.
+        //
+        if (errorHandler.getSawErrors())
+        {
+            XERCES_STD_QUALIFIER cout << "\nErrors occurred, no output available\n" << XERCES_STD_QUALIFIER endl;
+            errorOccurred = true;
+        }
+         else
+        {
+            unsigned int elementCount = 0;
+            if (doc) {
+                elementCount = countChildElements((DOMNode*)doc->getDocumentElement(), printOutEncounteredEles);
+                // test getElementsByTagName and getLength
+                XMLCh xa[] = {chAsterisk, chNull};
+                if (elementCount != doc->getElementsByTagName(xa)->getLength()) {
+                    XERCES_STD_QUALIFIER cout << "\nErrors occurred, element count is wrong\n" << XERCES_STD_QUALIFIER endl;
+                    errorOccurred = true;
+                }
+            }
+            // Print out the stats that we collected and time taken.
+            XERCES_STD_QUALIFIER cout << duration << XERCES_STD_QUALIFIER endl;
+        }
+    }
+
+    //
+    //  Delete the parser itself.  Must be done prior to calling Terminate, below.
+    //
+    parser->release();
+
+    // And call the termination method
+    XMLPlatformUtils::Terminate();
+
+    if (doList)
+        fin.close();
+
+    if (errorOccurred)
+        return 4;
+    else
+        return 0;
+}
+
+
+
+
+
+DOMCountErrorHandler::DOMCountErrorHandler() :
+
+    fSawErrors(false)
+{
+}
+
+DOMCountErrorHandler::~DOMCountErrorHandler()
+{
+}
+
+
+// ---------------------------------------------------------------------------
+//  DOMCountHandlers: Overrides of the DOM ErrorHandler interface
+// ---------------------------------------------------------------------------
+bool DOMCountErrorHandler::handleError(const DOMError& domError)
+{
+    fSawErrors = true;
+    if (domError.getSeverity() == DOMError::DOM_SEVERITY_WARNING)
+        XERCES_STD_QUALIFIER cerr << "\nWarning at file ";
+    else if (domError.getSeverity() == DOMError::DOM_SEVERITY_ERROR)
+        XERCES_STD_QUALIFIER cerr << "\nError at file ";
+    else
+        XERCES_STD_QUALIFIER cerr << "\nFatal Error at file ";
+
+    XERCES_STD_QUALIFIER cerr << StrX(domError.getLocation()->getURI())
+         << ", line " << domError.getLocation()->getLineNumber()
+         << ", char " << domError.getLocation()->getColumnNumber()
+         << "\n  Message: " << StrX(domError.getMessage()) << XERCES_STD_QUALIFIER endl;
+
+    return true;
+}
+
+void DOMCountErrorHandler::resetErrors()
+{
+    fSawErrors = false;
+}
diff --git a/helm/papers/use_case/stats/parse/DOMCount/DOMCount.hpp b/helm/papers/use_case/stats/parse/DOMCount/DOMCount.hpp
new file mode 100644 (file)
index 0000000..a394a3f
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Copyright 1999-2000,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+/*
+ * $Log$
+ * Revision 1.1  2004/11/23 13:38:52  lpadovan
+ * * basic infrastructure for collecting statistics
+ *
+ * Revision 1.11  2004/09/08 13:55:31  peiyongz
+ * Apache License Version 2.0
+ *
+ * Revision 1.10  2003/05/30 09:36:35  gareth
+ * Use new macros for iostream.h and std:: issues.
+ *
+ * Revision 1.9  2003/02/05 18:53:22  tng
+ * [Bug 11915] Utility for freeing memory.
+ *
+ * Revision 1.8  2002/11/05 21:46:19  tng
+ * Explicit code using namespace in application.
+ *
+ * Revision 1.7  2002/06/18 16:19:40  knoaman
+ * Replace XercesDOMParser with DOMBuilder for parsing XML documents.
+ *
+ * Revision 1.6  2002/02/01 22:35:01  peiyongz
+ * sane_include
+ *
+ * Revision 1.5  2000/10/20 22:00:35  andyh
+ * DOMCount sample Minor cleanup - rename error handler class to say that it is an error handler.
+ *
+ * Revision 1.4  2000/03/02 19:53:39  roddey
+ * This checkin includes many changes done while waiting for the
+ * 1.1.0 code to be finished. I can't list them all here, but a list is
+ * available elsewhere.
+ *
+ * Revision 1.3  2000/02/11 02:43:55  abagchi
+ * Removed StrX::transcode
+ *
+ * Revision 1.2  2000/02/06 07:47:17  rahulj
+ * Year 2K copyright swat.
+ *
+ * Revision 1.1.1.1  1999/11/09 01:09:52  twl
+ * Initial checkin
+ *
+ * Revision 1.5  1999/11/08 20:43:35  rahul
+ * Swat for adding in Product name and CVS comment log variable.
+ *
+ */
+
+// ---------------------------------------------------------------------------
+//  Includes
+// ---------------------------------------------------------------------------
+#include <xercesc/dom/DOMErrorHandler.hpp>
+#include <xercesc/util/XMLString.hpp>
+#if defined(XERCES_NEW_IOSTREAMS)
+#include <iostream>
+#else
+#include <iostream.h>
+#endif
+
+XERCES_CPP_NAMESPACE_USE
+
+// ---------------------------------------------------------------------------
+//  Simple error handler deriviative to install on parser
+// ---------------------------------------------------------------------------
+class DOMCountErrorHandler : public DOMErrorHandler
+{
+public:
+    // -----------------------------------------------------------------------
+    //  Constructors and Destructor
+    // -----------------------------------------------------------------------
+    DOMCountErrorHandler();
+    ~DOMCountErrorHandler();
+
+
+    // -----------------------------------------------------------------------
+    //  Getter methods
+    // -----------------------------------------------------------------------
+    bool getSawErrors() const;
+
+
+    // -----------------------------------------------------------------------
+    //  Implementation of the DOM ErrorHandler interface
+    // -----------------------------------------------------------------------
+    bool handleError(const DOMError& domError);
+    void resetErrors();
+
+
+private :
+    // -----------------------------------------------------------------------
+    //  Unimplemented constructors and operators
+    // -----------------------------------------------------------------------
+    DOMCountErrorHandler(const DOMCountErrorHandler&);
+    void operator=(const DOMCountErrorHandler&);
+
+
+    // -----------------------------------------------------------------------
+    //  Private data members
+    //
+    //  fSawErrors
+    //      This is set if we get any errors, and is queryable via a getter
+    //      method. Its used by the main code to suppress output if there are
+    //      errors.
+    // -----------------------------------------------------------------------
+    bool    fSawErrors;
+};
+
+
+// ---------------------------------------------------------------------------
+//  This is a simple class that lets us do easy (though not terribly efficient)
+//  trancoding of XMLCh data to local code page for display.
+// ---------------------------------------------------------------------------
+class StrX
+{
+public :
+    // -----------------------------------------------------------------------
+    //  Constructors and Destructor
+    // -----------------------------------------------------------------------
+    StrX(const XMLCh* const toTranscode)
+    {
+        // Call the private transcoding method
+        fLocalForm = XMLString::transcode(toTranscode);
+    }
+
+    ~StrX()
+    {
+        XMLString::release(&fLocalForm);
+    }
+
+
+    // -----------------------------------------------------------------------
+    //  Getter methods
+    // -----------------------------------------------------------------------
+    const char* localForm() const
+    {
+        return fLocalForm;
+    }
+
+private :
+    // -----------------------------------------------------------------------
+    //  Private data members
+    //
+    //  fLocalForm
+    //      This is the local code page form of the string.
+    // -----------------------------------------------------------------------
+    char*   fLocalForm;
+};
+
+inline XERCES_STD_QUALIFIER ostream& operator<<(XERCES_STD_QUALIFIER ostream& target, const StrX& toDump)
+{
+    target << toDump.localForm();
+    return target;
+}
+
+inline bool DOMCountErrorHandler::getSawErrors() const
+{
+    return fSawErrors;
+}
diff --git a/helm/papers/use_case/stats/parse/DOMCount/Makefile b/helm/papers/use_case/stats/parse/DOMCount/Makefile
new file mode 100644 (file)
index 0000000..4fc7bcc
--- /dev/null
@@ -0,0 +1,76 @@
+# Generated automatically from Makefile.in by configure.
+#
+# Copyright 1999-2000,2004 The Apache Software Foundation.
+# 
+# Licensed 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.
+#
+#
+#
+# $Id$
+#
+
+###################################################################
+#                    IMPORTANT NOTE                               #
+###################################################################
+# If you are going to do the OS390BATCH build, make sure you have #
+# the OS390BATCH environment variable set.                        #
+#                                                                 #
+#   export OS390BATCH=1                                           #
+#                                                                 #
+###################################################################
+
+PLATFORM = LINUX
+COMPILER = c++
+CXXVER = 
+GCC = yes
+GXX = yes
+CXXFLAGS = -g -O2
+CFLAGS = -g -O2
+LDFLAGS = 
+THREADS = 
+EXTRA_LIBS = 
+PREFIX = /usr/local
+
+include Makefile.incl
+
+APP_NAME=DOMCount
+
+OUTDIR= .
+EXEC=  .
+OBJS=  ./DOMCount.o
+SRC=   .
+
+## OS390BATCH
+ifeq (${OS390BATCH},1)
+BATCH_TARGET= "//'${LOADMOD}(${APP_NAME})'"
+all:: makedir ${BATCH_TARGET}
+else
+all:: makedir ${EXEC}/${APP_NAME}
+endif
+
+makedir::
+       -mkdir -p $(OUTDIR)
+
+${EXEC}/${APP_NAME}:: ${OBJS}
+       ${LINK} ${PLATFORM_LIB_LINK_OPTIONS} ${OBJS} -o $@ ${LIBRARY_SEARCH_PATHS} ${LIBRARY_NAMES} ${EXTRA_LINK_OPTIONS}
+${BATCH_TARGET}:: ${OBJS}
+       ${LINK} ${PLATFORM_LIB_LINK_OPTIONS} ${OBJS} -o $@ ${LIBRARY_SEARCH_PATHS} ${LIBRARY_NAMES} ${EXTRA_LINK_OPTIONS}
+
+$(OUTDIR)/DOMCount.o:: ${SRC}/DOMCount.cpp
+       ${CC} ${INCLUDES} ${CMP} -o $(OUTDIR)/DOMCount.o ${SRC}/DOMCount.cpp
+
+clean::
+       rm -f ${OBJS} ${EXEC}/${APP_NAME}
+
+distclean::    clean
+       rm -f Makefile
diff --git a/helm/papers/use_case/stats/parse/DOMCount/Makefile.incl b/helm/papers/use_case/stats/parse/DOMCount/Makefile.incl
new file mode 100644 (file)
index 0000000..46321d8
--- /dev/null
@@ -0,0 +1,337 @@
+#
+# Copyright 1999-2004 The Apache Software Foundation.
+# 
+# Licensed 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.
+#
+#
+#
+# $Id$
+#
+
+################## LIBRARY NAMES AND DIRECTORIES ##################
+
+ifeq (${SYSOVR},OS400)
+PLATFORM = OS400
+endif
+INCLUDES= -I. -I${XERCESCROOT}/include
+LIB_DIR=${XERCESCROOT}/lib
+ifneq (${PLATFORM},OS400)
+LIBNAME=xerces-c
+else
+LIBNAME=xercesc
+endif
+THISLIB=${LIB_DIR}/${LIBNAME}
+
+LIBRARY_NAMES=-l${LIBNAME}
+LIBRARY_SEARCH_PATHS=-L${LIB_DIR}
+
+ifndef XERCESCOUT
+XERCESCOUT=${XERCESCROOT}
+endif
+
+TO = o
+####################### PLATFORM DEPENDENCIES #####################
+
+#=============== IRIX SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, IRIX)
+  ifeq (${GXX}, yes)
+       CMP= -c ${CXXFLAGS}
+       CC= ${COMPILER} -c -D${PLATFORM} -D_REENTRANT -fpic
+       LINK = ${COMPILER} -D${PLATFORM} -fpic ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+       EXTRA_LINK_OPTIONS=-lc ${EXTRA_LIBS}
+  else
+       CMP= -c ${CXXFLAGS}
+       CC= CC -c -D${PLATFORM} -LANG:pch -LANG:std -O2 -D_REENTRANT -I/usr/local/include
+       LINK =  CC -D${PLATFORM} ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=
+       EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+  endif
+  SHLIBSUFFIX=.so
+endif
+
+#=============== SOLARIS SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, SOLARIS)
+  ifeq (${GXX}, yes)
+       CMP= -c ${CXXFLAGS}
+       CC= ${COMPILER} -c -D${PLATFORM} -D_REENTRANT -fpic
+       LINK = ${COMPILER} -D${PLATFORM} -fpic ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+       EXTRA_LINK_OPTIONS=-lc ${EXTRA_LIBS}
+  else
+       CMP= -c ${CXXFLAGS}
+       CC= CC -c -D${PLATFORM} -D_REENTRANT -pic
+ LINK =  CC -D${PLATFORM} ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib
+       EXTRA_LINK_OPTIONS=-lc -lgen ${EXTRA_LIBS}
+  endif
+  SHLIBSUFFIX=.so
+endif
+
+#=============== OPENSERVER SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, OPENSERVER)
+  CC=${COMPILER} -D${PLATFORM} -fPIC
+  CMP=-c ${CXXFLAGS}
+  LINK=${CC} ${LDFLAGS}
+  EXTRA_LINK_OPTIONS=-lc -lsocket ${EXTRA_LIBS}
+  PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+  SHLIBSUFFIX=.so
+endif
+
+#=============== UNIXWARE SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, UNIXWARE)
+  CMP= -O2 -c ${CXXFLAGS} -pthread
+  CC= ${COMPILER} -O2 -c -D${PLATFORM} -D_REENTRANT -fpic -pthread
+  LINK = ${COMPILER} -D${PLATFORM} -fpic -pthread ${LDFLAGS}
+  EXTRA_LINK_OPTIONS=-lc -lsocket ${EXTRA_LIBS}
+  PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+  SHLIBSUFFIX=.so
+endif
+
+#================= PTX SPECIFIC OPTIONS ===========================
+ifeq (${PLATFORM}, PTX)
+COMPILESWITCH= -KPIC -Kthread -DPTX -w -O
+CMP = -c ${COMPILESWITCH}
+CC= c++
+LINK =  ${CC} -DPTX -Kthread ${LDFLAGS}
+PLATFORM_CPP_COMPILER = c++
+PLATFORM_C_COMPILER = cc
+PLATFORM_LIBRARIES =
+PLATFORM_COMPILE_OPTIONS = -KPIC -Kthread -DPTX
+MAKE_SHARED = ${PLATFORM_CPP_COMPILER} -DPTX -G
+MAKE_SHARED_C = ${PLATFORM_C_COMPILER} -DPTX  -G
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/local/lib -L${XMLINSTALL}/lib
+EXTRA_LINK_OPTIONS=-lm -lgen ${EXTRA_LIBS}
+SHLIBSUFFIX=.so
+endif
+
+#================= AIX SPECIFIC OPTIONS ===========================
+ifeq (${PLATFORM}, AIX)
+
+ifeq (${CXXVER}, v5compat)
+   CMP= -c ${CXXFLAGS} -qnotempinc -qnamemangling=v5   
+else
+   CMP= -c ${CXXFLAGS} -qnotempinc -qnamemangling=ansi
+endif
+
+CC=${COMPILER} -D${PLATFORM}
+LINK =  ${COMPILER} ${LDFLAGS}
+ifeq (${BITSTOBUILD}, 64)                                   
+       EXTRA_LINK_OPTIONS=-bmaxdata:0x80000000000
+else
+       EXTRA_LINK_OPTIONS=-bmaxdata:0x80000000
+endif
+# the compiler knows about this two
+# PLATFORM_LIB_LINK_OPTIONS=-L/usr/lpp/xlC/lib
+# EXTRA_LINK_OPTIONS=-lC ${EXTRA_LIBS}
+# EXTRA_LINK_OPTIONS=-bnolibpath
+SHLIBSUFFIX=.a
+endif
+
+#=============== OS400 SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, OS400)
+ifeq (${SYSOVR},OS400)
+MYCC = cross compiler path here
+TO = qwobj
+else
+MYCC = icc
+LINK =  ${CC} -v ${LDFLAGS}
+endif
+CMP= -c -DOS400 ${CXXFLAGS}
+CXX = $(MYCC)
+CC = $(MYCC)
+#INCLUDES    += -I${ICUROOT}/include
+SHLIBSUFFIX=.a
+EXTRA_LINK_OPTIONS=-q OPTION='*DUPPROC *DUPVAR' ${EXTRA_LIBS}
+endif
+
+#=============== BEOS SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, BEOS)
+CMP= -c ${CXXFLAGS}
+CC= ${COMPILER} -c -D${PLATFORM} -DAPP_NO_THREADS -fpic
+LINK =  ${COMPILER} -D${PLATFORM} -fpic ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/boot/develop/lib/x86 -L/boot/home/config/lib
+EXTRA_LINK_OPTIONS=-lbe ${EXTRA_LIBS}
+SHLIBSUFFIX=.so
+endif
+
+#=============== LINUX SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, LINUX)
+CMP= -c ${CXXFLAGS}
+CC= ${COMPILER} -c -D${PLATFORM} -D_REENTRANT -fpic
+LINK =  ${COMPILER} -D${PLATFORM} -fpic ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/local/lib
+EXTRA_LINK_OPTIONS=-lc ${EXTRA_LIBS}
+SHLIBSUFFIX=.so
+endif
+
+#=============== QNX SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, QNX)
+CMP= -c ${CXXFLAGS}
+CC= QCC -c 
+LINK = QCC ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/local/lib
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.so
+endif
+
+
+#=============== CYGWIN SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, CYGWIN)
+CMP= -c ${CXXFLAGS}
+CC= ${COMPILER} -c -D__${PLATFORM}__
+LINK =  ${COMPILER} -D__${PLATFORM}__ ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.dll
+endif
+
+#=============== MINGW SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, MINGW)
+CMP= -c ${CXXFLAGS} -fexceptions
+CC= ${COMPILER} -c -D__${PLATFORM}__ 
+LINK =  ${COMPILER} -D__${PLATFORM}__ ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.dll
+endif
+
+#=============== FREEBSD SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, FREEBSD)
+  CMP= -c ${CXXFLAGS}
+  CC= ${COMPILER} -c -D${PLATFORM} -fPIC
+  LINK = ${COMPILER} -D${PLATFORM} -fPIC ${LDFLAGS}
+  PLATFORM_LIB_LINK_OPTIONS=-Wl,-rpath,${XERCESCROOT}/lib
+  ifdef ICUROOT
+    PLATFORM_LIB_LINK_OPTIONS+=-L${ICUROOT} -Wl,-rpath,${ICUROOT}
+    EXTRA_LINK_OPTIONS=-licudata -lstdc++ ${EXTRA_LIBS}
+  else
+    EXTRA_LINK_OPTIONS=${EXTRA_LIBS} -lstdc++
+  endif
+  SHLIBSUFFIX=.so
+endif
+
+#=============== NETBSD SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, NETBSD)
+  CMP= -c ${CXXFLAGS}
+  CC= ${COMPILER} -c -D${PLATFORM} -fPIC
+  LINK = ${COMPILER} -D${PLATFORM} -fPIC ${LDFLAGS}
+  PLATFORM_LIB_LINK_OPTIONS=-Wl,-rpath,${XERCESCROOT}/lib
+  ifdef ICUROOT
+    PLATFORM_LIB_LINK_OPTIONS+=-L${ICUROOT} -Wl,-rpath,${ICUROOT}
+    EXTRA_LINK_OPTIONS=-licudata -lstdc++ ${EXTRA_LIBS}
+  else
+    EXTRA_LINK_OPTIONS=${EXTRA_LIBS} -lstdc++
+  endif
+  SHLIBSUFFIX=.so
+endif
+
+#================= HP SPECIFIC OPTIONS ===========================
+ifeq (${PLATFORM}, HPUX)
+  ifeq (${COMPILER}, aCC)
+    ifeq (${CXXVER}, aCC05)
+       CMP = -c +DAportable $(CXXFLAGS) -D_HP_UX -DHPaCC -w +z -mt
+    else
+       CMP = -c +DAportable $(CXXFLAGS) -D_HP_UX -DHPaCC -w +z
+    endif  
+
+    CC = aCC
+    LINK =  ${CC} -Wl,+s -Wl,+b,. ${LDFLAGS}
+    
+    ifeq (${CXXVER}, aCC05)
+       PLATFORM_LIB_LINK_OPTIONS=-L/opt/aCC/lib -L/usr/ccs/lib -mt
+    else
+       PLATFORM_LIB_LINK_OPTIONS=-L/opt/aCC/lib -L/usr/ccs/lib -lpthread    
+    endif      
+
+    SHLIBSUFFIX=.sl
+  else
+    ifneq (${DEBUG}, 1)
+      CXXFLAGS = -w +O1
+    endif
+    APPL_NAME = $(notdir $(shell pwd))
+    TEMPLATESDIR = $(XERCESCROOT)/bin/obj/$(APPL_NAME)/ptrepository
+    COMMON_CMP = $(CXXFLAGS) -D_HP_UX -DHPCC +DAportable -w +eh +z -z \
+        -ptr$(TEMPLATESDIR)
+    CMP = -c $(COMMON_CMP)
+    CC = CC
+    LINK =  ${CC} $(COMMON_CMP) -Wl,+s -Wl,+b,. ${LDFLAGS}
+    PLATFORM_LIB_LINK_OPTIONS=-L/opt/CC/lib -L/usr/lib
+    SHLIBSUFFIX=.sl
+  endif
+endif
+
+#================= OS390 SPECIFIC OPTIONS ===========================
+###################################################################
+#                    IMPORTANT NOTE                               #
+###################################################################
+# Before you try to run the Makefile, make sure you have two      #
+# environment variables set.                                      #
+#                                                                 #
+# export XERCESCROOT=<the directory where you installed XERCES-C> #
+#                                                                 #
+# If you are going to do the OS390BATCH build, make sure you have #
+# the OS390BATCH environment variable set.                        #
+#                                                                 #
+#   export OS390BATCH=1                                           #
+#                                                                 #
+# Also,                                                           #
+#                                                                 #
+#   export LOADMOD=USERID.LOAD                                    #
+#   export LOADEXP=SYS1.SIXMEXP or &hlq.SIXMEXP                   #
+#                                                                 #
+# to specify your LOADMOD and the IXM4C55X definition sidedeck    #
+# dataset.                                                       #
+###################################################################
+
+ifeq (${PLATFORM}, OS390)
+CMP= -c -DOS390 ${CXXFLAGS}
+## OS390BATCH
+ifeq (${OS390BATCH},1)
+CC = _CXX_CXXSUFFIX="cpp" c++ -W0,"langlvl(extended)" -Wc,"TMPLPARSE(NO)" -DOS390 -D_OPEN_THREADS -D_XOPEN_SOURCE_EXTENDED -DOS390BATCH
+else
+CC = _CXX_CXXSUFFIX="cpp" c++ -W0,"langlvl(extended)" -Wc,"TMPLPARSE(NO)" -DOS390 -D_OPEN_THREADS -D_XOPEN_SOURCE_EXTENDED
+endif
+LINK =  ${CC} ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.dll
+OS390SIDEDECK=.x
+## OS390BATCH
+ifeq (${OS390BATCH},1)
+LIBRARY_NAMES="//'${LOADEXP}(IXM4C55X)'"
+else
+LIBRARY_NAMES=${LIB_DIR}/lib${LIBNAME}${VER}${OS390SIDEDECK}
+endif
+LIBRARY_SEARCH_PATHS=
+endif
+
+
+#=============== TRU64 SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, TRU64)
+CMP= -c ${CXXFLAGS}
+CC = ${COMPILER} -c -D${PLATFORM}
+LINK = ${COMPILER} -D${PLATFORM} ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+SHLIBSUFFIX=.so
+endif
+
+
+#=============== MacOS SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, MACOSX)
+       CMP= -c ${CXXFLAGS}
+       CC= c++ -c -D${PLATFORM} -D_REENTRANT
+       LINK = c++ -D${PLATFORM} ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+       SHLIBSUFFIX=.dylib
+endif
index 9c889e011ae6ea096198d5144043b3b0cb0ab6fb..c30617ace4676f2c1ee080ebfd2688fd23945bc6 100644 (file)
@@ -1,13 +1,19 @@
 CC = gcc
 LIBXML_FLAGS = `pkg-config --cflags --libs libxml-2.0`
 EXPAT_FLAGS = -lexpat
-BIN = parse_expat parse_xmlreader parse_xmlsax
+BIN = parse_expat parse_xmlreader parse_xmlsax parse_xmltree
 all: $(BIN)
+       $(MAKE) -C SAX2Print/
 clean:
        rm -f $(BIN)
+       $(MAKE) -C SAX2Print/ clean
+
 parse_expat: parse_expat.c
        $(CC) $(EXPAT_FLAGS) -o $@ $<
 parse_xmlreader: parse_xmlreader.c
        $(CC) $(LIBXML_FLAGS) -o $@ $<
 parse_xmlsax: parse_xmlsax.c
        $(CC) $(LIBXML_FLAGS) -o $@ $<
+parse_xmltree: parse_xmltree.c
+       $(CC) $(LIBXML_FLAGS) -o $@ $<
+
diff --git a/helm/papers/use_case/stats/parse/SAX2Print/.cvsignore b/helm/papers/use_case/stats/parse/SAX2Print/.cvsignore
new file mode 100644 (file)
index 0000000..22e4c28
--- /dev/null
@@ -0,0 +1 @@
+SAX2Print
diff --git a/helm/papers/use_case/stats/parse/SAX2Print/Makefile b/helm/papers/use_case/stats/parse/SAX2Print/Makefile
new file mode 100644 (file)
index 0000000..83c74e0
--- /dev/null
@@ -0,0 +1,80 @@
+# Generated automatically from Makefile.in by configure.
+#
+# Copyright 1999-2000,2004 The Apache Software Foundation.
+# 
+# Licensed 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.
+#
+#
+#
+# $Id$
+#
+
+###################################################################
+#                    IMPORTANT NOTE                               #
+###################################################################
+# If you are going to do the OS390BATCH build, make sure you have #
+# the OS390BATCH environment variable set.                        #
+#                                                                 #
+#   export OS390BATCH=1                                           #
+#                                                                 #
+###################################################################
+
+PLATFORM = LINUX
+COMPILER = c++
+CXXVER = 
+GCC = yes
+GXX = yes
+CXXFLAGS = -g -O2
+CFLAGS = -g -O2
+LDFLAGS = 
+THREADS = 
+EXTRA_LIBS = 
+PREFIX = /usr/local
+
+include Makefile.incl
+
+APP_NAME=SAX2Print
+
+OUTDIR= .
+EXEC=  .
+OBJS=  ${OUTDIR}/SAX2Print.o ${OUTDIR}/SAX2PrintHandlers.o
+SRC=   .
+HEADER_FILES=${SRC}/SAX2Print.hpp ${SRC}/SAX2PrintHandlers.hpp
+
+## OS390BATCH
+ifeq (${OS390BATCH},1)
+BATCH_TARGET= "//'${LOADMOD}(SAX2PRNT)'"
+all:: makedir ${BATCH_TARGET}
+else
+all:: makedir ${EXEC}/${APP_NAME}
+endif
+
+makedir::
+       -mkdir -p $(OUTDIR)
+
+${EXEC}/${APP_NAME}:: ${OBJS}
+       ${LINK} ${PLATFORM_LIB_LINK_OPTIONS} ${OBJS} -o $@ ${LIBRARY_SEARCH_PATHS} ${LIBRARY_NAMES} ${EXTRA_LINK_OPTIONS}
+${BATCH_TARGET}:: ${OBJS}
+       ${LINK} ${PLATFORM_LIB_LINK_OPTIONS} ${OBJS} -o $@ ${LIBRARY_SEARCH_PATHS} ${LIBRARY_NAMES} ${EXTRA_LINK_OPTIONS}
+
+$(OUTDIR)/SAX2Print.o:: ${SRC}/SAX2Print.cpp ${HEADER_FILES}
+       ${CC} ${INCLUDES} ${CMP} -o $(OUTDIR)/SAX2Print.o ${SRC}/SAX2Print.cpp
+
+$(OUTDIR)/SAX2PrintHandlers.o:: ${SRC}/SAX2PrintHandlers.cpp ${HEADER_FILES}
+       ${CC} ${INCLUDES} ${CMP} -o $(OUTDIR)/SAX2PrintHandlers.o ${SRC}/SAX2PrintHandlers.cpp
+
+clean::
+       rm -f ${OBJS} ${EXEC}/${APP_NAME}
+
+distclean::    clean
+       rm -f Makefile
diff --git a/helm/papers/use_case/stats/parse/SAX2Print/Makefile.incl b/helm/papers/use_case/stats/parse/SAX2Print/Makefile.incl
new file mode 100644 (file)
index 0000000..46321d8
--- /dev/null
@@ -0,0 +1,337 @@
+#
+# Copyright 1999-2004 The Apache Software Foundation.
+# 
+# Licensed 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.
+#
+#
+#
+# $Id$
+#
+
+################## LIBRARY NAMES AND DIRECTORIES ##################
+
+ifeq (${SYSOVR},OS400)
+PLATFORM = OS400
+endif
+INCLUDES= -I. -I${XERCESCROOT}/include
+LIB_DIR=${XERCESCROOT}/lib
+ifneq (${PLATFORM},OS400)
+LIBNAME=xerces-c
+else
+LIBNAME=xercesc
+endif
+THISLIB=${LIB_DIR}/${LIBNAME}
+
+LIBRARY_NAMES=-l${LIBNAME}
+LIBRARY_SEARCH_PATHS=-L${LIB_DIR}
+
+ifndef XERCESCOUT
+XERCESCOUT=${XERCESCROOT}
+endif
+
+TO = o
+####################### PLATFORM DEPENDENCIES #####################
+
+#=============== IRIX SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, IRIX)
+  ifeq (${GXX}, yes)
+       CMP= -c ${CXXFLAGS}
+       CC= ${COMPILER} -c -D${PLATFORM} -D_REENTRANT -fpic
+       LINK = ${COMPILER} -D${PLATFORM} -fpic ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+       EXTRA_LINK_OPTIONS=-lc ${EXTRA_LIBS}
+  else
+       CMP= -c ${CXXFLAGS}
+       CC= CC -c -D${PLATFORM} -LANG:pch -LANG:std -O2 -D_REENTRANT -I/usr/local/include
+       LINK =  CC -D${PLATFORM} ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=
+       EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+  endif
+  SHLIBSUFFIX=.so
+endif
+
+#=============== SOLARIS SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, SOLARIS)
+  ifeq (${GXX}, yes)
+       CMP= -c ${CXXFLAGS}
+       CC= ${COMPILER} -c -D${PLATFORM} -D_REENTRANT -fpic
+       LINK = ${COMPILER} -D${PLATFORM} -fpic ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+       EXTRA_LINK_OPTIONS=-lc ${EXTRA_LIBS}
+  else
+       CMP= -c ${CXXFLAGS}
+       CC= CC -c -D${PLATFORM} -D_REENTRANT -pic
+ LINK =  CC -D${PLATFORM} ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib
+       EXTRA_LINK_OPTIONS=-lc -lgen ${EXTRA_LIBS}
+  endif
+  SHLIBSUFFIX=.so
+endif
+
+#=============== OPENSERVER SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, OPENSERVER)
+  CC=${COMPILER} -D${PLATFORM} -fPIC
+  CMP=-c ${CXXFLAGS}
+  LINK=${CC} ${LDFLAGS}
+  EXTRA_LINK_OPTIONS=-lc -lsocket ${EXTRA_LIBS}
+  PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+  SHLIBSUFFIX=.so
+endif
+
+#=============== UNIXWARE SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, UNIXWARE)
+  CMP= -O2 -c ${CXXFLAGS} -pthread
+  CC= ${COMPILER} -O2 -c -D${PLATFORM} -D_REENTRANT -fpic -pthread
+  LINK = ${COMPILER} -D${PLATFORM} -fpic -pthread ${LDFLAGS}
+  EXTRA_LINK_OPTIONS=-lc -lsocket ${EXTRA_LIBS}
+  PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+  SHLIBSUFFIX=.so
+endif
+
+#================= PTX SPECIFIC OPTIONS ===========================
+ifeq (${PLATFORM}, PTX)
+COMPILESWITCH= -KPIC -Kthread -DPTX -w -O
+CMP = -c ${COMPILESWITCH}
+CC= c++
+LINK =  ${CC} -DPTX -Kthread ${LDFLAGS}
+PLATFORM_CPP_COMPILER = c++
+PLATFORM_C_COMPILER = cc
+PLATFORM_LIBRARIES =
+PLATFORM_COMPILE_OPTIONS = -KPIC -Kthread -DPTX
+MAKE_SHARED = ${PLATFORM_CPP_COMPILER} -DPTX -G
+MAKE_SHARED_C = ${PLATFORM_C_COMPILER} -DPTX  -G
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/local/lib -L${XMLINSTALL}/lib
+EXTRA_LINK_OPTIONS=-lm -lgen ${EXTRA_LIBS}
+SHLIBSUFFIX=.so
+endif
+
+#================= AIX SPECIFIC OPTIONS ===========================
+ifeq (${PLATFORM}, AIX)
+
+ifeq (${CXXVER}, v5compat)
+   CMP= -c ${CXXFLAGS} -qnotempinc -qnamemangling=v5   
+else
+   CMP= -c ${CXXFLAGS} -qnotempinc -qnamemangling=ansi
+endif
+
+CC=${COMPILER} -D${PLATFORM}
+LINK =  ${COMPILER} ${LDFLAGS}
+ifeq (${BITSTOBUILD}, 64)                                   
+       EXTRA_LINK_OPTIONS=-bmaxdata:0x80000000000
+else
+       EXTRA_LINK_OPTIONS=-bmaxdata:0x80000000
+endif
+# the compiler knows about this two
+# PLATFORM_LIB_LINK_OPTIONS=-L/usr/lpp/xlC/lib
+# EXTRA_LINK_OPTIONS=-lC ${EXTRA_LIBS}
+# EXTRA_LINK_OPTIONS=-bnolibpath
+SHLIBSUFFIX=.a
+endif
+
+#=============== OS400 SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, OS400)
+ifeq (${SYSOVR},OS400)
+MYCC = cross compiler path here
+TO = qwobj
+else
+MYCC = icc
+LINK =  ${CC} -v ${LDFLAGS}
+endif
+CMP= -c -DOS400 ${CXXFLAGS}
+CXX = $(MYCC)
+CC = $(MYCC)
+#INCLUDES    += -I${ICUROOT}/include
+SHLIBSUFFIX=.a
+EXTRA_LINK_OPTIONS=-q OPTION='*DUPPROC *DUPVAR' ${EXTRA_LIBS}
+endif
+
+#=============== BEOS SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, BEOS)
+CMP= -c ${CXXFLAGS}
+CC= ${COMPILER} -c -D${PLATFORM} -DAPP_NO_THREADS -fpic
+LINK =  ${COMPILER} -D${PLATFORM} -fpic ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/boot/develop/lib/x86 -L/boot/home/config/lib
+EXTRA_LINK_OPTIONS=-lbe ${EXTRA_LIBS}
+SHLIBSUFFIX=.so
+endif
+
+#=============== LINUX SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, LINUX)
+CMP= -c ${CXXFLAGS}
+CC= ${COMPILER} -c -D${PLATFORM} -D_REENTRANT -fpic
+LINK =  ${COMPILER} -D${PLATFORM} -fpic ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/local/lib
+EXTRA_LINK_OPTIONS=-lc ${EXTRA_LIBS}
+SHLIBSUFFIX=.so
+endif
+
+#=============== QNX SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, QNX)
+CMP= -c ${CXXFLAGS}
+CC= QCC -c 
+LINK = QCC ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/local/lib
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.so
+endif
+
+
+#=============== CYGWIN SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, CYGWIN)
+CMP= -c ${CXXFLAGS}
+CC= ${COMPILER} -c -D__${PLATFORM}__
+LINK =  ${COMPILER} -D__${PLATFORM}__ ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.dll
+endif
+
+#=============== MINGW SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, MINGW)
+CMP= -c ${CXXFLAGS} -fexceptions
+CC= ${COMPILER} -c -D__${PLATFORM}__ 
+LINK =  ${COMPILER} -D__${PLATFORM}__ ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.dll
+endif
+
+#=============== FREEBSD SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, FREEBSD)
+  CMP= -c ${CXXFLAGS}
+  CC= ${COMPILER} -c -D${PLATFORM} -fPIC
+  LINK = ${COMPILER} -D${PLATFORM} -fPIC ${LDFLAGS}
+  PLATFORM_LIB_LINK_OPTIONS=-Wl,-rpath,${XERCESCROOT}/lib
+  ifdef ICUROOT
+    PLATFORM_LIB_LINK_OPTIONS+=-L${ICUROOT} -Wl,-rpath,${ICUROOT}
+    EXTRA_LINK_OPTIONS=-licudata -lstdc++ ${EXTRA_LIBS}
+  else
+    EXTRA_LINK_OPTIONS=${EXTRA_LIBS} -lstdc++
+  endif
+  SHLIBSUFFIX=.so
+endif
+
+#=============== NETBSD SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, NETBSD)
+  CMP= -c ${CXXFLAGS}
+  CC= ${COMPILER} -c -D${PLATFORM} -fPIC
+  LINK = ${COMPILER} -D${PLATFORM} -fPIC ${LDFLAGS}
+  PLATFORM_LIB_LINK_OPTIONS=-Wl,-rpath,${XERCESCROOT}/lib
+  ifdef ICUROOT
+    PLATFORM_LIB_LINK_OPTIONS+=-L${ICUROOT} -Wl,-rpath,${ICUROOT}
+    EXTRA_LINK_OPTIONS=-licudata -lstdc++ ${EXTRA_LIBS}
+  else
+    EXTRA_LINK_OPTIONS=${EXTRA_LIBS} -lstdc++
+  endif
+  SHLIBSUFFIX=.so
+endif
+
+#================= HP SPECIFIC OPTIONS ===========================
+ifeq (${PLATFORM}, HPUX)
+  ifeq (${COMPILER}, aCC)
+    ifeq (${CXXVER}, aCC05)
+       CMP = -c +DAportable $(CXXFLAGS) -D_HP_UX -DHPaCC -w +z -mt
+    else
+       CMP = -c +DAportable $(CXXFLAGS) -D_HP_UX -DHPaCC -w +z
+    endif  
+
+    CC = aCC
+    LINK =  ${CC} -Wl,+s -Wl,+b,. ${LDFLAGS}
+    
+    ifeq (${CXXVER}, aCC05)
+       PLATFORM_LIB_LINK_OPTIONS=-L/opt/aCC/lib -L/usr/ccs/lib -mt
+    else
+       PLATFORM_LIB_LINK_OPTIONS=-L/opt/aCC/lib -L/usr/ccs/lib -lpthread    
+    endif      
+
+    SHLIBSUFFIX=.sl
+  else
+    ifneq (${DEBUG}, 1)
+      CXXFLAGS = -w +O1
+    endif
+    APPL_NAME = $(notdir $(shell pwd))
+    TEMPLATESDIR = $(XERCESCROOT)/bin/obj/$(APPL_NAME)/ptrepository
+    COMMON_CMP = $(CXXFLAGS) -D_HP_UX -DHPCC +DAportable -w +eh +z -z \
+        -ptr$(TEMPLATESDIR)
+    CMP = -c $(COMMON_CMP)
+    CC = CC
+    LINK =  ${CC} $(COMMON_CMP) -Wl,+s -Wl,+b,. ${LDFLAGS}
+    PLATFORM_LIB_LINK_OPTIONS=-L/opt/CC/lib -L/usr/lib
+    SHLIBSUFFIX=.sl
+  endif
+endif
+
+#================= OS390 SPECIFIC OPTIONS ===========================
+###################################################################
+#                    IMPORTANT NOTE                               #
+###################################################################
+# Before you try to run the Makefile, make sure you have two      #
+# environment variables set.                                      #
+#                                                                 #
+# export XERCESCROOT=<the directory where you installed XERCES-C> #
+#                                                                 #
+# If you are going to do the OS390BATCH build, make sure you have #
+# the OS390BATCH environment variable set.                        #
+#                                                                 #
+#   export OS390BATCH=1                                           #
+#                                                                 #
+# Also,                                                           #
+#                                                                 #
+#   export LOADMOD=USERID.LOAD                                    #
+#   export LOADEXP=SYS1.SIXMEXP or &hlq.SIXMEXP                   #
+#                                                                 #
+# to specify your LOADMOD and the IXM4C55X definition sidedeck    #
+# dataset.                                                       #
+###################################################################
+
+ifeq (${PLATFORM}, OS390)
+CMP= -c -DOS390 ${CXXFLAGS}
+## OS390BATCH
+ifeq (${OS390BATCH},1)
+CC = _CXX_CXXSUFFIX="cpp" c++ -W0,"langlvl(extended)" -Wc,"TMPLPARSE(NO)" -DOS390 -D_OPEN_THREADS -D_XOPEN_SOURCE_EXTENDED -DOS390BATCH
+else
+CC = _CXX_CXXSUFFIX="cpp" c++ -W0,"langlvl(extended)" -Wc,"TMPLPARSE(NO)" -DOS390 -D_OPEN_THREADS -D_XOPEN_SOURCE_EXTENDED
+endif
+LINK =  ${CC} ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.dll
+OS390SIDEDECK=.x
+## OS390BATCH
+ifeq (${OS390BATCH},1)
+LIBRARY_NAMES="//'${LOADEXP}(IXM4C55X)'"
+else
+LIBRARY_NAMES=${LIB_DIR}/lib${LIBNAME}${VER}${OS390SIDEDECK}
+endif
+LIBRARY_SEARCH_PATHS=
+endif
+
+
+#=============== TRU64 SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, TRU64)
+CMP= -c ${CXXFLAGS}
+CC = ${COMPILER} -c -D${PLATFORM}
+LINK = ${COMPILER} -D${PLATFORM} ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+SHLIBSUFFIX=.so
+endif
+
+
+#=============== MacOS SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, MACOSX)
+       CMP= -c ${CXXFLAGS}
+       CC= c++ -c -D${PLATFORM} -D_REENTRANT
+       LINK = c++ -D${PLATFORM} ${LDFLAGS}
+       PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+       SHLIBSUFFIX=.dylib
+endif
diff --git a/helm/papers/use_case/stats/parse/SAX2Print/SAX2Print.cpp b/helm/papers/use_case/stats/parse/SAX2Print/SAX2Print.cpp
new file mode 100644 (file)
index 0000000..fce04fc
--- /dev/null
@@ -0,0 +1,359 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+/*
+ * $Log$
+ * Revision 1.1  2004/11/23 13:38:52  lpadovan
+ * * basic infrastructure for collecting statistics
+ *
+ * Revision 1.17  2004/09/08 13:55:33  peiyongz
+ * Apache License Version 2.0
+ *
+ * Revision 1.16  2004/09/02 14:59:29  cargilld
+ * Add OutOfMemoryException block to samples.
+ *
+ * Revision 1.15  2004/02/06 15:04:16  cargilld
+ * Misc 390 changes.
+ *
+ * Revision 1.14  2003/08/07 21:21:38  neilg
+ * fix segmentation faults that may arise when the parser throws exceptions during document parsing.  In general, XMLPlatformUtils::Terminate() should not be called from within a catch statement.
+ *
+ * Revision 1.13  2003/05/30 09:36:36  gareth
+ * Use new macros for iostream.h and std:: issues.
+ *
+ * Revision 1.12  2002/06/17 15:33:00  tng
+ * Name Xerces features as XMLUni::fgXercesXXXX instead of XMLUni::fgSAX2XercesXXXX so that they can be shared with DOM parser.
+ *
+ * Revision 1.11  2002/05/28 20:20:26  tng
+ * Add option '-n' to SAX2Print.
+ *
+ * Revision 1.10  2002/04/17 20:18:08  tng
+ * [Bug 7493] The word "occured" is misspelled and it is a global error.
+ *
+ * Revision 1.9  2002/02/13 16:11:06  knoaman
+ * Update samples to use SAX2 features/properties constants from XMLUni.
+ *
+ * Revision 1.8  2002/02/06 16:36:51  knoaman
+ * Added a new flag '-p' to SAX2 samples to set the 'namespace-prefixes' feature.
+ *
+ * Revision 1.7  2002/02/01 22:40:44  peiyongz
+ * sane_include
+ *
+ * Revision 1.6  2001/10/25 15:18:33  tng
+ * delete the parser before XMLPlatformUtils::Terminate.
+ *
+ * Revision 1.5  2001/10/19 19:02:43  tng
+ * [Bug 3909] return non-zero an exit code when error was encounted.
+ * And other modification for consistent help display and return code across samples.
+ *
+ * Revision 1.4  2001/08/02 17:10:29  tng
+ * Allow DOMCount/SAXCount/IDOMCount/SAX2Count to take a file that has a list of xml file as input.
+ *
+ * Revision 1.3  2001/08/01 19:11:01  tng
+ * Add full schema constraint checking flag to the samples and the parser.
+ *
+ * Revision 1.2  2000/08/09 22:20:38  jpolast
+ * updates for changes to sax2 core functionality.
+ *
+ * Revision 1.1  2000/08/02 19:16:14  jpolast
+ * initial checkin of SAX2Print
+ *
+ *
+ */
+
+
+// ---------------------------------------------------------------------------
+//  Includes
+// ---------------------------------------------------------------------------
+#include <xercesc/util/PlatformUtils.hpp>
+#include <xercesc/util/TransService.hpp>
+#include <xercesc/sax2/SAX2XMLReader.hpp>
+#include <xercesc/sax2/XMLReaderFactory.hpp>
+#include "SAX2Print.hpp"
+#include <xercesc/util/OutOfMemoryException.hpp>
+#include <sys/time.h>
+
+// ---------------------------------------------------------------------------
+//  Local data
+//
+//  encodingName
+//      The encoding we are to output in. If not set on the command line,
+//      then it is defaulted to LATIN1.
+//
+//  xmlFile
+//      The path to the file to parser. Set via command line.
+//
+//  valScheme
+//      Indicates what validation scheme to use. It defaults to 'auto', but
+//      can be set via the -v= command.
+//
+//     expandNamespaces
+//             Indicates if the output should expand the namespaces Alias with
+//             their URI's, defaults to false, can be set via the command line -e
+// ---------------------------------------------------------------------------
+static const char*              encodingName    = "LATIN1";
+static XMLFormatter::UnRepFlags unRepFlags      = XMLFormatter::UnRep_CharRef;
+static char*                    xmlFile         = 0;
+static SAX2XMLReader::ValSchemes valScheme      = SAX2XMLReader::Val_Auto;
+static bool                                            expandNamespaces= false ;
+static bool                     doNamespaces    = true;
+static bool                     doSchema        = true;
+static bool                     schemaFullChecking = false;
+static bool                     namespacePrefixes = false;
+
+
+// ---------------------------------------------------------------------------
+//  Local helper methods
+// ---------------------------------------------------------------------------
+static void usage()
+{
+    XERCES_STD_QUALIFIER cout << "\nUsage:\n"
+            "    SAX2Print [options] <XML file>\n\n"
+            "This program invokes the SAX2XMLReader, and then prints the\n"
+            "data returned by the various SAX2 handlers for the specified\n"
+            "XML file.\n\n"
+            "Options:\n"
+             "    -u=xxx      Handle unrepresentable chars [fail | rep | ref*].\n"
+             "    -v=xxx      Validation scheme [always | never | auto*].\n"
+             "    -e          Expand Namespace Alias with URI's. Defaults to off.\n"
+             "    -x=XXX      Use a particular encoding for output (LATIN1*).\n"
+             "    -f          Enable full schema constraint checking processing. Defaults to off.\n"
+             "    -p          Enable namespace-prefixes feature. Defaults to off.\n"
+             "    -n          Disable namespace processing. Defaults to on.\n"
+             "                NOTE: THIS IS OPPOSITE FROM OTHER SAMPLES.\n"
+             "    -s          Disable schema processing. Defaults to on.\n"
+             "                NOTE: THIS IS OPPOSITE FROM OTHER SAMPLES.\n"
+             "    -?          Show this help.\n\n"
+             "  * = Default if not provided explicitly.\n\n"
+             "The parser has intrinsic support for the following encodings:\n"
+             "    UTF-8, USASCII, ISO8859-1, UTF-16[BL]E, UCS-4[BL]E,\n"
+             "    WINDOWS-1252, IBM1140, IBM037, IBM1047.\n"
+         <<  XERCES_STD_QUALIFIER endl;
+}
+
+
+
+// ---------------------------------------------------------------------------
+//  Program entry point
+// ---------------------------------------------------------------------------
+int main(int argC, char* argV[])
+{
+    // Initialize the XML4C2 system
+    try
+    {
+         XMLPlatformUtils::Initialize();
+    }
+
+    catch (const XMLException& toCatch)
+    {
+         XERCES_STD_QUALIFIER cerr << "Error during initialization! :\n"
+              << StrX(toCatch.getMessage()) << XERCES_STD_QUALIFIER endl;
+         return 1;
+    }
+
+    // Check command line and extract arguments.
+    if (argC < 2)
+    {
+        usage();
+        XMLPlatformUtils::Terminate();
+        return 1;
+    }
+
+    int parmInd;
+    for (parmInd = 1; parmInd < argC; parmInd++)
+    {
+        // Break out on first parm not starting with a dash
+        if (argV[parmInd][0] != '-')
+            break;
+
+        // Watch for special case help request
+        if (!strcmp(argV[parmInd], "-?"))
+        {
+            usage();
+            XMLPlatformUtils::Terminate();
+            return 2;
+        }
+         else if (!strncmp(argV[parmInd], "-v=", 3)
+              ||  !strncmp(argV[parmInd], "-V=", 3))
+        {
+            const char* const parm = &argV[parmInd][3];
+
+            if (!strcmp(parm, "never"))
+                valScheme = SAX2XMLReader::Val_Never;
+            else if (!strcmp(parm, "auto"))
+                valScheme = SAX2XMLReader::Val_Auto;
+            else if (!strcmp(parm, "always"))
+                valScheme = SAX2XMLReader::Val_Always;
+            else
+            {
+                XERCES_STD_QUALIFIER cerr << "Unknown -v= value: " << parm << XERCES_STD_QUALIFIER endl;
+                XMLPlatformUtils::Terminate();
+                return 2;
+            }
+        }
+         else if (!strcmp(argV[parmInd], "-e")
+              ||  !strcmp(argV[parmInd], "-E"))
+        {
+            expandNamespaces = true;
+        }
+         else if (!strncmp(argV[parmInd], "-x=", 3)
+              ||  !strncmp(argV[parmInd], "-X=", 3))
+        {
+            // Get out the encoding name
+            encodingName = &argV[parmInd][3];
+        }
+         else if (!strncmp(argV[parmInd], "-u=", 3)
+              ||  !strncmp(argV[parmInd], "-U=", 3))
+        {
+            const char* const parm = &argV[parmInd][3];
+
+            if (!strcmp(parm, "fail"))
+                unRepFlags = XMLFormatter::UnRep_Fail;
+            else if (!strcmp(parm, "rep"))
+                unRepFlags = XMLFormatter::UnRep_Replace;
+            else if (!strcmp(parm, "ref"))
+                unRepFlags = XMLFormatter::UnRep_CharRef;
+            else
+            {
+                XERCES_STD_QUALIFIER cerr << "Unknown -u= value: " << parm << XERCES_STD_QUALIFIER endl;
+                XMLPlatformUtils::Terminate();
+                return 2;
+            }
+        }
+         else if (!strcmp(argV[parmInd], "-n")
+              ||  !strcmp(argV[parmInd], "-N"))
+        {
+            doNamespaces = false;
+        }
+         else if (!strcmp(argV[parmInd], "-s")
+              ||  !strcmp(argV[parmInd], "-S"))
+        {
+            doSchema = false;
+        }
+         else if (!strcmp(argV[parmInd], "-f")
+              ||  !strcmp(argV[parmInd], "-F"))
+        {
+            schemaFullChecking = true;
+        }
+         else if (!strcmp(argV[parmInd], "-p")
+              ||  !strcmp(argV[parmInd], "-P"))
+        {
+            namespacePrefixes = true;
+        }
+         else
+        {
+            XERCES_STD_QUALIFIER cerr << "Unknown option '" << argV[parmInd]
+                 << "', ignoring it\n" << XERCES_STD_QUALIFIER endl;
+        }
+    }
+
+    //
+    //  And now we have to have only one parameter left and it must be
+    //  the file name.
+    //
+    if (parmInd + 1 != argC)
+    {
+        usage();
+        XMLPlatformUtils::Terminate();
+        return 1;
+    }
+    xmlFile = argV[parmInd];
+
+    //
+    //  Create a SAX parser object. Then, according to what we were told on
+    //  the command line, set it to validate or not.
+    //
+    SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
+
+    //
+    //  Then, according to what we were told on
+    //  the command line, set it to validate or not.
+    //
+    if (valScheme == SAX2XMLReader::Val_Auto)
+    {
+        parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
+        parser->setFeature(XMLUni::fgXercesDynamic, true);
+    }
+
+    if (valScheme == SAX2XMLReader::Val_Never)
+    {
+        parser->setFeature(XMLUni::fgSAX2CoreValidation, false);
+    }
+
+    if (valScheme == SAX2XMLReader::Val_Always)
+    {
+        parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
+        parser->setFeature(XMLUni::fgXercesDynamic, false);
+    }
+
+    parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, doNamespaces);
+    parser->setFeature(XMLUni::fgXercesSchema, doSchema);
+    parser->setFeature(XMLUni::fgXercesSchemaFullChecking, schemaFullChecking);
+    parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, namespacePrefixes);
+
+    //
+    //  Create the handler object and install it as the document and error
+    //  handler for the parser. Then parse the file and catch any exceptions
+    //  that propogate out
+    //
+
+    struct timeval timing1, timing2;
+    int errorCount = 0;
+    int errorCode = 0;
+    try
+    {
+        SAX2PrintHandlers handler(encodingName, unRepFlags, expandNamespaces);
+        parser->setContentHandler(&handler);
+        parser->setErrorHandler(&handler);
+       gettimeofday(&timing1, NULL);
+        parser->parse(xmlFile);
+       gettimeofday(&timing2, NULL);
+        errorCount = parser->getErrorCount();
+    }
+    catch (const OutOfMemoryException&)
+    {
+        XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl;
+        errorCode = 5;          
+    }
+    catch (const XMLException& toCatch)
+    {
+        XERCES_STD_QUALIFIER cerr << "\nAn error occurred\n  Error: "
+             << StrX(toCatch.getMessage())
+             << "\n" << XERCES_STD_QUALIFIER endl;
+        errorCode = 4;
+    }
+
+    if(errorCode) {
+        XMLPlatformUtils::Terminate();
+        return errorCode;
+    }
+
+    //
+    //  Delete the parser itself.  Must be done prior to calling Terminate, below.
+    //
+    delete parser;
+
+    fprintf(stdout, "%d\n", ((timing2.tv_sec * 1000000 + timing2.tv_usec) - (timing1.tv_sec * 1000000 + timing1.tv_usec)) / 1000);
+
+    // And call the termination method
+    XMLPlatformUtils::Terminate();
+
+    if (errorCount > 0)
+        return 4;
+    else
+        return 0;
+}
+
diff --git a/helm/papers/use_case/stats/parse/SAX2Print/SAX2Print.hpp b/helm/papers/use_case/stats/parse/SAX2Print/SAX2Print.hpp
new file mode 100644 (file)
index 0000000..7d89f74
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright 1999-2000,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+/*
+ * $Log$
+ * Revision 1.1  2004/11/23 13:38:52  lpadovan
+ * * basic infrastructure for collecting statistics
+ *
+ * Revision 1.4  2004/09/08 13:55:33  peiyongz
+ * Apache License Version 2.0
+ *
+ * Revision 1.3  2003/05/30 09:36:36  gareth
+ * Use new macros for iostream.h and std:: issues.
+ *
+ * Revision 1.2  2003/02/05 18:53:23  tng
+ * [Bug 11915] Utility for freeing memory.
+ *
+ * Revision 1.1  2000/08/02 19:16:14  jpolast
+ * initial checkin of SAX2Print
+ *
+ *
+ */
+
+// ---------------------------------------------------------------------------
+//  Includes for all the program files to see
+// ---------------------------------------------------------------------------
+#include <string.h>
+#if defined(XERCES_NEW_IOSTREAMS)
+#include <iostream>
+#else
+#include <iostream.h>
+#endif
+#include <stdlib.h>
+#include "SAX2PrintHandlers.hpp"
+
+
+// ---------------------------------------------------------------------------
+//  This is a simple class that lets us do easy (though not terribly efficient)
+//  trancoding of XMLCh data to local code page for display.
+// ---------------------------------------------------------------------------
+class StrX
+{
+public :
+    // -----------------------------------------------------------------------
+    //  Constructors and Destructor
+    // -----------------------------------------------------------------------
+    StrX(const XMLCh* const toTranscode)
+    {
+        // Call the private transcoding method
+        fLocalForm = XMLString::transcode(toTranscode);
+    }
+
+    ~StrX()
+    {
+        XMLString::release(&fLocalForm);
+    }
+
+    // -----------------------------------------------------------------------
+    //  Getter methods
+    // -----------------------------------------------------------------------
+    const char* localForm() const
+    {
+        return fLocalForm;
+    }
+
+private :
+    // -----------------------------------------------------------------------
+    //  Private data members
+    //
+    //  fLocalForm
+    //      This is the local code page form of the string.
+    // -----------------------------------------------------------------------
+    char*   fLocalForm;
+};
+
+inline XERCES_STD_QUALIFIER ostream& operator<<(XERCES_STD_QUALIFIER ostream& target, const StrX& toDump)
+{
+    target << toDump.localForm();
+    return target;
+}
diff --git a/helm/papers/use_case/stats/parse/SAX2Print/SAX2PrintHandlers.cpp b/helm/papers/use_case/stats/parse/SAX2Print/SAX2PrintHandlers.cpp
new file mode 100644 (file)
index 0000000..7395059
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+/*
+ * $Log$
+ * Revision 1.1  2004/11/23 13:38:52  lpadovan
+ * * basic infrastructure for collecting statistics
+ *
+ * Revision 1.10  2004/09/08 13:55:33  peiyongz
+ * Apache License Version 2.0
+ *
+ * Revision 1.9  2003/05/30 09:36:36  gareth
+ * Use new macros for iostream.h and std:: issues.
+ *
+ * Revision 1.8  2003/03/17 21:03:52  peiyongz
+ * Bug#17983
+ *
+ * Revision 1.7  2002/05/28 20:24:15  tng
+ * XMLUni::fgEmptyString which is defined as "EMPTY" is incorrectly used as an empty string, should use XMLUni::fgZeroLenString instead
+ *
+ * Revision 1.6  2002/02/01 22:40:44  peiyongz
+ * sane_include
+ *
+ * Revision 1.5  2001/05/11 13:24:57  tng
+ * Copyright update.
+ *
+ * Revision 1.4  2001/05/03 16:00:03  tng
+ * Schema: samples update with schema
+ *
+ * Revision 1.3  2000/10/10 23:55:53  andyh
+ * XMLFormatter patch, contributed by Bill Schindler.  Fix problems with
+ * output to multi-byte encodings.
+ *
+ * Revision 1.2  2000/08/09 22:20:38  jpolast
+ * updates for changes to sax2 core functionality.
+ *
+ * Revision 1.1  2000/08/02 19:16:14  jpolast
+ * initial checkin of SAX2Print
+ *
+ *
+ */
+
+
+
+// ---------------------------------------------------------------------------
+//  Includes
+// ---------------------------------------------------------------------------
+#include <xercesc/util/XMLUniDefs.hpp>
+#include <xercesc/sax2/Attributes.hpp>
+#include "SAX2Print.hpp"
+
+
+// ---------------------------------------------------------------------------
+//  Local const data
+//
+//  Note: This is the 'safe' way to do these strings. If you compiler supports
+//        L"" style strings, and portability is not a concern, you can use
+//        those types constants directly.
+// ---------------------------------------------------------------------------
+static const XMLCh  gEndElement[] = { chOpenAngle, chForwardSlash, chNull };
+static const XMLCh  gEndPI[] = { chQuestion, chCloseAngle, chNull };
+static const XMLCh  gStartPI[] = { chOpenAngle, chQuestion, chNull };
+static const XMLCh  gXMLDecl1[] =
+{
+        chOpenAngle, chQuestion, chLatin_x, chLatin_m, chLatin_l
+    ,   chSpace, chLatin_v, chLatin_e, chLatin_r, chLatin_s, chLatin_i
+    ,   chLatin_o, chLatin_n, chEqual, chDoubleQuote, chDigit_1, chPeriod
+    ,   chDigit_0, chDoubleQuote, chSpace, chLatin_e, chLatin_n, chLatin_c
+    ,   chLatin_o, chLatin_d, chLatin_i, chLatin_n, chLatin_g, chEqual
+    ,   chDoubleQuote, chNull
+};
+
+static const XMLCh  gXMLDecl2[] =
+{
+        chDoubleQuote, chQuestion, chCloseAngle
+    ,   chLF, chNull
+};
+
+
+
+
+// ---------------------------------------------------------------------------
+//  SAX2PrintHandlers: Constructors and Destructor
+// ---------------------------------------------------------------------------
+SAX2PrintHandlers::SAX2PrintHandlers( const   char* const              encodingName
+                                    , const XMLFormatter::UnRepFlags unRepFlags
+                                                                       , const bool                                     expandNamespaces) :
+
+    fFormatter
+    (
+        encodingName
+        , 0
+        , this
+        , XMLFormatter::NoEscapes
+        , unRepFlags
+    ),
+       fExpandNS ( expandNamespaces )
+{
+    //
+    //  Go ahead and output an XML Decl with our known encoding. This
+    //  is not the best answer, but its the best we can do until we
+    //  have SAX2 support.
+    //
+    //
+    //fFormatter << gXMLDecl1 << fFormatter.getEncodingName() << gXMLDecl2;
+}
+
+SAX2PrintHandlers::~SAX2PrintHandlers()
+{
+}
+
+
+// ---------------------------------------------------------------------------
+//  SAX2PrintHandlers: Overrides of the output formatter target interface
+// ---------------------------------------------------------------------------
+void SAX2PrintHandlers::writeChars(const XMLByte* const toWrite)
+{
+}
+
+void SAX2PrintHandlers::writeChars(const XMLByte* const toWrite,
+                                   const unsigned int count,
+                                   XMLFormatter* const formatter)
+{
+    // For this one, just dump them to the standard output
+    // Surprisingly, Solaris was the only platform on which
+    // required the char* cast to print out the string correctly.
+    // Without the cast, it was printing the pointer value in hex.
+    // Quite annoying, considering every other platform printed
+    // the string with the explicit cast to char* below.
+  XERCES_STD_QUALIFIER cout.write((char *) toWrite, (int) count);
+       XERCES_STD_QUALIFIER cout.flush();
+}
+
+
+// ---------------------------------------------------------------------------
+//  SAX2PrintHandlers: Overrides of the SAX ErrorHandler interface
+// ---------------------------------------------------------------------------
+void SAX2PrintHandlers::error(const SAXParseException& e)
+{
+    XERCES_STD_QUALIFIER cerr << "\nError at file " << StrX(e.getSystemId())
+                << ", line " << e.getLineNumber()
+                << ", char " << e.getColumnNumber()
+         << "\n  Message: " << StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl;
+}
+
+void SAX2PrintHandlers::fatalError(const SAXParseException& e)
+{
+    XERCES_STD_QUALIFIER cerr << "\nFatal Error at file " << StrX(e.getSystemId())
+                << ", line " << e.getLineNumber()
+                << ", char " << e.getColumnNumber()
+         << "\n  Message: " << StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl;
+}
+
+void SAX2PrintHandlers::warning(const SAXParseException& e)
+{
+    XERCES_STD_QUALIFIER cerr << "\nWarning at file " << StrX(e.getSystemId())
+                << ", line " << e.getLineNumber()
+                << ", char " << e.getColumnNumber()
+         << "\n  Message: " << StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl;
+}
+
+
+// ---------------------------------------------------------------------------
+//  SAX2PrintHandlers: Overrides of the SAX DTDHandler interface
+// ---------------------------------------------------------------------------
+void SAX2PrintHandlers::unparsedEntityDecl(const     XMLCh* const name
+                                          , const   XMLCh* const publicId
+                                          , const   XMLCh* const systemId
+                                          , const   XMLCh* const notationName)
+{
+    // Not used at this time
+}
+
+
+void SAX2PrintHandlers::notationDecl(const   XMLCh* const name
+                                    , const XMLCh* const publicId
+                                    , const XMLCh* const systemId)
+{
+    // Not used at this time
+}
+
+
+// ---------------------------------------------------------------------------
+//  SAX2PrintHandlers: Overrides of the SAX DocumentHandler interface
+// ---------------------------------------------------------------------------
+void SAX2PrintHandlers::characters(const     XMLCh* const    chars
+                                  , const   unsigned int    length)
+{
+    //fFormatter.formatBuf(chars, length, XMLFormatter::CharEscapes);
+}
+
+
+void SAX2PrintHandlers::endDocument()
+{
+}
+
+
+void SAX2PrintHandlers::endElement(const XMLCh* const uri,
+                                                                const XMLCh* const localname,
+                                                                const XMLCh* const qname)
+{
+#if 0
+    // No escapes are legal here
+    fFormatter << XMLFormatter::NoEscapes << gEndElement ;
+       if ( fExpandNS )
+       {
+               if (XMLString::compareIString(uri,XMLUni::fgZeroLenString) != 0)
+                               fFormatter  << uri << chColon;
+               fFormatter << localname << chCloseAngle;
+       }
+       else
+               fFormatter << qname << chCloseAngle;
+#endif
+}
+
+
+void SAX2PrintHandlers::ignorableWhitespace( const   XMLCh* const chars
+                                            ,const  unsigned int length)
+{
+    //fFormatter.formatBuf(chars, length, XMLFormatter::NoEscapes);
+}
+
+
+void SAX2PrintHandlers::processingInstruction(const  XMLCh* const target
+                                            , const XMLCh* const data)
+{
+#if 0
+    fFormatter << XMLFormatter::NoEscapes << gStartPI  << target;
+    if (data)
+        fFormatter << chSpace << data;
+    fFormatter << XMLFormatter::NoEscapes << gEndPI;
+#endif
+}
+
+
+void SAX2PrintHandlers::startDocument()
+{
+}
+
+
+void SAX2PrintHandlers::startElement(const   XMLCh* const    uri,
+                                                                       const   XMLCh* const    localname,
+                                                                       const   XMLCh* const    qname,
+                                    const   Attributes&                attributes)
+{
+#if 0
+    // The name has to be representable without any escapes
+    fFormatter  << XMLFormatter::NoEscapes << chOpenAngle ;
+       if ( fExpandNS )
+       {
+               if (XMLString::compareIString(uri,XMLUni::fgZeroLenString) != 0)
+                               fFormatter  << uri << chColon;
+               fFormatter << localname ;
+       }
+       else
+               fFormatter << qname ;
+
+    unsigned int len = attributes.getLength();
+    for (unsigned int index = 0; index < len; index++)
+    {
+        //
+        //  Again the name has to be completely representable. But the
+        //  attribute can have refs and requires the attribute style
+        //  escaping.
+        //
+        fFormatter  << XMLFormatter::NoEscapes << chSpace ;
+               if ( fExpandNS )
+               {
+                       if (XMLString::compareIString(attributes.getURI(index),XMLUni::fgZeroLenString) != 0)
+                               fFormatter  << attributes.getURI(index) << chColon;
+                       fFormatter  << attributes.getLocalName(index) ;
+               }
+               else
+                       fFormatter  << attributes.getQName(index) ;
+
+               fFormatter  << chEqual << chDoubleQuote
+                    << XMLFormatter::AttrEscapes
+                           << attributes.getValue(index)
+                    << XMLFormatter::NoEscapes
+                    << chDoubleQuote;
+    }
+    fFormatter << chCloseAngle;
+#endif
+}
diff --git a/helm/papers/use_case/stats/parse/SAX2Print/SAX2PrintHandlers.hpp b/helm/papers/use_case/stats/parse/SAX2Print/SAX2PrintHandlers.hpp
new file mode 100644 (file)
index 0000000..d354c9e
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright 1999-2000,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+/*
+ * $Log$
+ * Revision 1.1  2004/11/23 13:38:52  lpadovan
+ * * basic infrastructure for collecting statistics
+ *
+ * Revision 1.7  2004/09/08 13:55:33  peiyongz
+ * Apache License Version 2.0
+ *
+ * Revision 1.6  2004/02/15 19:43:15  amassari
+ * Removed cause for warnings in VC 7.1
+ *
+ * Revision 1.5  2002/11/05 21:46:20  tng
+ * Explicit code using namespace in application.
+ *
+ * Revision 1.4  2002/02/01 22:40:44  peiyongz
+ * sane_include
+ *
+ * Revision 1.3  2000/10/10 23:55:55  andyh
+ * XMLFormatter patch, contributed by Bill Schindler.  Fix problems with
+ * output to multi-byte encodings.
+ *
+ * Revision 1.2  2000/08/09 22:20:39  jpolast
+ * updates for changes to sax2 core functionality.
+ *
+ * Revision 1.1  2000/08/02 19:16:14  jpolast
+ * initial checkin of SAX2Print
+ *
+ *
+ */
+
+#include    <xercesc/sax2/DefaultHandler.hpp>
+#include    <xercesc/framework/XMLFormatter.hpp>
+
+XERCES_CPP_NAMESPACE_USE
+
+class SAX2PrintHandlers : public DefaultHandler, private XMLFormatTarget
+{
+public:
+    // -----------------------------------------------------------------------
+    //  Constructors
+    // -----------------------------------------------------------------------
+    SAX2PrintHandlers
+    (
+        const   char* const                 encodingName
+        , const XMLFormatter::UnRepFlags    unRepFlags
+               , const bool                                            expandNamespaces
+    );
+    ~SAX2PrintHandlers();
+
+
+    // -----------------------------------------------------------------------
+    //  Implementations of the format target interface
+    // -----------------------------------------------------------------------
+    void writeChars
+    (
+        const   XMLByte* const  toWrite
+    );
+
+    void writeChars
+    (
+        const   XMLByte* const  toWrite
+        , const unsigned int    count
+        , XMLFormatter* const   formatter
+    );
+
+
+    // -----------------------------------------------------------------------
+    //  Implementations of the SAX DocumentHandler interface
+    // -----------------------------------------------------------------------
+    void endDocument();
+
+    void endElement( const XMLCh* const uri,
+                                        const XMLCh* const localname,
+                                        const XMLCh* const qname);
+
+    void characters(const XMLCh* const chars, const unsigned int length);
+
+    void ignorableWhitespace
+    (
+        const   XMLCh* const    chars
+        , const unsigned int    length
+    );
+
+    void processingInstruction
+    (
+        const   XMLCh* const    target
+        , const XMLCh* const    data
+    );
+
+    void startDocument();
+
+    void startElement( const   XMLCh* const    uri,
+                                               const   XMLCh* const    localname,
+                                               const   XMLCh* const    qname,
+                                           const   Attributes&         attributes);
+
+
+
+    // -----------------------------------------------------------------------
+    //  Implementations of the SAX ErrorHandler interface
+    // -----------------------------------------------------------------------
+    void warning(const SAXParseException& exc);
+    void error(const SAXParseException& exc);
+    void fatalError(const SAXParseException& exc);
+
+
+
+    // -----------------------------------------------------------------------
+    //  Implementation of the SAX DTDHandler interface
+    // -----------------------------------------------------------------------
+    void notationDecl
+    (
+        const   XMLCh* const    name
+        , const XMLCh* const    publicId
+        , const XMLCh* const    systemId
+    );
+
+    void unparsedEntityDecl
+    (
+        const   XMLCh* const    name
+        , const XMLCh* const    publicId
+        , const XMLCh* const    systemId
+        , const XMLCh* const    notationName
+    );
+
+private :
+    // -----------------------------------------------------------------------
+    //  Private data members
+    //
+    //  fFormatter
+    //      This is the formatter object that is used to output the data
+    //      to the target. It is set up to format to the standard output
+    //      stream.
+    // -----------------------------------------------------------------------
+    XMLFormatter    fFormatter;
+       bool                    fExpandNS ;
+};
diff --git a/helm/papers/use_case/stats/parse/parse_xmltree.c b/helm/papers/use_case/stats/parse/parse_xmltree.c
new file mode 100644 (file)
index 0000000..ae44269
--- /dev/null
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <sys/time.h>
+#include <libxml/parser.h>
+
+int
+main(int argc, char *argv[])
+{
+       struct timeval timing1, timing2;
+       gettimeofday(&timing1, NULL);
+       xmlParseFile(argv[1]);
+       gettimeofday(&timing2, NULL);
+       fprintf(stdout, "%d\n",
+                       ((timing2.tv_sec * 1000000 + timing2.tv_usec) -
+                        (timing1.tv_sec * 1000000 + timing1.tv_usec)) / 1000);
+       return 0;
+}
+
diff --git a/helm/papers/use_case/stats/parsing_time_expat.sh b/helm/papers/use_case/stats/parsing_time_expat.sh
new file mode 100755 (executable)
index 0000000..634f2c1
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+TIME=`zcat $1 | ./parse/parse_expat`
+echo `fgrep $1 $2 | cut -d ' ' -f 2,3`" "$TIME
diff --git a/helm/papers/use_case/stats/parsing_time_libxml2_reader.sh b/helm/papers/use_case/stats/parsing_time_libxml2_reader.sh
new file mode 100755 (executable)
index 0000000..50a2aba
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+TIME=`zcat $1 | ./parse/parse_xmlreader`
+echo `fgrep $1 $2 | cut -d ' ' -f 2,3`" "$TIME
diff --git a/helm/papers/use_case/stats/parsing_time_libxml2_sax2.sh b/helm/papers/use_case/stats/parsing_time_libxml2_sax2.sh
new file mode 100755 (executable)
index 0000000..f6e9a6d
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+TIME=`zcat $1 | ./parse/parse_xmlsax`
+echo `fgrep $1 $2 | cut -d ' ' -f 2,3`" "$TIME
diff --git a/helm/papers/use_case/stats/parsing_time_libxml2_tree.sh b/helm/papers/use_case/stats/parsing_time_libxml2_tree.sh
new file mode 100755 (executable)
index 0000000..9e08b61
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+zcat $1 >/tmp/a
+TIME=`./parse/parse_xmltree /tmp/a`
+echo `fgrep $1 $2 | cut -d ' ' -f 2,3`" "$TIME
diff --git a/helm/papers/use_case/stats/parsing_time_xerces_sax2.sh b/helm/papers/use_case/stats/parsing_time_xerces_sax2.sh
new file mode 100755 (executable)
index 0000000..64f1513
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+zcat $1 >/tmp/a
+TIME=`./parse/SAX2Print/SAX2Print -v=never /tmp/a`
+echo `fgrep $1 $2 | cut -d ' ' -f 2,3`" "$TIME
diff --git a/helm/papers/use_case/stats/parsing_time_xerces_tree.sh b/helm/papers/use_case/stats/parsing_time_xerces_tree.sh
new file mode 100755 (executable)
index 0000000..29e55df
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+zcat $1 >/tmp/a
+TIME=`./parse/DOMCount/DOMCount -v=never /tmp/a`
+echo `fgrep $1 $2 | cut -d ' ' -f 2,3`" "$TIME
diff --git a/helm/papers/use_case/stats/parsing_times.gpscript b/helm/papers/use_case/stats/parsing_times.gpscript
new file mode 100644 (file)
index 0000000..06b7992
--- /dev/null
@@ -0,0 +1,28 @@
+set terminal postscript color
+set key left box
+set label font "Helvetica,8"
+
+set output "parsing_times_candidates.ps"
+plot "parsing_times_expat_candidates.txt" using 1:3 title "Expat" with lines, \
+     "parsing_times_xerces_sax2_candidates.txt" using 1:3 title "xerces sax2" with lines, \
+     "parsing_times_xerces_tree_candidates.txt" using 1:3 title "xerces tree" with lines, \
+     "parsing_times_libxml2_sax2_candidates.txt" using 1:3 title "libxml2 sax2" with lines, \
+     "parsing_times_libxml2_reader_candidates.txt" using 1:3 title "libxml2 reader" with lines, \
+     "parsing_times_libxml2_tree_candidates.txt" using 1:3 title "libxml2 tree" with lines
+
+set output "parsing_times_candidates_c1.ps"
+plot "parsing_times_expat_candidates_c1.txt" using 1:3 title "Expat" with lines, \
+     "parsing_times_xerces_sax2_candidates_c1.txt" using 1:3 title "xerces sax2" with lines, \
+     "parsing_times_xerces_tree_candidates_c1.txt" using 1:3 title "xerces tree" with lines, \
+     "parsing_times_libxml2_sax2_candidates_c1.txt" using 1:3 title "libxml2 sax2" with lines, \
+     "parsing_times_libxml2_reader_candidates_c1.txt" using 1:3 title "libxml2 reader" with lines, \
+     "parsing_times_libxml2_tree_candidates_c1.txt" using 1:3 title "libxml2 tree" with lines
+
+set output "parsing_times_candidates_3d.ps"
+splot "parsing_times_expat_candidates.txt" title "Expat", \
+      "parsing_times_xerces_sax2_candidates.txt" title "xerces sax2", \
+      "parsing_times_xerces_tree_candidates.txt" title "xerces tree", \
+      "parsing_times_libxml2_sax2_candidates.txt" title "libxml2 sax2", \
+      "parsing_times_libxml2_reader_candidates.txt" title "libxml2 reader", \
+      "parsing_times_libxml2_tree_candidates.txt" title "libxml2 tree"
+
diff --git a/helm/papers/use_case/stats/parsing_times.sh b/helm/papers/use_case/stats/parsing_times.sh
new file mode 100755 (executable)
index 0000000..335a246
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+find $1/ -name "*.body.gz" -exec ./$2 {} $3 \;
diff --git a/helm/papers/use_case/stats/serialize_into_text.xsl b/helm/papers/use_case/stats/serialize_into_text.xsl
new file mode 100644 (file)
index 0000000..97f542f
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text"/>
+
+<xsl:template match="/">
+  <xsl:apply-templates select="//stats"/>
+</xsl:template>
+
+<xsl:template match="stats">
+  <!--<xsl:value-of select="number(elements/total) + number(text-nodes/total)"/>-->
+  <xsl:value-of select="number(elements/total)"/>
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="number(depth/max)"/>
+  <xsl:text>
+</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/helm/papers/use_case/stats/stats_candidates.sh b/helm/papers/use_case/stats/stats_candidates.sh
new file mode 100755 (executable)
index 0000000..3707529
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+DEST=stats_candidates
+DESTXML=$DEST.xml
+echo "<statistics>" >$DESTXML
+for i in `fgrep -v '#' CANDIDATI`; do
+  SOURCE=`echo $i | tr ":/'" '_' `.gz
+  ./stats.sh CICXML_NOBLANKS_NODTD/$SOURCE >>$DESTXML
+done
+echo "</statistics>" >>$DESTXML
+gzip $DESTXML
diff --git a/helm/papers/use_case/stats/stats_candidates_c1.sh b/helm/papers/use_case/stats/stats_candidates_c1.sh
new file mode 100755 (executable)
index 0000000..3dee0a1
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+DEST=stats_candidates_c1
+DESTXML=$DEST.xml
+echo "<statistics>" >$DESTXML
+for i in `fgrep -v '#' CANDIDATI`; do
+  SOURCE=`echo $i | tr ":/'" '_' `.gz
+  ./stats.sh CONTENTNB/$SOURCE >>$DESTXML
+done
+echo "</statistics>" >>$DESTXML
+gzip $DESTXML
diff --git a/helm/papers/use_case/stats/validating_times.gpscript b/helm/papers/use_case/stats/validating_times.gpscript
new file mode 100644 (file)
index 0000000..57301dd
--- /dev/null
@@ -0,0 +1,16 @@
+set terminal postscript color
+set key left box
+set label font "Helvetica,8"
+
+set output "parsing_validating_times_candidates.ps"
+plot "parsing_validating_times_xerces_sax2_candidates.txt" using 2:3 title "xerces sax2 parse+validate" with lines smooth bezier, \
+     "parsing_validating_times_xerces_tree_candidates.txt" using 2:3 title "xerces tree parse+validate" with lines smooth bezier, \
+     "parsing_validating_times_libxml2_tree_candidates.txt" using 2:3 title "libxml2 tree parse+validate" with lines smooth bezier, \
+     "parsing_validating_times_flea_candidates.txt" using 2:3 title "flea parse+validate" with lines smooth bezier
+
+set output "validating_times_candidates.ps"
+plot "validating_times_xerces_sax2_candidates.txt" using 2:3 title "xerces sax2 validate" with lines smooth bezier, \
+     "validating_times_xerces_tree_candidates.txt" using 2:3 title "xerces tree validate" with lines smooth bezier, \
+     "validating_times_libxml2_tree_candidates.txt" using 2:3 title "libxml2 tree validate" with lines smooth bezier, \
+     "validating_times_flea_candidates.txt" using 2:3 title "flea validate" with lines smooth bezier
+