eol-style native
[openocd.git] / src / server / httpd / Stylizer.java
1 import java.io.File;
2 import java.io.FileOutputStream;
3 import java.io.IOException;
4 import java.io.OutputStream;
5
6 import javax.xml.parsers.DocumentBuilder;
7 import javax.xml.parsers.DocumentBuilderFactory;
8 import javax.xml.parsers.ParserConfigurationException;
9 import javax.xml.transform.Transformer;
10 import javax.xml.transform.TransformerConfigurationException;
11 import javax.xml.transform.TransformerException;
12 import javax.xml.transform.TransformerFactory;
13 import javax.xml.transform.dom.DOMSource;
14 import javax.xml.transform.stream.StreamResult;
15 import javax.xml.transform.stream.StreamSource;
16
17 import org.apache.xpath.XPathAPI;
18 import org.w3c.dom.Document;
19 import org.w3c.dom.Node;
20 import org.w3c.dom.NodeList;
21 import org.xml.sax.SAXException;
22
23 /** used to generate .tcl files from */
24 public class Stylizer
25 {
26 // Global value so it can be ref'd by the tree-adapter
27 static Document document;
28 public static void main(String argv[])
29 {
30 if (argv.length != 3)
31 {
32 System.err.println("Usage: java Stylizer stylesheet xmlfile outputdir");
33 System.exit(1);
34 }
35 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
36 try
37 {
38 System.err.println("Starting conversion...");
39
40 File stylesheet = new File(argv[0]);
41 File datafile = new File(argv[1]);
42 DocumentBuilder builder = factory.newDocumentBuilder();
43 document = builder.parse(datafile);
44
45 NodeList list = XPathAPI.selectNodeList(document, "website/language/page");
46
47 for (int i=0; i<list.getLength(); i++)
48 {
49 Node node=list.item(i);
50
51 // Use a Transformer for output
52 TransformerFactory tFactory = TransformerFactory.newInstance();
53 StreamSource stylesource = new StreamSource(stylesheet);
54 Transformer transformer = tFactory.newTransformer(stylesource);
55
56 Node fileName = XPathAPI.selectSingleNode(node, "outfile/text()");
57
58 System.err.println("Converting " + fileName.getNodeValue());
59 DOMSource source = new DOMSource(document);
60
61 OutputStream output=new FileOutputStream(new File(argv[2], fileName.getNodeValue()));
62
63
64 try
65 {
66 StreamResult result = new StreamResult(output);
67
68 transformer.setParameter("pagetogenerate", fileName.getNodeValue());
69 transformer.transform(source, result);
70 }
71 finally
72 {
73 output.close();
74 }
75 }
76 } catch (TransformerConfigurationException tce)
77 {
78 // Error generated by the parser
79 System.out.println("\n** Transformer Factory error");
80 System.out.println(" " + tce.getMessage());
81 // Use the contained exception, if any
82 Throwable x = tce;
83 if (tce.getException() != null)
84 x = tce.getException();
85 x.printStackTrace();
86 } catch (TransformerException te)
87 {
88 // Error generated by the parser
89 System.out.println("\n** Transformation error");
90 System.out.println(" " + te.getMessage());
91 // Use the contained exception, if any
92 Throwable x = te;
93 if (te.getException() != null)
94 x = te.getException();
95 x.printStackTrace();
96 } catch (SAXException sxe)
97 {
98 // Error generated by this application
99 // (or a parser-initialization error)
100 Exception x = sxe;
101 if (sxe.getException() != null)
102 x = sxe.getException();
103 x.printStackTrace();
104 } catch (ParserConfigurationException pce)
105 {
106 // Parser with specified options can't be built
107 pce.printStackTrace();
108 } catch (IOException ioe)
109 {
110 // I/O error
111 ioe.printStackTrace();
112 }
113 } // main
114 }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)