1<HTML><!-- #BeginTemplate "/Templates/MainTemplate.dwt" --> 2<HEAD> 3<!-- #BeginEditable "doctitle" --> 4<TITLE>RBReporter Scan File</TITLE> 5<!-- #EndEditable --> 6<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> 7<STYLE TYPE="TEXT/CSS"> 8<!-- 9.topicHead { font-family: "Times New Roman", Times, serif; font-size: 14pt; font-weight: bold; text-align: center; color: #333333} 10.topicList { font-family: Georgia, "Times New Roman", Times, serif; font-size: 9pt; color: #FF0099; list-style-image: url(images/diamond_bullet.gif); text-decoration: none; font-weight: bold} 11.mainBlock { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; text-align: justify} 12--> 13</STYLE> 14</HEAD> 15 16<BODY BGCOLOR="#FFFFFF" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0"> 17<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 18 <TR> 19 <TD ROWSPAN="2" COLSPAN="2" BACKGROUND="images/template_ul.gif" HEIGHT="75"><IMG SRC="images/spacer.gif" WIDTH="280" HEIGHT="1" HSPACE="0"></TD> 20 <TD HEIGHT="15" WIDTH="100%" BACKGROUND="images/template_u.gif"></TD> 21 </TR> 22 <TR> 23 <TD HEIGHT="60" > 24 <CENTER><IMG SRC="images/TitleLogo_transparent.gif" VSPACE="0"></CENTER> 25 </TD> 26 </TR> 27 <TR> 28 29 <TD WIDTH="200" BACKGROUND="images/template_l.gif" VALIGN="top"> 30 <TABLE WIDTH="180" CELLSPACING="0" CELLPADDING="1"> 31 <TR> 32 <TD CLASS="topicHead">General</TD> 33 </TR> 34 <TR> 35 <TD VALIGN="center"><IMG SRC="images/template_line.gif"></TD> 36 </TR> 37 <TR> 38 <TD CLASS="topicList"> 39 <UL> 40 <LI><A HREF="system_requirements.html">System Requirements</A></LI> 41 <LI><A HREF="faq.html">FAQ</A></LI> 42 <LI><A HREF="future_features.html">Future Releases</A></LI> 43 <LI CLASS="topicList"><A HREF="future_features.html">Version 44 History</A></LI> 45 </UL> 46 </TD> 47 </TR> 48 <TR> 49 <TD CLASS="topicHead">RB Manager</TD> 50 </TR> 51 <TR> 52 <TD VALIGN="center"><IMG SRC="images/template_line.gif"></TD> 53 </TR> 54 <TR> 55 <TD CLASS="topicList"> 56 <UL> 57 <LI><A HREF="index.html">Home</A></LI> 58 <LI><A HREF="tutorial/index.html">Tutorial</A></LI> 59 <LI><A HREF="views/index.html">Functionality and Views</A></LI> 60 <LI><A HREF="lookandfeel.html">Look and Feel</A></LI> 61 <LI><A HREF="menu.html">Menu Items</A></LI> 62 <LI CLASS="topicList"><A HREF="tutorial/step1.html">Preferences</A></LI> 63 </UL> 64 </TD> 65 </TR> 66 <TR> 67 <TD CLASS="topicHead">RB Reporter</TD> 68 </TR> 69 <TR> 70 <TD VALIGN="center"><IMG SRC="images/template_line.gif"></TD> 71 </TR> 72 <TR> 73 <TD CLASS="topicList"> 74 <UL> 75 <LI><A HREF="RBReporter.html">Home</A></LI> 76 <LI>Report Types</LI> 77 <LI><A HREF="scanfile.html">Code Scanning</A></LI> 78 </UL> 79 </TD> 80 </TR> 81 </TABLE> 82 83 <P> </P> 84 </TD> 85 86 <TD COLSPAN="2" VALIGN="top" CLASS="mainBlock"><!-- #BeginEditable "Main" --> 87 <H1 ALIGN="CENTER">RBReporter Scan XML Configuration File</H1> 88 <P><B>Introduction</B></P> 89 <P>The configuration file for RBReporter scans is a text file stored in 90 XML. The design on the format for this configuration file was kept simple 91 and so the general application of the scanner is not meant for complicated 92 analysis. The design works around three types of rules: Directory Rules, 93 File Rules, and Parse Rules. Each of these will be explained below. First, 94 here is an example file for reference. This file is the configuration 95 file used to scan the resource bundle associated with RBManager.</P> 96 <P><B>Sample Scan File </B>(rbmanager_scan.xml<B>)</B></P> 97 <BLOCKQUOTE><CODE> 98 <PRE> 99<?xml version="1.0" ?> 100<RBFILESCANNER NAME="RBManager Scanner" FILENAME="rbmanager_scanner.xml"> 101 <FILERULES> 102 <!-- FileRules can have attributes starts_with, ends_with, and contains --> 103 <FILERULE NAME="Java File" ENDS_WITH=".java" /> 104 <FILERULE NAME="XSL File" ENDS_WITH=".xsl" /> 105 </FILERULES> 106 <PARSERULES> 107 <!-- ParseRules can have attributes follows and precedes --> 108 <PARSERULE NAME="Java static resource" FOLLOWS="Resources.getTranslation(&quot;" PRECEDES="&quot;" /> 109 </PARSERULES> 110 <SCAN> 111 <DIRECTORY LOCATION="\C:\Development\RBManager\Source" RECURSE_DIRECTORIES="true"> 112 <RULES> 113 <APPLYFILERULE NAME="Java File"> 114 <APPLYPARSERULE NAME="Java static resource" /> 115 </APPLYFILERULE> 116 </RULES> 117 </DIRECTORY> 118 </SCAN> 119</RBFILESCANNER> 120 </PRE> 121 </CODE></BLOCKQUOTE> 122<P><B>Details</B></P> 123 <P>The root element of the XML file is named 'RBFILESCANNER'. This root 124 element has two optional attributes for naming the scan file in a human 125 readable manner and specifying the file name. These attributes are for 126 the developers reference; they mean nothing to RBReporter. Beneath the 127 root element are three required elements 'FILERULES', 'PARSERULES' and 128 'SCAN'. </P> 129 <P>Beneath the FILERULES element are found FILERULE elements. Any number 130 of these rules can be specified, though each must have a unique name as 131 specified in the element's NAME attribute. Along with this name attribute, 132 the attributes STARTS_WITH, ENDS_WITH, and CONTAINS may be optionally 133 specified. These are the rules applied to each file in a directory to 134 determine whether or not they will be scanned. The attribute rules are 135 applied to the file names of each file in the directory and if each is 136 found to be true, that file is evaluated against the parse rules.</P> 137 <P>Beneath the PARSERULES element are found PARSERULE elements. Any number 138 of these rules can be specified, though each must have a uniques name 139 as specifiedn in the element's NAME attrinute. Along with this name attribute, 140 the attributes FOLLOWS and PRECEDES may optionally be specified. These 141 are the rules applied to each line of text in a selected file to determine 142 if that line of text contains one or more resource keys.</P> 143 <P>Beneath the SCAN element are found DIRECTORY elements. Any number of 144 these elements can be specified. The required LOCATION attribute specifies 145 in a machine dependent manner the location of a directory for which the 146 files are to be scanned for resource bundles. An optional RECURSE_DIRECTORIES 147 attribute may be specified. If the value of this attribute is set to 'true', 148 then all directories beneath the directory specified are also scanned.</P> 149 <P>Beneath each DIRECTORY element, exactly one RULES elements can be specified.Beneath 150 this element, any number of APPLY FILE RULE elements may be specified. 151 The required NAME attribute specifies which of the file rules defined 152 previously are to be applied. Beneath these element any number of APPLYPARSERULE 153 elements may be specified. The required NAME attribute specifies which 154 of the parse rules defined previously are to be applied to the files accepted 155 by the parent file rule.</P> 156 <P><B>The Example File Explained</B></P> 157 <P>Given the details of the file structure, we can now examine how the example 158 file specifies which files to scan, and then how it specifies how to find 159 the resource keys contained in those files.</P> 160 <P>RBReporter first begins by going through each of the directories specified. 161 In the example file case, there is only one directory. It then goes through 162 each of the files contained in that directory and its subdirectories looking 163 for files that pass the 'Java File' file test. The 'Java File' test simply 164 checks the file name to see if it ends in the extension '.java'. If the 165 file has such an extension the parse rule 'Java static resource' is applied 166 to every line of text within that file.</P> 167 <P>Thus if the following file, named Sample.java, were to be found in the 168 directory. The two resource keys 'Hello' and 'World' would be found.</P> 169 <blockquote><code> 170 <pre> 171public class Sample { 172 public static void main(String args[]) { 173 System.out.println(Resources.getTranslation("Hello") + " " + Resources.getTranslation("World")); 174 } 175} 176</pre> 177 </code></blockquote> 178 179 <!-- #EndEditable --></TD> 180 </TR> 181 <TR> 182 <TD BACKGROUND="images/template_ll.gif" HEIGHT="40" WIDTH="200"> 183 <!-- Comment --> 184 </TD> 185 <TD WIDTH="80"> 186 <!-- Comment --> 187 </TD> 188 <TD> 189 <CENTER><SPAN CLASS="Copyright">Copyright 2000-2001 International Business Machines, All Rights Reserved</SPAN></CENTER> 190 </TD> 191 </TR> 192</TABLE> 193 194</BODY> 195<!-- #EndTemplate --></HTML> 196