El proyecto se ha dividido en dos partes:
Obtención de etiquetas y el número de repeticiones de cada etiqueta, a partir de la muestra considerada.
Reducción de la DTD DocBook XML v4.1.2. La nueva DTD contendrá únicamente aquellas etiquetas obtenidas en la primera parte.
La búsqueda de las etiquetas dentro de un documento, se llevó a cabo con el programa analizador_tags[3], y el número de veces que aparece una determinada etiqueta en la muestra se obtiene gracias al script contador_tags.pl[4].
El script principal del proyecto es el denominado “contador_tags.pl”. Este se encarga de buscar los documentos para analizar, verificar que están correctamente formados[5], obtener las etiquetas que estos posean[6] y mostrar por pantalla la relación de etiquetas más comúnmente utilizadas, junto al número de repeticiones de cada.
El resultado obtenido, tras ejecutar el script “contador_tags.pl” sobre el directorio /documentos/docbook_xml/[7], es:
[fys@todoscsi]$ ./contador_tags.pl Buscando los documentos... [Hecho] Analizando la validez de los documentos... [Hecho] Buscando etiquetas... [Hecho] Contando las etiquetas... [Hecho] A continuación se mostrarán las etiquetas y el número de apariciones: Número Etiquetas apariciones 1 constant 1 constructorsynopsis 1 fax 1 fieldsynopsis 1 glossary 1 glossaryinfo 1 glossseealso 1 informalfigure 1 initializer 1 markup 1 menuchoice 1 modespec 1 otheraddr 1 phone 1 reference 1 referenceinfo 1 sectioninfo 1 set 1 setinfo 1 tfoot 1 toclevel2 1 tocpart 2 ackno 2 artpagenums 2 bibliodiv 2 bibliographyinfo 2 bibliomixed 2 classname 2 classsynopsis 2 collab 2 collabname 2 confdates 2 confgroup 2 confnum 2 confsponsor 2 conftitle 2 contractnum 2 contractsponsor 2 corpauthor 2 epigraph 2 errorname 2 honorific 2 invpartnumber 2 lineage 2 olink 2 ooclass 2 printhistory 2 pubsnumber 2 refsynopsisdiv 2 seriesvolnums 2 void 3 city 3 country 3 equation 3 glossdiv 3 guibutton 3 index 3 keysym 3 keywordset 3 postcode 3 seealsoie 3 segmentedlist 3 simpara 3 state 3 street 3 synopsis 3 titleabbrev 3 tocchap 3 toclevel1 4 bibliomset 4 biblioset 4 firstterm 4 inlinegraphic 4 issn 4 issuenum 4 methodsynopsis 4 pagenums 4 qandadiv 4 shortaffil 4 volumenum 5 authorblurb 5 bibliography 5 dedication 5 isbn 5 jobtitle 5 methodname 5 refmeta 5 returnvalue 6 areaset 6 guisubmenu 6 methodparam 6 orgdiv 6 toc 7 areaspec 7 edition 7 informalexample 7 othername 7 programlistingco 7 refentry 7 refnamediv 7 refpurpose 7 refsect1 7 seglistitem 7 symbol 8 anchor 8 attribution 8 bridgehead 8 caption 8 group 8 publisher 8 sect5 8 sgmltag 8 superscript 9 legalnotice 10 corpname 10 editor 10 guimenu 10 keycombo 10 preface 10 refname 10 subtitle 11 cmdsynopsis 11 partintro 11 varname 12 foreignphrase 12 modifier 12 publishername 12 qandaset 13 segtitle 14 productnumber 14 trademark 15 type 17 caution 17 optional 17 part 18 keyword 19 copyright 19 holder 20 arg 20 authorgroup 20 citetitle 21 hardware 21 see 21 seg 22 bookinfo 22 graphic 22 warning 23 chapterinfo 24 orgname 24 tocentry 26 book 26 citation 27 biblioentry 27 year 28 pubdate 28 token 30 revhistory 32 appendix 32 sidebar 33 othercredit 34 contrib 34 highlights 34 substeps 35 area 35 glosslist 37 keycap 38 parameter 39 informaltable 39 table 43 abstract 44 thead 47 qandaentry 47 question 47 wordasword 48 answer 49 blockquote 50 seeie 51 calloutlist 52 productname 56 important 56 structfield 66 figure 71 guimenuitem 74 function 75 tertiaryie 78 tbody 78 tgroup 79 tertiary 81 tip 87 abbrev 95 colspec 104 procedure 105 example 122 articleinfo 126 authorinitials 128 article 130 revremark 132 callout 132 releaseinfo 134 revision 134 revnumber 138 note 147 mediaobject 150 co 151 date 161 simplelist 162 chapter 166 orderedlist 174 affiliation 174 citerefentry 175 prompt 177 formalpara 179 manvolnum 179 refentrytitle 185 address 188 application 196 author 199 variablelist 215 email 224 footnote 244 surname 248 firstname 260 option 264 inlinemediaobject 273 computeroutput 311 quote 384 textobject 390 link 393 xref 403 phrase 410 itemizedlist 435 literallayout 443 imagedata 443 imageobject 453 step 461 glossdef 461 glossentry 465 glossterm 480 row 511 sect3 531 replaceable 549 section 551 envar 658 programlisting 742 sect1 862 userinput 922 varlistentry 935 term 998 indexentry 998 primaryie 1035 secondaryie 1084 sect2 1200 secondary 1259 sect4 1273 entry 1358 systemitem 1511 emphasis 1591 acronym 1799 screen 1951 literal 2318 primary 2429 indexterm 2756 member 3328 ulink 3453 listitem 4198 command 5279 title 6077 filename 14982 para [fys@todoscsi]$ |
![]() | Esta salida no es exactamente la información que presenta el script. ‘contador_tags.pl’ no ordena las etiquetas de menor a mayor frecuencia de aparición, simplemente muestra las etiquetas según las va procesando. La ordenación se ha obtenido gracias al programa sort, para mejorar la legibilidad de la salida. |
Una vez obtenidas las etiquetas que permanecerían en la DTD, se obtuvo un listado de las etiquetas que debían ser eliminadas de la DTD DocBook XML v4.1.2, debido a su poco uso.
Estas etiquetas pueden verse en el archivo rinclx.mod de la DTD Reducida. El contenido del archivo anterior se muestra a continuación:
<!--
######################################################################
DocBook XML Reducida Incorporacion V4.1.2.1
Este archivo es una parte de DocBook XML DTD Reducida V4.1.2.1
Cualquier duda o comentario sobre esta DTD dirijalas a:
Fernando Reyero <[email protected]>
Sergio Gonzalez <[email protected]>
######################################################################
-->
<!-- Entidades de la piscina de de informacion -->
<!ENTITY % bibliomisc.module "IGNORE">
<!ENTITY % subjectset.content.module "IGNORE">
<!ENTITY % itermset.module "IGNORE">
<!ENTITY % msgset.content.module "IGNORE">
<!ENTITY % msgentry.module "IGNORE">
<!ENTITY % simplemsgentry.module "IGNORE">
<!ENTITY % msg.module "IGNORE">
<!ENTITY % msgmain.module "IGNORE">
<!ENTITY % msgsub.module "IGNORE">
<!ENTITY % msgrel.module "IGNORE">
<!ENTITY % msginfo.module "IGNORE">
<!ENTITY % msglevel.module "IGNORE">
<!ENTITY % msgorig.module "IGNORE">
<!ENTITY % msgaud.module "IGNORE">
<!ENTITY % msgexplan.module "IGNORE">
<!ENTITY % label.module "IGNORE">
<!ENTITY % sidebarinfo.module "IGNORE">
<!ENTITY % remark.module "IGNORE">
<!ENTITY % glosssee.module "IGNORE">
<!ENTITY % screenco.module "IGNORE">
<!ENTITY % screenshot.content.module "IGNORE">
<!ENTITY % screeninfo.module "IGNORE">
<!ENTITY % graphicco.module "IGNORE">
<!ENTITY % videoobject.module "IGNORE">
<!ENTITY % audioobject.module "IGNORE">
<!ENTITY % objectinfo.module "IGNORE">
<!ENTITY % videodata.module "IGNORE">
<!ENTITY % audiodata.module "IGNORE">
<!ENTITY % mediaobjectco.module "IGNORE">
<!ENTITY % imageobjectco.module "IGNORE">
<!ENTITY % informalequation.module "IGNORE">
<!ENTITY % inlineequation.module "IGNORE">
<!ENTITY % alt.module "IGNORE">
<!ENTITY % sbr.module "IGNORE">
<!ENTITY % synopfragmentref.module "IGNORE">
<!ENTITY % synopfragment.module "IGNORE">
<!ENTITY % funcsynopsis.content.module "IGNORE">
<!ENTITY % funcsynopsisinfo.module "IGNORE">
<!ENTITY % funcprototype.module "IGNORE">
<!ENTITY % funcdef.module "IGNORE">
<!ENTITY % varargs.module "IGNORE">
<!ENTITY % paramdef.module "IGNORE">
<!ENTITY % funcparams.module "IGNORE">
<!ENTITY % classsynopsisinfo.module "IGNORE">
<!ENTITY % oointerface.module "IGNORE">
<!ENTITY % ooexception.module "IGNORE">
<!ENTITY % interfacename.module "IGNORE">
<!ENTITY % exceptionname.module "IGNORE">
<!ENTITY % destructorsynopsis.module "IGNORE">
<!ENTITY % pob.module "IGNORE">
<!ENTITY % revdescription.module "IGNORE">
<!ENTITY % accel.module "IGNORE">
<!ENTITY % action.module "IGNORE">
<!ENTITY % database.module "IGNORE">
<!ENTITY % errorcode.module "IGNORE">
<!ENTITY % errortype.module "IGNORE">
<!ENTITY % guiicon.module "IGNORE">
<!ENTITY % guilabel.module "IGNORE">
<!ENTITY % interface.module "IGNORE">
<!ENTITY % keycode.module "IGNORE">
<!ENTITY % lineannotation.module "IGNORE">
<!ENTITY % medialabel.module "IGNORE">
<!ENTITY % shortcut.module "IGNORE">
<!ENTITY % mousebutton.module "IGNORE">
<!ENTITY % msgtext.module "IGNORE">
<!ENTITY % property.module "IGNORE">
<!ENTITY % structname.module "IGNORE">
<!ENTITY % footnoteref.module "IGNORE">
<!ENTITY % beginpage.module "IGNORE">
<!-- Entidades de la organizacion de la documentacion -->
<!ENTITY % local.indexdivcomponent.mix "IGNORE">
<!ENTITY % colophon.module "IGNORE">
<!ENTITY % tocfront.module "IGNORE">
<!ENTITY % toclevel3.module "IGNORE">
<!ENTITY % toclevel4.module "IGNORE">
<!ENTITY % toclevel5.module "IGNORE">
<!ENTITY % tocback.module "IGNORE">
<!ENTITY % lot.content.module "IGNORE">
<!ENTITY % lotentry.module "IGNORE">
<!ENTITY % appendixinfo.module "IGNORE">
<!ENTITY % indexinfo.module "IGNORE">
<!ENTITY % setindexinfo.module "IGNORE">
<!ENTITY % partinfo.module "IGNORE">
<!ENTITY % prefaceinfo.module "IGNORE">
<!ENTITY % refentryinfo.module "IGNORE">
<!ENTITY % refsect1info.module "IGNORE">
<!ENTITY % refsect2info.module "IGNORE">
<!ENTITY % refsect3info.module "IGNORE">
<!ENTITY % refsynopsisdivinfo.module "IGNORE">
<!ENTITY % local.sect1info.attrib "IGNORE">
<!ENTITY % local.sect2info.attrib "IGNORE">
<!ENTITY % local.sect3info.attrib "IGNORE">
<!ENTITY % local.sect4info.attrib "IGNORE">
<!ENTITY % local.sect5info.attrib "IGNORE">
<!ENTITY % simplesect.module "IGNORE">
<!ENTITY % indexes.module "IGNORE">
<!ENTITY % indexdiv.module "IGNORE">
<!ENTITY % refmiscinfo.module "IGNORE">
<!ENTITY % refdescriptor.module "IGNORE">
<!ENTITY % refclass.module "IGNORE">
<!ENTITY % refsect2.module "IGNORE">
<!ENTITY % refsect3.module "IGNORE">
<!--
######################################################################
Fin de DocBook XML Reducida Incorporacion V4.1.2.1
######################################################################
--> |
![]() | La eliminación de una determinada etiqueta de la DTD ‘original’, implica comprobar que desaparece todo rastro de dicha etiqueta en la DTD y que esta sigue manteniéndose consistente. |
[3] consultar el Apéndice A. Analizador de etiquetas para saber como funciona
[4] para más información lee el Apéndice B. Contador de etiquetas.
[6] Esto se logra gracias al analizador léxico, ya que una vez analizados los documentos que le pasa en script en perl, este le devuelve las etiquetas que ha encontrado.
[7] Esta es la ruta por defecto que toma el script “contador_tags.pl”, si no se le pasa ningún parámetro.