Skip to content

Commit 128b51b

Browse files
committed
Update examples.
1 parent 9ed6384 commit 128b51b

File tree

4 files changed

+0
-122
lines changed

4 files changed

+0
-122
lines changed

kilo-test/src/test/java/org/httprpc/kilo/examples/Examples.java

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,10 @@
2626
import org.w3c.dom.Document;
2727
import org.xml.sax.SAXException;
2828

29-
import javax.xml.transform.Transformer;
30-
import javax.xml.transform.TransformerFactory;
31-
import javax.xml.transform.stream.StreamResult;
32-
import javax.xml.transform.stream.StreamSource;
3329
import java.io.IOException;
3430
import java.io.InputStreamReader;
3531
import java.net.URI;
3632
import java.nio.file.Files;
37-
import java.nio.file.Paths;
3833
import java.util.List;
3934
import java.util.Map;
4035
import java.util.MissingResourceException;
@@ -70,7 +65,6 @@ public static void main(String[] args) {
7065
execute("Resources", Examples::resources);
7166
execute("Includes", Examples::includes);
7267
execute("Comments", Examples::comments);
73-
execute("XML Transform", Examples::xmlTransform);
7468
}
7569

7670
private static void execute(String label, Example example) {
@@ -368,51 +362,4 @@ private static void templateExample(String name) throws IOException {
368362

369363
templateEncoder.write(dictionary, System.out);
370364
}
371-
372-
public static void xmlTransform() throws Exception {
373-
var t0 = System.currentTimeMillis();
374-
375-
transformXML1();
376-
377-
var t1 = System.currentTimeMillis();
378-
379-
System.out.printf("%s %dms\n", Transformer.class.getSimpleName(), (t1 - t0));
380-
381-
transformXML2();
382-
383-
var t2 = System.currentTimeMillis();
384-
385-
System.out.printf("%s %dms\n", TemplateEncoder.class.getSimpleName(), (t2 - t1));
386-
}
387-
388-
private static void transformXML1() throws Exception {
389-
var source = new StreamSource(Examples.class.getResourceAsStream("breakfast-menu.xslt"));
390-
391-
var transformer = TransformerFactory.newInstance().newTransformer(source);
392-
393-
var xmlSource = new StreamSource(Examples.class.getResourceAsStream("breakfast-menu.xml"));
394-
395-
var outputFile = Paths.get(System.getProperty("user.home"), "breakfast-menu-1.html");
396-
397-
try (var outputStream = Files.newOutputStream(outputFile)) {
398-
transformer.transform(xmlSource, new StreamResult(outputStream));
399-
}
400-
}
401-
402-
private static void transformXML2() throws Exception {
403-
var documentBuilder = ElementAdapter.newDocumentBuilder();
404-
405-
Document document;
406-
try (var inputStream = Examples.class.getResourceAsStream("breakfast-menu.xml")) {
407-
document = documentBuilder.parse(inputStream);
408-
}
409-
410-
var templateEncoder = new TemplateEncoder(Examples.class, "breakfast-menu.html");
411-
412-
var outputFile = Paths.get(System.getProperty("user.home"), "breakfast-menu-2.html");
413-
414-
try (var outputStream = Files.newOutputStream(outputFile)) {
415-
templateEncoder.write(new ElementAdapter(document.getDocumentElement()), outputStream);
416-
}
417-
}
418365
}

kilo-test/src/test/resources/org/httprpc/kilo/examples/breakfast-menu.html

Lines changed: 0 additions & 13 deletions
This file was deleted.

kilo-test/src/test/resources/org/httprpc/kilo/examples/breakfast-menu.xml

Lines changed: 0 additions & 38 deletions
This file was deleted.

kilo-test/src/test/resources/org/httprpc/kilo/examples/breakfast-menu.xslt

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)