Skip to content

Instantly share code, notes, and snippets.

View zubairov's full-sized avatar

Renat Zubairov zubairov

View GitHub Profile
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:switchyard-config:switchyard:1.0"
xmlns:swyd="urn:switchyard-config:switchyard:1.0"
xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
elementFormDefault="qualified">
<import namespace="http://docs.oasis-open.org/ns/opencsa/sca/200912"
schemaLocation="sca-1.1-cd06.xsd"/>
<element name="switchyard" type="swyd:SwitchYardType"/>
@zubairov
zubairov / cuscar_d99a.xml
Created March 2, 2011 10:16
Example XML produced by parsing with namespace-aware D99A CUSCAR
<?xml version="1.0" encoding="UTF-8"?>
<env:unEdifact xmlns:env="urn:org.milyn.edi.unedifact.v41">
<env:UNB>
<env:syntaxIdentifier>
<env:id>UNOA</env:id>
<env:versionNum>2</env:versionNum>
</env:syntaxIdentifier>
<env:sender>
<env:id>SENDER</env:id>
</env:sender>
@zubairov
zubairov / EDIHandler.java
Created March 6, 2011 09:13
SAX Handler that writes out EDI
package org.milyn.edisax;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/*******************************************************************************
* Copyright (c) 2009, 2010 SOPERA GmbH
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
package org.sopera.ode.metadata.impl;
@zubairov
zubairov / LoadingIndicatorSample.js
Created March 15, 2011 10:10
Sample on how to implement loading indicator in Sproutcore application
SC.Request.manager.inflight.addObserver('[]', function(array) {
var length=array.get('length');
SC.debug('Number of inflight requets are %@', length);
// Need to run with the SC Event Loop to update the visuals
SC.run(new function() {
App.mainPage.getPath('mainPane.loading').set('isVisible', length > 0);
});
});
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:Q1="urn:org.milyn.edi.unedifact:un:d08a:common"
xmlns:cuscar="urn:org.milyn.edi.unedifact:un:d08a:cuscar" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:org.milyn.edi.unedifact:un:d08a:cuscar">
<xsd:import namespace="urn:org.milyn.edi.unedifact:un:d08a:common" />
<xsd:element name="CUSCAR" type="cuscar:CUSCAR" />
<xsd:complexType name="SegmentGroup14">
<xsd:annotation>
<xsd:appinfo source="smooks-mapping-data">Segment group 14:
CST-LOC-TMD-SG15-SG16
@zubairov
zubairov / common.xml
Created March 15, 2011 16:09
Common schema
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:common="urn:org.milyn.edi.unedifact:un:d03b:common"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:s="smooks-mapping-data"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="common"
ecore:package="common" targetNamespace="urn:org.milyn.edi.unedifact:un:d03b:common">
<xsd:complexType ecore:name="PackageType_C202" name="PackageType_C202"
s:documentation=" Type of package by name or by code from a specifiedsource."
s:maxLength="null" s:minLength="null" s:type="field">
<xsd:sequence>
<xsd:element ecore:name="packageTypeDescriptionCode"
@zubairov
zubairov / plugin.xml
Created March 15, 2011 16:19
sample plugin.xml to contribute schemas to Eclipse
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<extension point="org.eclipse.emf.ecore.dynamic_package">
</extension>
<extension point="org.eclipse.wst.xml.core.catalogContributions">
<catalogContribution>
<uri name="urn:org.milyn.edi.unedifact:un:d99a:iftcca" uri="org/milyn/edi/unedifact/d99a/iftcca.xsd" />
<uri name="urn:org.milyn.edi.unedifact:un:d99a:prpaid" uri="org/milyn/edi/unedifact/d99a/prpaid.xsd" />
<uri name="urn:org.milyn.edi.unedifact:un:d99a:proinq" uri="org/milyn/edi/unedifact/d99a/proinq.xsd" />
@zubairov
zubairov / tESBConsumer.xml
Created March 17, 2011 14:03
Descriptor for tESBConsumer
<COMPONENT>
<HEADER PLATEFORM="ALL"
SERIAL=""
VERSION="0.102"
STATUS="ALPHA"
COMPATIBILITY="ALL"
AUTHOR="Talend"
RELEASE_DATE="20050320A"
SCHEMA_AUTO_PROPAGATE="true"
STARTABLE="true"
@zubairov
zubairov / Validating.java
Created April 8, 2011 12:01
Lazy schema loading using Xerces API
private static void validate(String xml) {
String validationFeature = "http://xml.org/sax/features/validation";
String schemaFeature = "http://apache.org/xml/features/validation/schema";
try {
XML11Configuration config = new XML11Configuration();
config.setEntityResolver(new MyEntityManager());
XMLReader r = new SAXParser(config);
r.setFeature(validationFeature, true);
r.setFeature(schemaFeature, true);
r.parse(new InputSource(new StringReader(xml)));