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: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: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: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)));
@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:4016692
Created November 5, 2012 11:11
Validating against multiple XSD files using the classpath
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(getClass().getResourceAsStream("/path/to/schema1.xsd")),
new StreamSource(getClass().getResourceAsStream("/path/to/schema2.xsd"))
});
Validator validator = schema.newValidator();
validator.validate(new StreamSource(new File(path)));
@simonharrer
simonharrer / ReceiveReply.md
Created November 30, 2012 12:14
Oracle SOA Suite 11g - Deployment Archives and Scripts

Oracle SOA Suite 11g - Deployment Archives and Scripts

This article sheds some light on the question: "How to get a BPEL process packaged and deployed to the Oracle SOA Suite 11g automatically without any IDE?"

The BPEL process

The BPEL process has to be very simple as the task focus on packaging and deployment. I chose the ReceiveReply test from the betsy test suite which receives an integer and echos it back to the caller. Here is some pseudo code on how it works:

ReceiveReply: int -> int
import java.awt.Desktop;
Desktop.getDesktop().browse(new File("test.html").toURI());
@simonharrer
simonharrer / random_text_generator.rb
Last active April 5, 2022 22:25
Generate random text files
require "literate_randomizer"
require "fileutils"
$lr = LiterateRandomizer.create
FileUtils.rm_rf "data"
Dir.mkdir "data"
def generate(folder, level = 4)
return if level == 0
@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";