Skip to content

Instantly share code, notes, and snippets.

View simonharrer's full-sized avatar
🏠
Mob Programming from my Home Office

Dr. Simon Harrer simonharrer

🏠
Mob Programming from my Home Office
View GitHub Profile
@simonharrer
simonharrer / gist:3163807
Created July 23, 2012 14:10
Array to latex itemize items.
["array","of","elems"].sort().each {
elem -> println "\\item \\tr{" + elem + "}"
}
@simonharrer
simonharrer / gist:3878494
Created October 12, 2012 10:01
comparing xml files with xmllint and diff for specific use case
# requires xmllint and diff to be in the PATH
class Test
BPELVAL_DIR = "c:/projects/bpelval-proj/tool/Testcases"
BETSY_DIR = "c:/projects/betsy/src/main/tests/language-features"
def self.compute_wsdl_diffs
main_wsdl = "#{BETSY_DIR}/TestInterface.wsdl"
partner_wsdl = "#{BETSY_DIR}/TestPartner.wsdl"
@simonharrer
simonharrer / gist:4016489
Created November 5, 2012 10:21
Validating XSD files
String path = "my/test/path/to/file.xsd";
SchemaFactory sFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
sFactory.newSchema(new File(path));
@simonharrer
simonharrer / gist:4016676
Created November 5, 2012 11:08
Validating against multiple XSD files
String path = "my/test/path/to/file.xml";
SchemaFactory sFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sFactory.newSchema(new Source[]{
new StreamSource(new File("/path/to/schema1.xsd")),
new StreamSource(new File("/path/to/schema2.xsd"))
});
Validator validator = schema.newValidator();
validator.validate(new StreamSource(new File(path)));
@simonharrer
simonharrer / gist:4016482
Created November 5, 2012 10:20
Validating XML Well-Formedness
String path = "my/test/path/to/file.xml";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
db.parse(new File(path));
@simonharrer
simonharrer / gist:4016661
Created November 5, 2012 11:06
Validating against a XSD file
String path = "my/test/path/to/file.xml";
SchemaFactory sFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sFactory.newSchema(new File("path/to/schema.xsd"));
Validator validator = schema.newValidator();
validator.validate(new StreamSource(new File(path)));
import java.awt.Desktop;
Desktop.getDesktop().browse(new File("test.html").toURI());
@simonharrer
simonharrer / bpel-dependencies.dot
Created January 21, 2013 11:36
dependent standards of the BPEL standard
digraph g{
//nodes
wsdl[label="WSDL 1.1"]
xsd[label="XML Schema 1.0"]
xpath[label="XPath 1.0"]
xslt[label="XSLT 1.0"]
infoset[label="InfoSet"]
// edges
wsdl -> bpel
@simonharrer
simonharrer / codepuzzler.java
Last active December 11, 2015 21:49
Code Puzzler - Different Behaviour in Java and Groovy
package betsy;
public class CodePuzzler {
public static void main(String[] args) {
// init array
String[] array = new String[2];
array[0] = "One";
array[1] = "Two";
@simonharrer
simonharrer / Person.java
Created April 12, 2013 10:11
Simple example for JAXB
import javax.xml.bind.JAXB;
import javax.xml.bind.JAXBException;
public class Person {
private String name;
private int age;
public String getName() {
return name;