Skip to content

Instantly share code, notes, and snippets.

Ant Kutschera maxant

Block or report user

Report or block maxant

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View read_xml_out_csv_model.json
"model": {
"input1.xml": {
"servlet1": {
"name1": "value1"
"servlet2": {
"name1": "value1",
"name2": "value2"
View read_xml_out_csv.ts
// npm install xml2js
// compile using "./node_modules/.bin/tsc read_xml_out_csv.ts -w"
// run using node read_xml_out_csv.js
const parseString: any = require('xml2js').parseString;
import * as fs from "fs";
const model = {}; // dictionary of dictionaries with filename -> servlet -> parameter name -> parameter value
const params = {}; // all params that are found (mapped to undefined)
const start =;
View read_xml_out_csv_example_output.csv
filename servlet name name1 name2
input1.xml servlet1 value1
input1.xml servlet2 value1 value2
input1.xml servlet3 value2
input2.xml servlet4 value4
View read_xml_out_csv_example_xml.xml
<?xml version="1.0"?>
<!-- 0..n servlets -->
<!-- 0..n name-value pairs -->
maxant / Main.scala
Last active Nov 6, 2017
Scala version of
View Main.scala
* built using Scala 2.12.4 in intellij
* prerequisites: add library for org.scala-lang.modules:scala-xml_2.12:1.0.6
package ch.maxant.readxmloutcsv
import{File, PrintWriter}
import scala.xml.XML
import java.lang.System.{currentTimeMillis => now}
# prerequisites:
# C:\temp>c:\Python27\Scripts\pip.exe install untangle
# run: C:\temp\read_xml_out_csv>c:\Python27\python.exe
import untangle
import os
import time
def now():
return time.time()*1000.0
@Resource UserTransaction ut;
protected void doGet(HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
CompletableFuture<String> cf = new CompletableFuture<>();, pw);
public class Service5 {
@Resource ManagedExecutorService mes;
@Resource EJBContext ctx;
@PersistenceContext(name="asdf") EntityManager em;
public void foo(CompletableFuture<String> cf, final PrintWriter pw) {
//type 1
Future<String> f =;
String s = f.get(); //blocks the thread, but at least others can run
//... do something useful with the string...
//type 2
Future<String> f =;
try {
public class Service2 {
public Future<String> foo(String s) {
// simulate some long running process
s += "<br>Service2: threadId=" + Thread.currentThread().getId();
return new AsyncResult<String>(s);
You can’t perform that action at this time.