Author: DartPeng
Date: 2009-12-17 08:09:59 -0500 (Thu, 17 Dec 2009)
New Revision: 19418
Added:
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd
Modified:
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java
Log:
JBIDE-5205
write a test case
Modified:
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java 2009-12-17
13:05:07 UTC (rev 19417)
+++
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java 2009-12-17
13:09:59 UTC (rev 19418)
@@ -19,57 +19,64 @@
*/
package org.jboss.tools.smooks.templating.template.xml;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+
import junit.framework.TestCase;
+import org.eclipse.emf.common.util.URI;
import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.jboss.tools.smooks.templating.model.xml.XSDModelBuilder;
import org.jboss.tools.smooks.templating.template.Mapping;
import org.jboss.tools.smooks.templating.template.TemplateBuilder;
import org.jboss.tools.smooks.templating.template.TestUtil;
import org.jboss.tools.smooks.templating.template.exception.TemplateBuilderException;
import
org.jboss.tools.smooks.templating.template.exception.UnmappedCollectionNodeException;
-import org.jboss.tools.smooks.templating.template.xml.XMLFreeMarkerTemplateBuilder;
import org.milyn.util.FreeMarkerTemplate;
import org.milyn.xml.XmlUtil;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPathExpressionException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
*/
public class XMLFreeMarkerTemplateBuilderTest extends TestCase {
-
- public void test_SimplePerson_01() throws IOException, ParserConfigurationException,
TemplateBuilderException, SAXException, ModelBuilderException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
File("src/org/jboss/tools/smooks/templating/template/xml/simple-person.xsd"),
"person");
- String theTemplate = builder.buildTemplate();
- TestUtil.assertXMLEquals(theTemplate, "expected/simple-person-01.xml",
getClass());
+ public void test_SimplePerson_01() throws IOException, ParserConfigurationException,
TemplateBuilderException,
+ SAXException, ModelBuilderException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/simple-person.xsd"),
"person");
+ String theTemplate = builder.buildTemplate();
- // Now, test that we can parse the template ....
- XMLFreeMarkerTemplateBuilder builder2 = new
XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
- assertEquals(theTemplate, builder2.buildTemplate());
- }
-
- public void test_SimplePerson_02() throws IOException, ParserConfigurationException,
TemplateBuilderException, SAXException, ModelBuilderException, XPathExpressionException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
File("src/org/jboss/tools/smooks/templating/template/xml/simple-person.xsd"),
"person");
+ TestUtil.assertXMLEquals(theTemplate, "expected/simple-person-01.xml",
getClass());
- builder.addValueMapping("male",
builder.getModelNode("ns0:person/name/smk:compositor/male"));
- builder.addValueMapping("firstName",
builder.getModelNode("ns0:person/name/@first"));
- builder.addValueMapping("lastName",
builder.getModelNode("ns0:person/name/@last"));
- builder.addValueMapping("address",
builder.getModelNode("ns0:person/address"));
- builder.addValueMapping("age",
builder.getModelNode("ns0:person/age"));
-
- Map javaCtx = createPersonObj("Tom", "Fennelly",
"Ireland", 21);
+ // Now, test that we can parse the template ....
+ XMLFreeMarkerTemplateBuilder builder2 = new
XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
+ assertEquals(theTemplate, builder2.buildTemplate());
+ }
+
+ public void test_SimplePerson_02() throws IOException, ParserConfigurationException,
TemplateBuilderException,
+ SAXException, ModelBuilderException, XPathExpressionException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/simple-person.xsd"),
"person");
+
+ builder.addValueMapping("male",
builder.getModelNode("ns0:person/name/smk:compositor/male"));
+ builder.addValueMapping("firstName",
builder.getModelNode("ns0:person/name/@first"));
+ builder.addValueMapping("lastName",
builder.getModelNode("ns0:person/name/@last"));
+ builder.addValueMapping("address",
builder.getModelNode("ns0:person/address"));
+ builder.addValueMapping("age",
builder.getModelNode("ns0:person/age"));
+
+ Map javaCtx = createPersonObj("Tom", "Fennelly",
"Ireland", 21);
String template = builder.buildTemplate();
// System.out.println(template);
FreeMarkerTemplate freemarker = new FreeMarkerTemplate(template);
@@ -78,139 +85,184 @@
TestUtil.assertXMLEquals(templateRes, "expected/simple-person-02.xml",
getClass());
TestUtil.validate(builder, templateRes);
- // Now, test that we can parse the template and extract the mappings from it....
- XMLFreeMarkerTemplateBuilder builder2 = new
XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), template);
- assertEquals(5, builder2.getMappings().size());
- assertEquals(template, builder2.buildTemplate());
- }
-
- public void test_people_01() throws IOException, ParserConfigurationException,
TemplateBuilderException, SAXException, ModelBuilderException, XPathExpressionException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
File("src/org/jboss/tools/smooks/templating/template/xml/people.xsd"),
"people");
-
- // Try adding a value mapping before adding the collection mapping. Should get
an exception...
- try {
- builder.addValueMapping("personObj.firtName",
builder.getModelNode("ns0:people/person/name/@first"));
- fail("Expected UnmappedCollectionNodeException");
- } catch(UnmappedCollectionNodeException e) {
- assertEquals("Unmapped collection node 'person'.",
e.getMessage());
- }
- }
-
- public void test_people_02() throws IOException, ParserConfigurationException,
TemplateBuilderException, SAXException, ModelBuilderException, XPathExpressionException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
File("src/org/jboss/tools/smooks/templating/template/xml/people.xsd"),
"people");
-
- builder.addCollectionMapping("people", (Element)
builder.getModelNode("ns0:people/person"), "personObj");
- builder.addValueMapping("personObj.male",
builder.getModelNode("ns0:people/person/name/smk:compositor/male"));
- builder.addValueMapping("personObj.firstName",
builder.getModelNode("ns0:people/person/name/@first"));
- builder.addValueMapping("personObj.lastName",
builder.getModelNode("ns0:people/person/name/@last"));
- builder.addValueMapping("personObj.address",
builder.getModelNode("ns0:people/person/address"));
- builder.addValueMapping("personObj.age",
builder.getModelNode("ns0:people/person/age"));
-
- assertEquals(6, builder.getMappings().size());
-
- Map javaCtx = new HashMap();
- List people = new ArrayList();
- people.add(createPersonObj("Tom", "Fennelly",
"Ireland", 6));
- people.add(createPersonObj("Mike", "Fennelly",
"Ireland", 5));
- javaCtx.put("people", people);
-
- String template = builder.buildTemplate();
-
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ XMLFreeMarkerTemplateBuilder builder2 = new
XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), template);
+ assertEquals(5, builder2.getMappings().size());
+ assertEquals(template, builder2.buildTemplate());
+ }
+
+ public void test_people_01() throws IOException, ParserConfigurationException,
TemplateBuilderException,
+ SAXException, ModelBuilderException, XPathExpressionException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/people.xsd"),
"people");
+
+ // Try adding a value mapping before adding the collection mapping.
+ // Should get an exception...
+ try {
+ builder.addValueMapping("personObj.firtName",
builder.getModelNode("ns0:people/person/name/@first"));
+ fail("Expected UnmappedCollectionNodeException");
+ } catch (UnmappedCollectionNodeException e) {
+ assertEquals("Unmapped collection node 'person'.", e.getMessage());
+ }
+ }
+
+ public void test_people_02() throws IOException, ParserConfigurationException,
TemplateBuilderException,
+ SAXException, ModelBuilderException, XPathExpressionException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/people.xsd"),
"people");
+
+ builder.addCollectionMapping("people", (Element)
builder.getModelNode("ns0:people/person"), "personObj");
+ builder.addValueMapping("personObj.male",
builder.getModelNode("ns0:people/person/name/smk:compositor/male"));
+ builder.addValueMapping("personObj.firstName",
builder.getModelNode("ns0:people/person/name/@first"));
+ builder.addValueMapping("personObj.lastName",
builder.getModelNode("ns0:people/person/name/@last"));
+ builder.addValueMapping("personObj.address",
builder.getModelNode("ns0:people/person/address"));
+ builder.addValueMapping("personObj.age",
builder.getModelNode("ns0:people/person/age"));
+
+ assertEquals(6, builder.getMappings().size());
+
+ Map javaCtx = new HashMap();
+ List people = new ArrayList();
+ people.add(createPersonObj("Tom", "Fennelly", "Ireland",
6));
+ people.add(createPersonObj("Mike", "Fennelly", "Ireland",
5));
+ javaCtx.put("people", people);
+
+ String template = builder.buildTemplate();
+
FreeMarkerTemplate freemarker = new FreeMarkerTemplate(template);
String templateRes = freemarker.apply(javaCtx);
-
- TestUtil.assertXMLEquals(templateRes, "expected/people-01.xml",
getClass());
- // Now, test that we can parse the template and extract the mappings from it....
- XMLFreeMarkerTemplateBuilder builder2 = new
XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), template);
- assertEquals(6, builder2.getMappings().size());
- assertEquals(template, builder2.buildTemplate());
+ TestUtil.assertXMLEquals(templateRes, "expected/people-01.xml", getClass());
+
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ XMLFreeMarkerTemplateBuilder builder2 = new
XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), template);
+ assertEquals(6, builder2.getMappings().size());
+ assertEquals(template, builder2.buildTemplate());
+ }
+
+ public void test_elementname() throws IOException, ModelBuilderException{
+ File xsdFile = new
File("src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd");
+ URI uri = URI.createFileURI(xsdFile.getCanonicalFile().toString());
+ XSDModelBuilder builder = new XSDModelBuilder(uri);
+ builder.setRootElementName("smooks-resource-list");
+ XMLFreeMarkerTemplateBuilder templateBuilder = new
XMLFreeMarkerTemplateBuilder(builder);
+ Document document = templateBuilder.getModel();
+ checkNodeName(document.getDocumentElement());
}
-
- public void test_creature_01() throws IOException, ParserConfigurationException,
TemplateBuilderException, SAXException, ModelBuilderException, XPathExpressionException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
File("src/org/jboss/tools/smooks/templating/template/xml/creature.xsd"),
"creature");
+
+ private void checkNodeName(Node node){
+ assertNotNull(node.getNodeName());
+ System.out.println(node.getNodeName());
+ assertTrue(node.getNodeName().indexOf("null") == -1);
+ NodeList nodeList = node.getChildNodes();
+ int length = nodeList.getLength();
+ for (int i = 0; i < length; i++) {
+ checkNodeName(nodeList.item(i));
+ }
+ }
- Mapping mapping = builder.addValueMapping("dog",
builder.getModelNode("ns0:creature/smk:compositor/dog/@name"));
-
- // The mapping onto the <dog> node should result in the <person> and
<cat> nodes being hidden...
- assertEquals(2, mapping.getHideNodes().size());
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"),
mapping.getHideNodes().get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"),
mapping.getHideNodes().get(1));
-
- String theTemplate = builder.buildTemplate();
- TestUtil.assertXMLEquals(theTemplate, "expected/creature-01.xml",
getClass());
+ public void test_creature_01() throws IOException, ParserConfigurationException,
TemplateBuilderException,
+ SAXException, ModelBuilderException, XPathExpressionException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/creature.xsd"),
"creature");
+
+ Mapping mapping = builder.addValueMapping("dog",
builder.getModelNode("ns0:creature/smk:compositor/dog/@name"));
+
+ // The mapping onto the <dog> node should result in the <person> and
+ // <cat> nodes being hidden...
+ assertEquals(2, mapping.getHideNodes().size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"),
mapping.getHideNodes().get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"),
mapping.getHideNodes().get(1));
+
+ String theTemplate = builder.buildTemplate();
+ TestUtil.assertXMLEquals(theTemplate, "expected/creature-01.xml",
getClass());
TestUtil.validate(builder, theTemplate);
- // Now, test that we can parse the template and extract the mappings from it....
- XMLFreeMarkerTemplateBuilder builder2 = new
XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
- assertEquals(theTemplate, builder2.buildTemplate());
-
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ XMLFreeMarkerTemplateBuilder builder2 = new
XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
+ assertEquals(theTemplate, builder2.buildTemplate());
+
// ========================================================
-
- // Remove the <dog> mapping... should reshow the <person> and <cat>
nodes...
+
+ // Remove the <dog> mapping... should reshow the <person> and <cat>
+ // nodes...
List<Node> showNodes = builder.removeMapping(mapping);
- assertEquals(2, showNodes.size());
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"),
showNodes.get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"),
showNodes.get(1));
-
- mapping = builder.addValueMapping("cat",
builder.getModelNode("ns0:creature/smk:compositor/cat"));
-
- // The mapping onto the <cat> node should result in the <person> and
<dog> nodes being hidden...
- assertEquals(2, mapping.getHideNodes().size());
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"),
mapping.getHideNodes().get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"),
mapping.getHideNodes().get(1));
-
- theTemplate = builder.buildTemplate();
- TestUtil.assertXMLEquals(theTemplate, "expected/creature-02.xml",
getClass());
+ assertEquals(2, showNodes.size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"),
showNodes.get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"),
showNodes.get(1));
+
+ mapping = builder.addValueMapping("cat",
builder.getModelNode("ns0:creature/smk:compositor/cat"));
+
+ // The mapping onto the <cat> node should result in the <person> and
+ // <dog> nodes being hidden...
+ assertEquals(2, mapping.getHideNodes().size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"),
mapping.getHideNodes().get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"),
mapping.getHideNodes().get(1));
+
+ theTemplate = builder.buildTemplate();
+ TestUtil.assertXMLEquals(theTemplate, "expected/creature-02.xml",
getClass());
TestUtil.validate(builder, theTemplate);
- // Now, test that we can parse the template and extract the mappings from it....
- builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
- assertEquals(theTemplate, builder2.buildTemplate());
-
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
+ assertEquals(theTemplate, builder2.buildTemplate());
+
// ========================================================
-
- // Remove the <cat> mapping... should reshow the <person> and <dog>
nodes...
+
+ // Remove the <cat> mapping... should reshow the <person> and <dog>
+ // nodes...
showNodes = builder.removeMapping(mapping);
- assertEquals(2, showNodes.size());
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"),
showNodes.get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"),
showNodes.get(1));
-
- // Map the person... there are nested choice compositors on this one...
- mapping = builder.addValueMapping("male",
builder.getModelNode("ns0:creature/smk:compositor/person/name/smk:compositor/male"));
- builder.addValueMapping("firstName",
builder.getModelNode("ns0:creature/smk:compositor/person/name/@first"));
- builder.addValueMapping("lastName",
builder.getModelNode("ns0:creature/smk:compositor/person/name/@last"));
- builder.addValueMapping("address",
builder.getModelNode("ns0:creature/smk:compositor/person/address"));
- builder.addValueMapping("age",
builder.getModelNode("ns0:creature/smk:compositor/person/age"));
-
- // The mapping onto the <person> node should result in the <female>,
<dog> and <cat> nodes being hidden...
- assertEquals(3, mapping.getHideNodes().size());
-
assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person/name/smk:compositor/female"),
mapping.getHideNodes().get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"),
mapping.getHideNodes().get(1));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"),
mapping.getHideNodes().get(2));
-
- theTemplate = builder.buildTemplate();
- TestUtil.assertXMLEquals(theTemplate, "expected/creature-03.xml",
getClass());
+ assertEquals(2, showNodes.size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"),
showNodes.get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"),
showNodes.get(1));
- // Now, test that we can parse the template and extract the mappings from it....
- builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
- assertEquals(theTemplate, builder2.buildTemplate());
- }
+ // Map the person... there are nested choice compositors on this one...
+ mapping = builder.addValueMapping("male", builder
+ .getModelNode("ns0:creature/smk:compositor/person/name/smk:compositor/male"));
+ builder.addValueMapping("firstName",
builder.getModelNode("ns0:creature/smk:compositor/person/name/@first"));
+ builder.addValueMapping("lastName",
builder.getModelNode("ns0:creature/smk:compositor/person/name/@last"));
+ builder.addValueMapping("address",
builder.getModelNode("ns0:creature/smk:compositor/person/address"));
+ builder.addValueMapping("age",
builder.getModelNode("ns0:creature/smk:compositor/person/age"));
-// public void test_OrderStatusRequest() throws IOException,
ParserConfigurationException, ModelBuilderException, SAXException,
TemplateBuilderException {
-// TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
File("resources/xcbl40/schema/org/xcbl/path_delim/schemas/xcbl/v4_0/ordermanagement/v1_0/ordermanagement.xsd"),
"OrderStatusResult");
-// String theTemplate = builder.buildTemplate();
-//
-// TestUtil.assertXMLEquals(theTemplate, "expected/order-status-01.xml",
getClass());
-// }
+ // The mapping onto the <person> node should result in the <female>,
+ // <dog> and <cat> nodes being hidden...
+ assertEquals(3, mapping.getHideNodes().size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person/name/smk:compositor/female"),
mapping
+ .getHideNodes().get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"),
mapping.getHideNodes().get(1));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"),
mapping.getHideNodes().get(2));
- private Map createPersonObj(String first, String last, String address, int age) {
+ theTemplate = builder.buildTemplate();
+ TestUtil.assertXMLEquals(theTemplate, "expected/creature-03.xml",
getClass());
+
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
+ assertEquals(theTemplate, builder2.buildTemplate());
+ }
+
+ // public void test_OrderStatusRequest() throws IOException,
+ // ParserConfigurationException, ModelBuilderException, SAXException,
+ // TemplateBuilderException {
+ // TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
+ //
File("resources/xcbl40/schema/org/xcbl/path_delim/schemas/xcbl/v4_0/ordermanagement/v1_0/ordermanagement.xsd"),
+ // "OrderStatusResult");
+ // String theTemplate = builder.buildTemplate();
+ //
+ // TestUtil.assertXMLEquals(theTemplate, "expected/order-status-01.xml",
+ // getClass());
+ // }
+
+ private Map createPersonObj(String first, String last, String address, int age) {
Map javaCtx = new HashMap();
- javaCtx.put("male", true);
- javaCtx.put("firstName", first);
- javaCtx.put("lastName", last);
- javaCtx.put("address", address);
- javaCtx.put("age", age);
+ javaCtx.put("male", true);
+ javaCtx.put("firstName", first);
+ javaCtx.put("lastName", last);
+ javaCtx.put("address", address);
+ javaCtx.put("age", age);
return javaCtx;
}
Added:
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd 2009-12-17
13:09:59 UTC (rev 19418)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:smooks="http://www.milyn.org/xsd/smooks-1.0.xsd"
targetNamespace="http://www.milyn.org/xsd/smooks-1.0.xsd"
elementFormDefault="qualified">
+
+ <xs:element name="smooks-resource-list">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">List of Smooks Resource
Configuration.</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1"
ref="smooks:profiles"/>
+ <xs:element minOccurs="1" maxOccurs="unbounded"
ref="smooks:abstract-resource-config"/>
+ </xs:sequence>
+ <xs:attribute name="default-target-profile"
type="xs:string"/>
+ <xs:attribute name="default-selector"
type="xs:string"/>
+ <xs:attribute name="default-selector-namespace"
type="xs:anyURI"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="profiles">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">List of
Profiles</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded"
ref="smooks:profile"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="profile">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Profile Configuration.
Basically allows you to specify the name of a
+ base profile along with a list of its sub-profiles.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="base-profile"
type="xs:string" use="required"/>
+ <xs:attribute name="sub-profiles"
type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="abstract-resource-config"
abstract="true"/>
+ <xs:element name="abstract-resource-config"
type="smooks:abstract-resource-config" abstract="true"/>
+
+ <xs:element name="import"
substitutionGroup="smooks:abstract-resource-config">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="smooks:abstract-resource-config">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Smooks Resource
Configuration Import</xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="file" use="required"
type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="resource-config"
substitutionGroup="smooks:abstract-resource-config">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="smooks:abstract-resource-config">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Smooks Resource
Configuration</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1"
ref="smooks:resource"/>
+ <xs:element minOccurs="0" maxOccurs="1"
ref="smooks:condition"/>
+ <xs:element minOccurs="0"
maxOccurs="unbounded" ref="smooks:param"/>
+ </xs:sequence>
+ <xs:attribute name="selector"
type="xs:string"/>
+ <xs:attribute name="selector-namespace"
type="xs:anyURI"/>
+ <xs:attribute name="target-profile"
type="xs:string"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="resource">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Resource Configuration
Resource Type (xsl, class etc)</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:anyType">
+ <xs:attribute name="type"
type="xs:string"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="condition">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Resource Targetting
Condition</xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="evaluator"
type="xs:string"
default="org.milyn.javabean.expression.BeanMapExpressionEvaluator"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="param">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Resource
Parameter</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:anyType">
+ <xs:attribute name="name" type="xs:string"
use="required"/>
+ <xs:attribute name="type"
type="xs:string"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain