1414// KIND, either express or implied. See the License for the
1515// specific language governing permissions and limitations
1616// under the License.
17- import javax .xml .transform .*;
18- import java .io .*;
17+ import java .io .FileOutputStream ;
18+
19+ import javax .xml .transform .Transformer ;
20+ import javax .xml .transform .TransformerFactory ;
21+
1922public class XmlToHtmlConverter extends XmlToHtmlConverterData {
2023 // To turn off generation of API docs for certain roles, comment out
2124 public static void main (String [] args ) {
@@ -26,117 +29,83 @@ public static void main(String[] args) {
2629 x .generateToc ();
2730 x .generateIndividualCommandPages ();
2831 }
32+
2933 public void generateToc () {
3034 try {
3135 TransformerFactory tFactory = TransformerFactory .newInstance ();
3236 // Generate the TOC for the API reference for User role
33- Transformer transformer =
34- tFactory .newTransformer
35- (new javax .xml .transform .stream .StreamSource
36- ("generatetocforuser.xsl" ));
37+ Transformer transformer = tFactory .newTransformer (new javax .xml .transform .stream .StreamSource ("generatetocforuser.xsl" ));
3738 // Modify this path to match your own setup.
38- transformer .transform
39- (new javax .xml .transform .stream .StreamSource
40- ("regular_user/regularUserSummary.xml" ),
41- new javax .xml .transform .stream .StreamResult
42- ( new FileOutputStream ("html/TOC_User.html" )));
39+ transformer .transform (new javax .xml .transform .stream .StreamSource ("regular_user/regularUserSummary.xml" ), new javax .xml .transform .stream .StreamResult (
40+ new FileOutputStream ("html/TOC_User.html" )));
4341 // Generate the TOC for root administrator role
44- Transformer transformer1 =
45- tFactory .newTransformer
46- (new javax .xml .transform .stream .StreamSource
47- ("generatetocforadmin.xsl" ));
42+ Transformer transformer1 = tFactory .newTransformer (new javax .xml .transform .stream .StreamSource ("generatetocforadmin.xsl" ));
4843 // Modify this path to match your own setup.
49- transformer1 .transform
50- (new javax .xml .transform .stream .StreamSource
51- ("root_admin/rootAdminSummary.xml" ),
44+ transformer1 .transform (new javax .xml .transform .stream .StreamSource ("root_admin/rootAdminSummary.xml" ),
5245 // Modify this path to your own desired output location.
53- new javax .xml .transform .stream .StreamResult
54- ( new FileOutputStream ("html/TOC_Root_Admin.html" )));
46+ new javax .xml .transform .stream .StreamResult (new FileOutputStream ("html/TOC_Root_Admin.html" )));
5547 // Generate the TOC for domain admin role
56- Transformer transformer2 =
57- tFactory .newTransformer
58- (new javax .xml .transform .stream .StreamSource
59- ("generatetocfordomainadmin.xsl" ));
48+ Transformer transformer2 = tFactory .newTransformer (new javax .xml .transform .stream .StreamSource ("generatetocfordomainadmin.xsl" ));
6049
6150 // The XML to be transformed must be at the location below.
6251 // Modify this path to match your own setup.
63- transformer2 .transform
64- (new javax .xml .transform .stream .StreamSource
65- ("domain_admin/domainAdminSummary.xml" ),
52+ transformer2 .transform (new javax .xml .transform .stream .StreamSource ("domain_admin/domainAdminSummary.xml" ),
6653 // Modify this path to your own desired output location.
67- new javax .xml .transform .stream .StreamResult
68- ( new FileOutputStream ("html/TOC_Domain_Admin.html" )));
54+ new javax .xml .transform .stream .StreamResult (new FileOutputStream ("html/TOC_Domain_Admin.html" )));
6955
70- }
71- catch (Exception e ) {
72- e .printStackTrace ( );
56+ } catch (Exception e ) {
57+ e .printStackTrace ();
7358 }
7459 }
7560
7661 // Create man pages
7762 public void generateIndividualCommandPages () {
78- for (String commandName : rootAdminCommandNames ) {
79-
80- try {
81-
82- TransformerFactory tFactory = TransformerFactory .newInstance ();
83- Transformer transformer =
84- tFactory .newTransformer
85- (new javax .xml .transform .stream .StreamSource
86- ("generateadmincommands.xsl" ));
87-
88- transformer .transform
89- // Modify this path to the location of the input files on your system.
90- (new javax .xml .transform .stream .StreamSource
91- ("root_admin/" +commandName +".xml" ),
92- // Modify this path with the desired output location.
93- new javax .xml .transform .stream .StreamResult
94- ( new FileOutputStream ("html/root_admin/" +commandName +".html" )));
95- } catch (Exception e ) {
96- e .printStackTrace ( );
97- }
63+ for (String commandName : rootAdminCommandNames ) {
64+
65+ try {
66+
67+ TransformerFactory tFactory = TransformerFactory .newInstance ();
68+ Transformer transformer = tFactory .newTransformer (new javax .xml .transform .stream .StreamSource ("generateadmincommands.xsl" ));
69+
70+ transformer .transform
71+ // Modify this path to the location of the input files on your system.
72+ (new javax .xml .transform .stream .StreamSource ("root_admin/" + commandName + ".xml" ),
73+ // Modify this path with the desired output location.
74+ new javax .xml .transform .stream .StreamResult (new FileOutputStream ("html/root_admin/" + commandName + ".html" )));
75+ } catch (Exception e ) {
76+ e .printStackTrace ();
77+ }
9878 }
9979
100- for (String commandName : domainAdminCommandNames ) {
80+ for (String commandName : domainAdminCommandNames ) {
10181
10282 try {
10383
10484 TransformerFactory tFactory = TransformerFactory .newInstance ();
105- Transformer transformer =
106- tFactory .newTransformer
107- (new javax .xml .transform .stream .StreamSource
108- ("generatedomainadmincommands.xsl" ));
85+ Transformer transformer = tFactory .newTransformer (new javax .xml .transform .stream .StreamSource ("generatedomainadmincommands.xsl" ));
10986
11087 transformer .transform
11188 // Modify this path with the location of the input files on your system.
112- (new javax .xml .transform .stream .StreamSource
113- ("domain_admin/" +commandName +".xml" ),
114- // Modify this path to the desired output location.
115- new javax .xml .transform .stream .StreamResult
116- ( new FileOutputStream ("html/domain_admin/" +commandName +".html" )));
89+ (new javax .xml .transform .stream .StreamSource ("domain_admin/" + commandName + ".xml" ),
90+ // Modify this path to the desired output location.
91+ new javax .xml .transform .stream .StreamResult (new FileOutputStream ("html/domain_admin/" + commandName + ".html" )));
11792 } catch (Exception e ) {
118- e .printStackTrace ( );
93+ e .printStackTrace ();
11994 }
12095 }
12196
122- for (String commandName : userCommandNames ) {
97+ for (String commandName : userCommandNames ) {
12398
12499 try {
125100
126101 TransformerFactory tFactory = TransformerFactory .newInstance ();
127102
128- Transformer transformer =
129- tFactory .newTransformer
130- (new javax .xml .transform .stream .StreamSource
131- ("generateusercommands.xsl" ));
103+ Transformer transformer = tFactory .newTransformer (new javax .xml .transform .stream .StreamSource ("generateusercommands.xsl" ));
132104
133- transformer .transform
134- (new javax .xml .transform .stream .StreamSource
135- ("regular_user/" +commandName +".xml" ),
136- new javax .xml .transform .stream .StreamResult
137- ( new FileOutputStream ("html/user/" +commandName +".html" )));
105+ transformer .transform (new javax .xml .transform .stream .StreamSource ("regular_user/" + commandName + ".xml" ), new javax .xml .transform .stream .StreamResult (
106+ new FileOutputStream ("html/user/" + commandName + ".html" )));
138107 } catch (Exception e ) {
139- e .printStackTrace ( );
108+ e .printStackTrace ();
140109 }
141110 }
142111 }
0 commit comments