You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2007/12/23 16:07:54 UTC
svn commit: r606561 - in /incubator/cxf/trunk: parent/ rt/javascript/
rt/javascript/src/main/java/org/apache/cxf/javascript/
rt/javascript/src/main/java/org/apache/cxf/javascript/service/
rt/javascript/src/main/java/org/apache/cxf/javascript/types/ rt/...
Author: bimargulies
Date: Sun Dec 23 07:07:53 2007
New Revision: 606561
URL: http://svn.apache.org/viewvc?rev=606561&view=rev
Log:
more code for support of xs:any in javascript. Also fix to Rhino version consistenty.
Added:
incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AnyTest.java (with props)
incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AnyImpl.java (with props)
incubator/cxf/trunk/rt/javascript/src/test/resources/AnyBeans.xml (with props)
incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AnyTests.js (with props)
incubator/cxf/trunk/rt/javascript/src/test/resources/wsdl/hello_world_any.wsdl (with props)
Modified:
incubator/cxf/trunk/parent/pom.xml
incubator/cxf/trunk/rt/javascript/pom.xml
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
Modified: incubator/cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/parent/pom.xml?rev=606561&r1=606560&r2=606561&view=diff
==============================================================================
--- incubator/cxf/trunk/parent/pom.xml (original)
+++ incubator/cxf/trunk/parent/pom.xml Sun Dec 23 07:07:53 2007
@@ -56,7 +56,7 @@
<derby.version>10.2.2.0</derby.version>
<activemq.version>4.1.1</activemq.version>
<geronimo.version>1.1</geronimo.version>
- <rhino.version>1.6R5</rhino.version>
+ <rhino.version>1.6R7</rhino.version>
<xmlbeans.version>2.2.0</xmlbeans.version>
<spring.validation.mode>VALIDATION_AUTO</spring.validation.mode>
Modified: incubator/cxf/trunk/rt/javascript/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/pom.xml?rev=606561&r1=606560&r2=606561&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/pom.xml (original)
+++ incubator/cxf/trunk/rt/javascript/pom.xml Sun Dec 23 07:07:53 2007
@@ -142,7 +142,7 @@
<dependency>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
- <version>1.6R7</version>
+ <version>${rhino.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java?rev=606561&r1=606560&r2=606561&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java Sun Dec 23 07:07:53 2007
@@ -28,6 +28,7 @@
import javax.xml.namespace.QName;
import org.apache.cxf.common.xmlschema.SchemaCollection;
+import org.apache.cxf.javascript.types.SequenceItemInfo;
import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaSimpleType;
@@ -145,6 +146,12 @@
prefixStack.push(prefix() + " ");
}
+ public void startBlock() {
+ code.append(prefix());
+ code.append("{" + NL);
+ prefixStack.push(prefix() + " ");
+ }
+
public void appendElse() {
prefixStack.pop();
code.append(prefix());
@@ -164,6 +171,18 @@
prefixStack.push(prefix() + " ");
}
+ public void startForIn(String var, String collection) {
+ code.append(prefix());
+ code.append("for (var " + var + " in " + collection + ") {" + NL);
+ prefixStack.push(prefix() + " ");
+ }
+
+ public void startWhile(String test) {
+ code.append(prefix());
+ code.append("while (" + test + ") {" + NL);
+ prefixStack.push(prefix() + " ");
+ }
+
public void startDo() {
code.append(prefix());
code.append("do {" + NL);
@@ -191,6 +210,11 @@
return token;
}
+ /**
+ * Given an element, generate the serialization code.
+ * @param elementInfo
+ * @param schemaCollection
+ */
public void generateCodeToSerializeElement(ElementInfo elementInfo,
SchemaCollection schemaCollection) {
XmlSchemaType type = elementInfo.getType();
@@ -263,6 +287,76 @@
if (optional) {
endBlock();
}
+ }
+
+ /**
+ * Generate code to serialize an xs:any.
+ * There is too much duplicate code the element serializer; fix that some day.
+ * @param elementInfo
+ * @param schemaCollection
+ */
+ public void generateCodeToSerializeAny(SequenceItemInfo itemInfo,
+ String prefix,
+ SchemaCollection schemaCollection) {
+ boolean optional = XmlSchemaUtils.isParticleOptional(itemInfo.getParticle());
+ boolean array = XmlSchemaUtils.isParticleArray(itemInfo.getParticle());
+
+ appendLine("var anyHolder = this._" + itemInfo.getElementJavascriptVariable() + ";");
+ appendLine("var anySerializer = null;");
+ appendLine("var anyXmlTag = null;");
+ appendLine("var anyXmlNsDef = null;");
+ appendLine("var anyData = null;");
+ appendLine("var anyStartTag;");
+
+ startIf("anyHolder != null");
+ appendLine("anySerializer = "
+ + "cxfjsutils.interfaceObject.globalElementSerializers[anyHolder.qname];");
+ appendLine("anyXmlTag = '" + prefix + ":' + anyHolder.localName;");
+ appendLine("anyXmlNsDef = 'xmlns:" + prefix + "=' + anyHolder.namespaceURI;");
+ appendLine("anyStartTag = '<' + anyXmlTag + ' ' + anyXmlNsDef + '>';");
+ appendLine("anyEndTag = '</' + anyXmlTag + '>';");
+ appendLine("anyEmptyTag = '<' + anyXmlTag + ' ' + anyXmlNsDef + '/>';");
+ appendLine("anyData = anyHolder.object;");
+ endBlock();
+ // first question: optional?
+ if (optional) {
+ startIf("anyHolder != null && anyData != null");
+ } else {
+ startIf("anyHolder == null || anyData == null");
+ appendLine("throw 'null value for required any item';");
+ endBlock();
+ }
+
+ String varRef = "anyData";
+
+ if (array) {
+ startFor("var ax = 0", "ax < anyData.length", "ax ++");
+ varRef = "anyData[ax]";
+ // we need an extra level of 'nil' testing here. Or do we, depending on the type structure?
+ // Recode and fiddle appropriately.
+ startIf(varRef + " == null");
+ appendExpression("anyEmptyTag");
+ appendElse();
+ }
+
+ startIf("anySerializer"); // if no constructor, a simple type.
+ // it has a value
+ appendExpression("anySerializer(cxfjsutils, anyXmlTag)");
+ appendElse();
+ appendExpression("anyStartTag");
+ appendExpression("cxfjsutils.escapeXmlEntities(" + varRef + ")");
+ appendExpression("anyEndTag");
+ endBlock();
+ if (array) {
+ endBlock(); // for the nil/empty tag. Gorsh, we should have runtime knowledge of nillable
+ // on the elements.
+ endBlock(); // for the for loop.
+ }
+
+ if (optional) {
+ endBlock();
+ }
}
+
}
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=606561&r1=606560&r2=606561&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java Sun Dec 23 07:07:53 2007
@@ -22,6 +22,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -53,10 +54,12 @@
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.transport.local.LocalTransportFactory;
import org.apache.cxf.wsdl.WSDLConstants;
+import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaObject;
import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaObjectTable;
import org.apache.ws.commons.schema.XmlSchemaSequence;
import org.apache.ws.commons.schema.XmlSchemaSimpleType;
import org.apache.ws.commons.schema.XmlSchemaType;
@@ -137,6 +140,7 @@
code.append("function " + currentInterfaceClassName + " () {\n");
utils.appendLine("this.jsutils = new CxfApacheOrgUtil();");
+ utils.appendLine("this.jsutils.interfaceObject = this;");
utils.appendLine("this.synchronous = false;");
utils.appendLine("this.url = null;");
utils.appendLine("this.client = null;");
@@ -145,7 +149,40 @@
// thus, only one pending operation at a time.
utils.appendLine("this._onsuccess = null;");
utils.appendLine("this._onerror = null;");
+ generateGlobalElementDictionary();
code.append("}\n\n");
+ }
+
+ private void generateGlobalElementDictionary() {
+ // to handle 'any', we need a dictionary of all the global elements of all the schemas.
+ utils.appendLine("this.globalElementSerializers = [];");
+ utils.appendLine("this.globalElementDeserializers = [];");
+ for (XmlSchema schemaInfo : xmlSchemaCollection.getXmlSchemas()) {
+ XmlSchemaObjectTable globalElements = schemaInfo.getElements();
+ Iterator namesIterator = globalElements.getNames();
+ while (namesIterator.hasNext()) {
+ QName name = (QName)namesIterator.next();
+ XmlSchemaElement element = (XmlSchemaElement) globalElements.getItem(name);
+ // For now, at least, don't handle elements with simple types.
+ // That comes later to improve deserialization.
+ if (!(element.getSchemaType() instanceof XmlSchemaComplexType)) {
+ continue;
+ }
+ // If the element uses a named type, we use the functions for the type.
+ XmlSchemaComplexType elementType = (XmlSchemaComplexType)element.getSchemaType();
+ if (elementType.getQName() != null) {
+ name = elementType.getQName();
+ }
+ utils.appendLine("this.globalElementSerializers['" + name.toString() + "'] = "
+ + nameManager.getJavascriptName(name)
+ + "_serialize;");
+ utils.appendLine("this.globalElementDeserializers['" + name.toString() + "'] = "
+ + nameManager.getJavascriptName(name)
+ + "_deserialize;");
+ }
+
+ }
+
}
private String getFunctionGlobalName(QName itemName, String itemType) {
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties?rev=606561&r1=606560&r2=606561&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties Sun Dec 23 07:07:53 2007
@@ -18,6 +18,7 @@
# under the License.
#
#
+MULTIPLE_ANY= Multiple xs:any constructs in {0}.
ELEMENT_MISSING_TYPE= Root element {0} refers to undefined type {1} in {2}.
UNSUPPORTED_TYPE_CONSTRUCT= Unsupported schema construct {0}.
ELEMENT_DANGLING_REFERENCE= Element {0} refers to undefined element {1}.
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=606561&r1=606560&r2=606561&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java Sun Dec 23 07:07:53 2007
@@ -38,6 +38,7 @@
import org.apache.cxf.javascript.XmlSchemaUtils;
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaAny;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaObject;
@@ -47,36 +48,36 @@
import org.apache.ws.commons.schema.XmlSchemaType;
/**
- * Generate Javascript for a schema, and provide information needed for the service builder.
- * As of this pass, there is no support for non-sequence types or for attribute mappings.
+ * Generate Javascript for a schema, and provide information needed for the
+ * service builder. As of this pass, there is no support for non-sequence types
+ * or for attribute mappings.
+ *
* @author bimargulies
*/
public class SchemaJavascriptBuilder {
-
+
private static final Logger LOG = LogUtils.getL7dLogger(SchemaJavascriptBuilder.class);
-
+ private static int anyPrefixCounter;
private SchemaCollection xmlSchemaCollection;
private NameManager nameManager;
private NamespacePrefixAccumulator prefixAccumulator;
private SchemaInfo schemaInfo;
- private int anyCounter;
-
// In general, I (bimargulies) hate fields that are temporary communications
- // between members of a class. However, given the style restrictions on the number
+ // between members of a class. However, given the style restrictions on the
+ // number
// of parameters, it's the least of the evils.
private StringBuilder code;
private StringBuilder accessors;
private JavascriptUtils utils;
-
+
public SchemaJavascriptBuilder(SchemaCollection schemaCollection,
- NamespacePrefixAccumulator prefixAccumulator,
- NameManager nameManager) {
+ NamespacePrefixAccumulator prefixAccumulator, NameManager nameManager) {
this.xmlSchemaCollection = schemaCollection;
this.nameManager = nameManager;
this.prefixAccumulator = prefixAccumulator;
}
-
+
public String generateCodeForSchema(SchemaInfo schema) {
schemaInfo = schema;
code = new StringBuilder();
@@ -102,10 +103,11 @@
}
} catch (UnsupportedConstruct usc) {
LOG.warning(usc.toString());
- continue; // it could be empty, but the style checker would complain.
+ continue; // it could be empty, but the style checker
+ // would complain.
}
} else if (xmlSchemaObject instanceof XmlSchemaSimpleType) {
- XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) xmlSchemaObject;
+ XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)xmlSchemaObject;
if (XmlSchemaTools.isEumeration(simpleType)) {
List<String> values = XmlSchemaTools.enumeratorValues(simpleType);
code.append("//\n");
@@ -117,21 +119,23 @@
}
}
}
-
- // now add in global elements with anonymous types.
+
+ // now add in global elements with anonymous types.
schemaTypes = schema.getSchema().getElements();
namesIterator = schemaTypes.getNames();
while (namesIterator.hasNext()) {
QName name = (QName)namesIterator.next();
XmlSchemaObject xmlSchemaObject = (XmlSchemaObject)schemaTypes.getItem(name);
- if (xmlSchemaObject instanceof XmlSchemaElement) { // the alternative is too wierd to contemplate.
+ if (xmlSchemaObject instanceof XmlSchemaElement) { // the
+ // alternative
+ // is too wierd
+ // to
+ // contemplate.
try {
XmlSchemaElement element = (XmlSchemaElement)xmlSchemaObject;
if (element.getSchemaTypeName() == null && element.getSchemaType() == null) {
- Message message = new Message("ELEMENT_MISSING_TYPE", LOG,
- element.getQName(),
- element.getSchemaTypeName(),
- schema.getNamespaceURI());
+ Message message = new Message("ELEMENT_MISSING_TYPE", LOG, element.getQName(),
+ element.getSchemaTypeName(), schema.getNamespaceURI());
LOG.warning(message.toString());
continue;
}
@@ -141,45 +145,50 @@
} else {
type = schema.getSchema().getTypeByName(element.getSchemaTypeName());
}
- if (!(type instanceof XmlSchemaComplexType)) {
+ if (!(type instanceof XmlSchemaComplexType)) {
// we never make classes for simple type.
continue;
}
XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
- // for named types we don't bother to generate for the element.
+ // for named types we don't bother to generate for the
+ // element.
if (complexType.getName() == null) {
complexTypeConstructorAndAccessors(element.getQName(), complexType);
complexTypeSerializerFunction(element.getQName(), complexType);
- domDeserializerFunction(element.getQName(), complexType);
+ domDeserializerFunction(element.getQName(), complexType);
}
} catch (UnsupportedConstruct usc) {
- continue; // it could be empty, but the style checker would complain.
+ continue; // it could be empty, but the style checker
+ // would complain.
}
}
}
-
+
String returnValue = code.toString();
LOG.finer(returnValue);
return returnValue;
}
-
+
// In general, I (bimargulies) hate fields that are temporary communications
- // between members of a class. However, given the style restrictions on the number
+ // between members of a class. However, given the style restrictions on the
+ // number
// of parameters, it's the least of the evils.
-
+
public void complexTypeConstructorAndAccessors(QName name, XmlSchemaComplexType type) {
accessors = new StringBuilder();
utils = new JavascriptUtils(code);
XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(type);
-
+
final String elementPrefix = "this._";
-
+
String typeObjectName = nameManager.getJavascriptName(name);
code.append("//\n");
- code.append("// Constructor for XML Schema item " + name.toString() + "\n");
+ code.append("// Constructor for XML Schema item " + name.toString() + "\n");
code.append("//\n");
code.append("function " + typeObjectName + " () {\n");
+ // to assist in debugging we put a type property into every object.
+ utils.appendLine("this.typeMarker = '" + typeObjectName + "';");
for (int i = 0; i < sequence.getItems().getCount(); i++) {
XmlSchemaObject thing = sequence.getItems().getItem(i);
constructOneElement(type, sequence, elementPrefix, typeObjectName, thing);
@@ -188,110 +197,105 @@
code.append(accessors.toString());
}
- private void constructOneElement(XmlSchemaComplexType type,
- XmlSchemaSequence sequence,
+ private void constructOneElement(XmlSchemaComplexType type, XmlSchemaSequence sequence,
final String elementPrefix,
String typeObjectName,
XmlSchemaObject thing) {
-
+
SequenceItemInfo itemInfo = new SequenceItemInfo(xmlSchemaCollection, type, thing);
-
+
if (itemInfo.isAny()) {
- itemInfo.setElementJavascriptVariable(itemInfo.getElementJavascriptVariable()
- + anyCounter);
- anyCounter++;
+ itemInfo.setElementJavascriptVariable(itemInfo.getElementJavascriptVariable());
}
-
- itemInfo.setElementJavascriptVariable(elementPrefix
- + itemInfo.getElementJavascriptVariable());
+
+ itemInfo.setElementJavascriptVariable(elementPrefix + itemInfo.getElementJavascriptVariable());
String accessorSuffix = StringUtils.capitalize(itemInfo.getElementName());
String accessorName = typeObjectName + "_get" + accessorSuffix;
- String getFunctionProperty = typeObjectName + ".prototype.get" + accessorSuffix;
- String setFunctionProperty = typeObjectName + ".prototype.set" + accessorSuffix;
+ String getFunctionProperty = typeObjectName + ".prototype.get" + accessorSuffix;
+ String setFunctionProperty = typeObjectName + ".prototype.set" + accessorSuffix;
accessors.append("//\n");
accessors.append("// accessor is " + getFunctionProperty + "\n");
accessors.append("// element get for " + itemInfo.getElementName() + "\n");
if (itemInfo.isAny()) {
accessors.append("// - xs:any\n");
} else {
- // can we get an anonymous type on an element in the middle of a type?
- accessors.append("// - element type is "
- + itemInfo.getElementType().getQName() + "\n");
+ // can we get an anonymous type on an element in the middle of a
+ // type?
+ accessors.append("// - element type is " + itemInfo.getElementType().getQName() + "\n");
}
-
+
if (XmlSchemaUtils.isParticleOptional(itemInfo.getParticle())) {
accessors.append("// - optional element\n");
} else {
accessors.append("// - required element\n");
-
+
}
-
+
if (XmlSchemaUtils.isParticleArray(itemInfo.getParticle())) {
accessors.append("// - array\n");
-
+
}
-
+
if (itemInfo.isNillable()) {
accessors.append("// - nillable\n");
}
-
+
accessors.append("//\n");
accessors.append("// element set for " + itemInfo.getElementName() + "\n");
accessors.append("// setter function is is " + setFunctionProperty + "\n");
accessors.append("//\n");
- accessors.append("function " + accessorName + "() { return "
- + itemInfo.getElementJavascriptVariable()
- + ";}\n");
+ accessors.append("function " + accessorName + "() { return "
+ + itemInfo.getElementJavascriptVariable() + ";}\n");
accessors.append(getFunctionProperty + " = " + accessorName + ";\n");
accessorName = typeObjectName + "_set" + accessorSuffix;
- accessors.append("function "
- + accessorName + "(value) {"
- + itemInfo.getElementJavascriptVariable()
+ accessors.append("function " + accessorName + "(value) {" + itemInfo.getElementJavascriptVariable()
+ " = value;}\n");
accessors.append(setFunctionProperty + " = " + accessorName + ";\n");
-
- if (XmlSchemaUtils.isParticleOptional(itemInfo.getParticle())
+
+ if (XmlSchemaUtils.isParticleOptional(itemInfo.getParticle())
|| (itemInfo.isNillable() && !XmlSchemaUtils.isParticleArray(itemInfo.getParticle()))) {
utils.appendLine(itemInfo.getElementJavascriptVariable() + " = null;");
} else if (XmlSchemaUtils.isParticleArray(itemInfo.getParticle())) {
utils.appendLine(itemInfo.getElementJavascriptVariable() + " = [];");
- } else if (itemInfo.getElementType() instanceof XmlSchemaComplexType) {
- // even for required complex elements, we leave them null.
- // otherwise, we could end up in a cycle or otherwise miserable. The
+ } else if (itemInfo.isAny() || itemInfo.getElementType() instanceof XmlSchemaComplexType) {
+ // even for required complex elements, we leave them null.
+ // otherwise, we could end up in a cycle or otherwise miserable. The
// application code is responsible for this.
utils.appendLine(itemInfo.getElementJavascriptVariable() + " = null;");
} else {
if (itemInfo.getDefaultValueString() == null) {
itemInfo.setDefaultValueString(utils.getDefaultValueForSimpleType(itemInfo.getElementType()));
}
- utils.appendLine(itemInfo.getElementJavascriptVariable()
- + " = "
+ utils.appendLine(itemInfo.getElementJavascriptVariable() + " = "
+ itemInfo.getDefaultValueString() + ";");
}
}
-
-
/**
- * Produce a serializer function for a type.
- * These functions emit the surrounding element XML if the caller supplies an XML element name.
- * It's not quite as simple as that, though. The element name may need namespace qualification,
- * and this function will add more namespace prefixes as needed.
+ * Produce a serializer function for a type. These functions emit the
+ * surrounding element XML if the caller supplies an XML element name. It's
+ * not quite as simple as that, though. The element name may need namespace
+ * qualification, and this function will add more namespace prefixes as
+ * needed.
+ *
* @param type
* @return
*/
public void complexTypeSerializerFunction(QName name, XmlSchemaComplexType type) {
-
+
StringBuilder bodyCode = new StringBuilder();
JavascriptUtils bodyUtils = new JavascriptUtils(bodyCode);
bodyUtils.setXmlStringAccumulator("xml");
complexTypeSerializerBody(type, "this._", bodyUtils);
-
+
utils = new JavascriptUtils(code);
String functionName = nameManager.getJavascriptName(name) + "_" + "serialize";
+ code.append("//\n");
+ code.append("// Serialize " + name + "\n");
+ code.append("//\n");
code.append("function " + functionName + "(cxfjsutils, elementName) {\n");
utils.startXmlStringAccumulator("xml");
utils.startIf("elementName != null");
@@ -312,54 +316,62 @@
utils.appendString(">");
utils.endBlock();
utils.appendLine("return xml;");
- code.append("}\n");
- code.append(nameManager.getJavascriptName(name) + ".prototype.serialize = " + functionName + ";\n");
+ code.append("}\n\n");
+ code.append(nameManager.getJavascriptName(name) + ".prototype.serialize = " + functionName + ";\n\n");
}
-
/**
- * Build the serialization code for a complex type. At the top level, this operates on single items,
- * so it does not pay attention to minOccurs and maxOccurs. However, as it works through the sequence,
- * it manages optional elements and arrays.
+ * Build the serialization code for a complex type. At the top level, this
+ * operates on single items, so it does not pay attention to minOccurs and
+ * maxOccurs. However, as it works through the sequence, it manages optional
+ * elements and arrays.
+ *
* @param type
* @param elementPrefix
- * @param bodyNamespaceURIs
+ * @param bodyNamespaceURIs
* @return
*/
- protected void complexTypeSerializerBody(XmlSchemaComplexType type,
- String elementPrefix,
+ protected void complexTypeSerializerBody(XmlSchemaComplexType type, String elementPrefix,
JavascriptUtils bodyUtils) {
XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(type);
- // XML Schema, please meet Iterable (not).
for (int i = 0; i < sequence.getItems().getCount(); i++) {
- XmlSchemaElement sequenceElement = (XmlSchemaElement)sequence.getItems().getItem(i);
- if (sequenceElement.isAbstract()) {
- XmlSchemaUtils.unsupportedConstruct("ABSTRACT_ELEMENT", sequenceElement.getName(), type);
+ XmlSchemaObject sequenceItem = (XmlSchemaObject)sequence.getItems().getItem(i);
+ SequenceItemInfo itemInfo = new SequenceItemInfo(xmlSchemaCollection, type, sequenceItem);
+ // If the item is 'any', it could be ANY of our top-level elements.
+ if (itemInfo.isAny()) {
+ serializeAny(itemInfo, bodyUtils);
+ } else {
+ XmlSchemaElement sequenceElement = (XmlSchemaElement)sequenceItem;
+ ElementInfo elementInfo = ElementInfo.forLocalElement(sequenceElement, elementPrefix,
+ schemaInfo.getSchema(),
+ xmlSchemaCollection, prefixAccumulator);
+ elementInfo.setContainingType(type);
+ elementInfo.setUtilsVarName("cxfjsutils");
+ bodyUtils.generateCodeToSerializeElement(elementInfo, xmlSchemaCollection);
}
-
- ElementInfo elementInfo = ElementInfo.forLocalElement(sequenceElement,
- elementPrefix,
- schemaInfo.getSchema(),
- xmlSchemaCollection,
- prefixAccumulator);
- elementInfo.setContainingType(type);
- elementInfo.setUtilsVarName("cxfjsutils");
- bodyUtils.generateCodeToSerializeElement(elementInfo, xmlSchemaCollection);
}
}
- /**
- * Generate a JavaScript function that takes an element for a complex type and walks through
- * its children using them to fill in the values for a JavaScript object.
+ private void serializeAny(SequenceItemInfo itemInfo, JavascriptUtils bodyUtils) {
+ String prefix = "cxfjsany" + anyPrefixCounter;
+ anyPrefixCounter++;
+ bodyUtils.generateCodeToSerializeAny(itemInfo, prefix, xmlSchemaCollection);
+ }
+
+ /**
+ * Generate a JavaScript function that takes an element for a complex type
+ * and walks through its children using them to fill in the values for a
+ * JavaScript object.
+ *
* @param type schema type for the process
* @return the string contents of the JavaScript.
*/
public void domDeserializerFunction(QName name, XmlSchemaComplexType type) {
utils = new JavascriptUtils(code);
XmlSchemaSequence sequence = null;
-
+
sequence = XmlSchemaUtils.getSequence(type);
String typeObjectName = nameManager.getJavascriptName(name);
code.append("function " + typeObjectName + "_deserialize (cxfjsutils, element) {\n");
@@ -367,104 +379,230 @@
utils.appendLine("var newobject = new " + typeObjectName + "();");
utils.appendLine("cxfjsutils.trace('element: ' + cxfjsutils.traceElementName(element));");
utils.appendLine("var curElement = cxfjsutils.getFirstElementChild(element);");
-
+
utils.appendLine("var item;");
-
+
for (int i = 0; i < sequence.getItems().getCount(); i++) {
utils.appendLine("cxfjsutils.trace('curElement: ' + cxfjsutils.traceElementName(curElement));");
XmlSchemaObject thing = sequence.getItems().getItem(i);
- if (!(thing instanceof XmlSchemaElement)) {
- XmlSchemaUtils.unsupportedConstruct("NON_ELEMENT_CHILD",
- thing.getClass().getSimpleName(), type);
- }
-
- XmlSchemaElement sequenceElement = (XmlSchemaElement)thing;
- XmlSchemaElement realElement = XmlSchemaUtils.getReferredElement(sequenceElement,
- xmlSchemaCollection);
- boolean global = realElement != null;
- if (!global) {
- realElement = sequenceElement;
- }
- XmlSchemaType elType = XmlSchemaUtils.getElementType(xmlSchemaCollection,
- null, realElement, type);
- boolean simple = elType instanceof XmlSchemaSimpleType;
- String accessorName = "set" + StringUtils.capitalize(realElement.getName());
- String elementName = realElement.getName();
- utils.appendLine("cxfjsutils.trace('processing " + elementName + "');");
- String elementNamespaceURI = realElement.getQName().getNamespaceURI();
- boolean elementNoNamespace = "".equals(elementNamespaceURI);
- XmlSchema elementSchema = null;
- if (!elementNoNamespace) {
- elementSchema = xmlSchemaCollection.getSchemaByTargetNamespace(elementNamespaceURI);
- }
- boolean qualified = !elementNoNamespace
- && XmlSchemaUtils.isElementQualified(realElement,
- global,
- schemaInfo.getSchema(),
- elementSchema);
-
- if (!qualified) {
- elementNamespaceURI = "";
- }
-
- String valueTarget = "item";
-
- if (XmlSchemaUtils.isParticleOptional(sequenceElement)
- || XmlSchemaUtils.isParticleArray(sequenceElement)) {
- utils.startIf("curElement != null && cxfjsutils.isNodeNamedNS(curElement, '"
- + elementNamespaceURI
- + "', '"
- + elementName
- + "')");
- if (XmlSchemaUtils.isParticleArray(sequenceElement)) {
- utils.appendLine("item = [];");
- utils.startDo();
- valueTarget = "arrayItem";
- utils.appendLine("var arrayItem;");
+ SequenceItemInfo itemInfo = new SequenceItemInfo(xmlSchemaCollection, type, thing);
+ if (itemInfo.isAny()) {
+ SequenceItemInfo nextItem = null;
+ if (i != sequence.getItems().getCount() - 1) {
+ XmlSchemaObject nextThing = sequence.getItems().getItem(i + 1);
+ nextItem = new SequenceItemInfo(xmlSchemaCollection, type, nextThing);
+ // theoretically, you could have two anys with different
+ // namespaces.
+ if (nextItem.isAny()) {
+ unsupportedConstruct("MULTIPLE_ANY", type.getQName());
+ }
}
- }
-
- utils.appendLine("var value = null;");
- utils.startIf("!cxfjsutils.isElementNil(curElement)");
- if (simple) {
- utils.appendLine("value = cxfjsutils.getNodeText(curElement);");
- utils.appendLine(valueTarget
- + " = " + utils.javascriptParseExpression(elType, "value")
- + ";");
+ deserializeAny(type, itemInfo, nextItem);
} else {
- XmlSchemaComplexType complexType = (XmlSchemaComplexType)elType;
- QName baseQName = complexType.getQName();
- if (baseQName == null) {
- baseQName = realElement.getQName();
- }
-
- String elTypeJsName = nameManager.getJavascriptName(baseQName);
- utils.appendLine(valueTarget + " = "
- + elTypeJsName
- + "_deserialize(cxfjsutils, curElement);");
+ deserializeElement(type, thing);
}
-
- utils.endBlock(); // the if for the nil.
- if (XmlSchemaUtils.isParticleArray(sequenceElement)) {
- utils.appendLine("item.push(arrayItem);");
- utils.appendLine("curElement = cxfjsutils.getNextElementSibling(curElement);");
- utils.endBlock();
- utils.appendLine(" while(curElement != null && cxfjsutils.isNodeNamedNS(curElement, '"
- + elementNamespaceURI + "', '"
- + sequenceElement.getName() + "'));");
+ }
+ utils.appendLine("return newobject;");
+ code.append("}\n\n");
+ }
+
+ private String buildNamespaceList(String anyNamespaceSpec) {
+ StringBuilder nslist = new StringBuilder();
+ String[] namespaces = anyNamespaceSpec.split("\\s");
+ nslist.append("[ ");
+ for (int x = 0; x < namespaces.length; x++) {
+ String ns = namespaces[x];
+ nslist.append("'");
+ if ("##targetNamespace".equals(ns)) {
+ nslist.append(schemaInfo.getNamespaceURI());
+ } else if ("##local".equals(ns)) {
+ // nothing, empty string
+ } else {
+ nslist.append(ns);
}
- utils.appendLine("newobject." + accessorName + "(item);");
- if (!XmlSchemaUtils.isParticleArray(sequenceElement)) {
- utils.startIf("curElement != null");
- utils.appendLine("curElement = cxfjsutils.getNextElementSibling(curElement);");
- utils.endBlock();
+ nslist.append("'");
+ if (x < namespaces.length - 1) {
+ nslist.append(",");
}
- if (XmlSchemaUtils.isParticleOptional(sequenceElement)
- || XmlSchemaUtils.isParticleArray(sequenceElement)) {
- utils.endBlock();
+ }
+ nslist.append("]");
+ return nslist.toString();
+ }
+
+ private void deserializeAny(XmlSchemaComplexType type,
+ SequenceItemInfo itemInfo,
+ SequenceItemInfo nextItem) {
+ XmlSchemaAny any = (XmlSchemaAny)itemInfo.getParticle();
+
+ boolean array = XmlSchemaUtils.isParticleArray(any);
+ boolean optional = XmlSchemaUtils.isParticleOptional(any);
+
+ if (array) {
+ utils.appendLine("var anyObject = [];");
+ } else {
+ utils.appendLine("var anyObject = null;");
+
+ }
+
+ String anyNamespaceSpec = any.getNamespace();
+ // we aren't dealing with any-after-any.
+ XmlSchemaElement nextElement = (XmlSchemaElement)nextItem.getParticle();
+ String matchType;
+ String namespaceList = "[]";
+
+ if (anyNamespaceSpec == null
+ || "##any".equals(anyNamespaceSpec)
+ || "".equals(anyNamespaceSpec)) {
+ matchType = "org_apache_cxf_any_ns_matcher.ANY";
+ } else if ("##other".equals(anyNamespaceSpec)) {
+ matchType = "org_apache_cxf_any_ns_matcher.OTHER";
+ } else if ("##local".equals(anyNamespaceSpec)) {
+ matchType = "org_apache_cxf_any_ns_matcher.LOCAL";
+ } else {
+ matchType = "org_apache_cxf_any_ns_matcher.LISTED";
+ namespaceList = buildNamespaceList(anyNamespaceSpec);
+ }
+ utils.appendLine("var matcher = new org_apache_cxf_any_ns_matcher("
+ + matchType
+ + ", '" + schemaInfo.getNamespaceURI() + "'"
+ + ", " + namespaceList
+ + ", " + nextElement.getQName().getLocalPart()
+ + ");");
+
+ if (array) {
+ utils.appendLine("var anyNeeded = " + any.getMinOccurs() + ";");
+ utils.appendLine("var anyAllowed = " + any.getMaxOccurs() + ";");
+ } else if (optional) {
+ utils.appendLine("var anyNeeded = 0;");
+ utils.appendLine("var anyAllowed = 1;");
+ } else {
+ utils.appendLine("var anyNeeded = 1;");
+ utils.appendLine("var anyAllowed = 1;");
+ }
+
+ utils.startWhile("anyNeeded > 0 || anyAllowed > 0");
+
+ utils.appendLine("var anyURI;");
+ utils.appendLine("var anyLocalPart;");
+ utils.appendLine("var anyMatched = false;");
+ utils.startIf("curElement");
+
+ utils.appendLine("anyURI = cxfjsutils.getElementNamespaceURI(curElement);");
+ utils.appendLine("anyLocalPart = cxfjsutils.getNodeLocalName(curElement);");
+ utils.appendLine("anyMatched = matcher.match(anyURI, anyLocalPart)");
+ utils.endBlock(); // curElement != null
+
+ utils.startIf("anyMatched"); // if match
+ utils.appendLine("anyDeserializer = "
+ + "cxfjsutils.interfaceObject.globalElementDeserializers[anyURI];");
+ utils.startIf("anyDeserializer"); // if complex/serializer function
+ utils.appendLine("var anyValue = anyDeserializer(cxfjsutils, curElement);");
+ utils.appendElse(); // else complex/serializer function
+ // TODO: for simple types we really need a dictionary of the simple type qnames.
+ utils.appendLine("var anyValue = curElement.nodeValue;");
+ utils.endBlock(); // complex/serializer function
+
+ if (array) {
+ utils.appendLine("anyObject.push(anyValue);");
+ } else {
+ utils.appendLine("anyObject = anyValue;");
+ }
+
+ utils.appendLine("anyNeeded--;");
+ utils.appendLine("anyAllowed--;");
+ // if we consumed the element, we advance.
+ utils.appendLine("curElement = cxfjsutils.getNextElementSibling(curElement);");
+ utils.appendElse(); // match
+ // non-matching case
+ utils.startIf("anyNeeded > 0");
+ utils.appendLine("throw 'not enough ws:any elements';");
+ utils.endBlock(); // non-match+required
+ utils.endBlock(); // match/non-match.
+ utils.endBlock(); // while
+
+ utils.appendLine("var anyHolder = new org_apache_cxf_any_holder(anyURI, anyObject);");
+ utils.appendLine("this._" + itemInfo.getElementJavascriptVariable() + " = anyHolder;");
+ }
+
+ private void deserializeElement(XmlSchemaComplexType type, XmlSchemaObject thing) {
+ XmlSchemaElement sequenceElement = (XmlSchemaElement)thing;
+ XmlSchemaElement realElement = XmlSchemaUtils
+ .getReferredElement(sequenceElement, xmlSchemaCollection);
+ boolean global = realElement != null;
+ if (!global) {
+ realElement = sequenceElement;
+ }
+ XmlSchemaType elType = XmlSchemaUtils.getElementType(xmlSchemaCollection, null, realElement, type);
+ boolean simple = elType instanceof XmlSchemaSimpleType;
+ String accessorName = "set" + StringUtils.capitalize(realElement.getName());
+ String elementName = realElement.getName();
+ utils.appendLine("cxfjsutils.trace('processing " + elementName + "');");
+ String elementNamespaceURI = realElement.getQName().getNamespaceURI();
+ boolean elementNoNamespace = "".equals(elementNamespaceURI);
+ XmlSchema elementSchema = null;
+ if (!elementNoNamespace) {
+ elementSchema = xmlSchemaCollection.getSchemaByTargetNamespace(elementNamespaceURI);
+ }
+ boolean qualified = !elementNoNamespace
+ && XmlSchemaUtils.isElementQualified(realElement, global, schemaInfo.getSchema(),
+ elementSchema);
+
+ if (!qualified) {
+ elementNamespaceURI = "";
+ }
+
+ String valueTarget = "item";
+
+ if (XmlSchemaUtils.isParticleOptional(sequenceElement)
+ || XmlSchemaUtils.isParticleArray(sequenceElement)) {
+ utils.startIf("curElement != null && cxfjsutils.isNodeNamedNS(curElement, '"
+ + elementNamespaceURI + "', '" + elementName + "')");
+ if (XmlSchemaUtils.isParticleArray(sequenceElement)) {
+ utils.appendLine("item = [];");
+ utils.startDo();
+ valueTarget = "arrayItem";
+ utils.appendLine("var arrayItem;");
}
}
- utils.appendLine("return newobject;");
- code.append("}\n\n");
+
+ utils.appendLine("var value = null;");
+ utils.startIf("!cxfjsutils.isElementNil(curElement)");
+ if (simple) {
+ utils.appendLine("value = cxfjsutils.getNodeText(curElement);");
+ utils.appendLine(valueTarget + " = " + utils.javascriptParseExpression(elType, "value") + ";");
+ } else {
+ XmlSchemaComplexType complexType = (XmlSchemaComplexType)elType;
+ QName baseQName = complexType.getQName();
+ if (baseQName == null) {
+ baseQName = realElement.getQName();
+ }
+
+ String elTypeJsName = nameManager.getJavascriptName(baseQName);
+ utils.appendLine(valueTarget + " = " + elTypeJsName + "_deserialize(cxfjsutils, curElement);");
+ }
+
+ utils.endBlock(); // the if for the nil.
+ if (XmlSchemaUtils.isParticleArray(sequenceElement)) {
+ utils.appendLine("item.push(arrayItem);");
+ utils.appendLine("curElement = cxfjsutils.getNextElementSibling(curElement);");
+ utils.endBlock();
+ utils.appendLine(" while(curElement != null && cxfjsutils.isNodeNamedNS(curElement, '"
+ + elementNamespaceURI + "', '" + sequenceElement.getName() + "'));");
+ }
+ utils.appendLine("newobject." + accessorName + "(item);");
+ if (!XmlSchemaUtils.isParticleArray(sequenceElement)) {
+ utils.startIf("curElement != null");
+ utils.appendLine("curElement = cxfjsutils.getNextElementSibling(curElement);");
+ utils.endBlock();
+ }
+ if (XmlSchemaUtils.isParticleOptional(sequenceElement)
+ || XmlSchemaUtils.isParticleArray(sequenceElement)) {
+ utils.endBlock();
+ }
+ }
+
+ private void unsupportedConstruct(String messageKey, Object... args) {
+ Message message = new Message(messageKey, LOG, args);
+ throw new UnsupportedConstruct(message);
}
}
Modified: incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js?rev=606561&r1=606560&r2=606561&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js Sun Dec 23 07:07:53 2007
@@ -46,8 +46,121 @@
}
}
+
CxfApacheOrgUtil.prototype.getNodeLocalName = org_apache_cxf_getNodeLocalName;
+// compensate for lack of namespace support in IE.
+function org_apache_cxf_getNamespaceURI(elementNode, namespacePrefix)
+{
+ var namespaceURI = null;
+ if (elementNode.nodeType == 9)
+ return null;
+ else {
+ namespaceURI = org_apache_cxf_findNamespace (elementNode, namespacePrefix);
+ if (namespaceURI == null)
+ namespaceURI = org_apache_cxf_getNamespaceURI(elementNode.parentNode, namespacePrefix);
+ else
+ return namespaceURI;
+ }
+ return namespaceURI;
+ }
+
+
+function org_apache_cxf_findNamespace(elementNode, namespacePrefix)
+{
+ var attributes = elementNode.attributes;
+ if ((attributes!=null) && (attributes.length > 0)) {
+ for (var x=0; x<attributes.length; x++) {
+ var attributeNamespacePrefix = org_apache_cxf_getPrefix(attributes.item(x).nodeName);
+ var attributeNamespaceSuffix = org_apache_cxf_getLocalName(attributes.item(x).nodeName);
+
+ if ( (namespacePrefix == null) &&
+ (attributeNamespacePrefix == null) &&
+ (attributeNamespaceSuffix == "xmlns"))
+ return attributes.item(x).nodeValue;
+ else if ((attributeNamespacePrefix == "xmlns") &&
+ (attributeNamespaceSuffix == namespacePrefix))
+ return attributes.item(x).nodeValue;
+ }
+ return null;
+ }
+}
+
+function org_apache_cxf_get_node_namespaceURI(elementNode)
+{
+ var prefix = org_apache_cxf_get_prefix(elementNode.nodeName);
+ return org_apache_cxf_geNamespaceURI(elementNode, prefix);
+}
+
+CxfApacheOrgUtil.prototype.getElementNamespaceURI = org_apache_cxf_get_node_namespaceURI;
+
+function org_apache_cxf_any_ns_matcher(style, tns, nslist, nextLocalPart)
+{
+ this.style = style;
+ this.tns = tns;
+ this.nslist = nslist;
+ this.nextLocalPart = nextLocalPart;
+}
+
+org_apache_cxf_any_ns_matcher.ANY = "##any";
+org_apache_cxf_any_ns_matcher.OTHER = "##other";
+org_apache_cxf_any_ns_matcher.LOCAL = "##local";
+org_apache_cxf_any_ns_matcher.LISTED = "listed";
+
+function org_apache_cxf_any_ns_matcher_match(namespaceURI, localName)
+{
+ switch(style) {
+ // should this match local elements?
+ case org_apache_cxf_any_ns_matcher.ANY:
+ return true;
+ case org_apache_cxf_any_ns_matcher.OTHER:
+ return namespaceURI != this.tns;
+ case org_apache_cxf_any_ns_matcher.LOCAL:
+ return namespaceURI == null || namespaceURI == '';
+ case org_apache_cxf_any_ns_matcher.LISTED:
+ for(var x in this.nslist) {
+ var ns = this.nslist[x];
+ if(ns == "##local") {
+ if((namespaceURI == null || namespaceURI == '')
+ && (localName != this.nextLocalPart))
+ return true;
+ } else {
+ if(ns == namespaceURI)
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+org_apache_cxf_any_ns_matcher.prototype.match = org_apache_cxf_any_ns_matcher_match;
+
+
+
+
+
+
+function org_apache_cxf_getPrefix(tagName)
+{
+ var prefix;
+ var prefixIndex = tagName.indexOf(":");
+ if (prefixIndex == -1)
+ return null;
+ else
+ return prefix = tagName.substring(0, prefixIndex);
+}
+
+function org_apache_cxf_getLocalName(tagName)
+{
+ var suffix;
+ var prefixIndex = tagName.indexOf(":");
+
+ if (prefixIndex == -1)
+ return tagName;
+ else
+ return suffix = tagName.substring (prefixIndex+1, tagName.length);
+}
+
function org_apache_cxf_element_name_for_trace(node)
{
if(node == null)
@@ -290,3 +403,16 @@
}
CxfApacheOrgClient.prototype.onReadyState = org_apache_cxf_client_onReadyState;
+
+// Holder object used for xs:any
+// The QName of the element goes into 'qname'
+// The object to go with it goes into object.
+// If the Any is an array, put the array into the object slot.
+
+function org_apache_cxf_any_holder(qname, object) {
+ this.typeMarker = "org_apache_cxf_any_holder";
+ this.qname = qname;
+ this.object = object;
+ this.namespaceURI = this.qname.split(":", 1)[0];
+ this.localName = this.qname.split(":", 1)[1];
+}
Added: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AnyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AnyTest.java?rev=606561&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AnyTest.java (added)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AnyTest.java Sun Dec 23 07:07:53 2007
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.javascript;
+
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.javascript.fortest.AnyImpl;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.GenericApplicationContext;
+
+/*
+ * We end up here with a part with isElement == true, a non-array element,
+ * but a complex type for an array of the element.
+ */
+
+public class AnyTest extends JavascriptRhinoTest {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(AnyTest.class);
+
+ AnyImpl implementor;
+
+ public AnyTest() throws Exception {
+ super();
+ }
+
+ @Override
+ protected void additionalSpringConfiguration(GenericApplicationContext context) throws Exception {
+ }
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[] {"classpath:AnyBeans.xml"};
+ }
+
+ @Before
+ public void before() throws Exception {
+ setupRhino("any-proxy-factory",
+ "any-service-endpoint",
+ "/org/apache/cxf/javascript/AnyTests.js",
+ true);
+ implementor = (AnyImpl)endpoint.getImplementor();
+ implementor.reset();
+ }
+
+ @Test
+ public void testServerStartup() throws Exception {
+ LOG.fine("log something");
+ // no need to do anything, just see what happens on init!
+ }
+
+}
Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AnyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AnyTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AnyImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AnyImpl.java?rev=606561&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AnyImpl.java (added)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AnyImpl.java Sun Dec 23 07:07:53 2007
@@ -0,0 +1,176 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.javascript.fortest;
+
+import java.util.Arrays;
+
+import uri.cxf_apache_org.jstest.any.AcceptAny;
+import uri.cxf_apache_org.jstest.types.any.AcceptAny1;
+import uri.cxf_apache_org.jstest.types.any.AcceptAnyN;
+import uri.cxf_apache_org.jstest.types.any.AcceptAnyOptional;
+import uri.cxf_apache_org.jstest.types.any.Alternative1;
+import uri.cxf_apache_org.jstest.types.any.Alternative2;
+import uri.cxf_apache_org.jstest.types.any.ReturnAny1;
+import uri.cxf_apache_org.jstest.types.any.ReturnAnyN;
+import uri.cxf_apache_org.jstest.types.any.ReturnAnyOptional;
+
+/**
+ *
+ */
+public class AnyImpl implements AcceptAny {
+
+ private Object any1value;
+ private Object[] anyNvalue;
+ private Object anyOptionalValue;
+ private String before;
+ private String after;
+ /**
+ *
+ */
+ private boolean returnOptional;
+
+ public void reset() {
+ any1value = null;
+ anyNvalue = null;
+ anyOptionalValue = null;
+ before = null;
+ after = null;
+ }
+
+ /**
+ * *
+ *
+ * @return Returns the any1value.
+ */
+ public Object getAny1value() {
+ return any1value;
+ }
+
+ /**
+ * *
+ *
+ * @return Returns the anyNvalue.
+ */
+ public Object[] getAnyNvalue() {
+ return anyNvalue;
+ }
+
+ /**
+ * *
+ *
+ * @return Returns the anyOptionalValue.
+ */
+ public Object getAnyOptionalValue() {
+ return anyOptionalValue;
+ }
+
+ /**
+ * *
+ *
+ * @return Returns the before.
+ */
+ public String getBefore() {
+ return before;
+ }
+
+ /**
+ * *
+ *
+ * @return Returns the after.
+ */
+ public String getAfter() {
+ return after;
+ }
+
+ /** * @return Returns the returnOptional.
+ */
+ public boolean isReturnOptional() {
+ return returnOptional;
+ }
+
+ /**
+ * @param returnOptional The returnOptional to set.
+ */
+ public void setReturnOptional(boolean returnOptional) {
+ this.returnOptional = returnOptional;
+ }
+
+ public void acceptAny1(AcceptAny1 in) {
+ before = in.getBefore();
+ after = in.getAfter();
+ any1value = in.getAny();
+ }
+
+ public void acceptAnyN(AcceptAnyN in) {
+ before = in.getBefore();
+ after = in.getAfter();
+ anyNvalue = in.getAny().toArray();
+ }
+
+ public void acceptAnyOptional(AcceptAnyOptional in) {
+ before = in.getBefore();
+ after = in.getAfter();
+ anyOptionalValue = in.getAny();
+ }
+
+ public AcceptAny1 returnAny1(ReturnAny1 in) {
+ AcceptAny1 r = new AcceptAny1();
+ r.setBefore("1before");
+ Alternative1 a1 = new Alternative1();
+ a1.setChalk("dover");
+ r.setAny(a1);
+ r.setAfter("1after");
+ return r;
+ }
+
+ public AcceptAnyN returnAnyN(ReturnAnyN in) {
+ AcceptAnyN r = new AcceptAnyN();
+ r.setBefore("Nbefore");
+ r.setAfter("Nafter");
+ Object[] objects = new Object[4];
+ Alternative1 a1 = new Alternative1();
+ a1.setChalk("blackboard");
+ objects[0] = a1;
+ objects[1] = null;
+ Alternative2 a2 = new Alternative2();
+ a2.setCheese(42);
+ objects[2] = a2;
+ a1 = new Alternative1();
+ a1.setChalk("sidewalk");
+ objects[3] = a1;
+ r.getAny().addAll(Arrays.asList(objects));
+ return r;
+ }
+
+ public AcceptAnyOptional returnAnyOptional(ReturnAnyOptional in) {
+ AcceptAnyOptional r = new AcceptAnyOptional();
+ r.setBefore("opBefore");
+ r.setAfter("opAfter");
+ if (returnOptional) {
+ Alternative2 a2 = new Alternative2();
+ a2.setCheese(24);
+ r.setAny(a2);
+ } else {
+ r.setAny(null);
+ }
+ return r;
+ }
+}
+
Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AnyImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AnyImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/rt/javascript/src/test/resources/AnyBeans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/AnyBeans.xml?rev=606561&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/AnyBeans.xml (added)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/AnyBeans.xml Sun Dec 23 07:07:53 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xsi:schemaLocation="
+ http://cxf.apache.org/jaxws
+ http://cxf.apache.org/schemas/jaxws.xsd
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+
+ <jaxws:endpoint id="any-service-endpoint"
+ implementor="org.apache.cxf.javascript.fortest.AnyImpl"
+ address="http://localhost:8808/any" >
+ </jaxws:endpoint>
+
+ <bean id="any-proxy-factory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean" >
+ <property name="serviceClass" value="org.apache.cxf.javascript.fortest.AnyImpl"/>
+ <property name="address" value="http://localhost:8808/any"/>
+ </bean>
+
+ </beans>
\ No newline at end of file
Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/AnyBeans.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/AnyBeans.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/AnyBeans.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties?rev=606561&r1=606560&r2=606561&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties (original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties Sun Dec 23 07:07:53 2007
@@ -20,8 +20,8 @@
#
# logging for the javascript tests
handlers= java.util.logging.ConsoleHandler
-.level= FINE
-java.util.logging.ConsoleHandler.level = FINE
+.level= INFO
+java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
org.apache.cxf.javascript.JavascriptTestUtilities.level=FINEST
Added: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AnyTests.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AnyTests.js?rev=606561&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AnyTests.js (added)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AnyTests.js Sun Dec 23 07:07:53 2007
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+function assertionFailed(explanation)
+{
+ var assert = new Assert(explanation); // this will throw out in Java.
+}
+
+var globalNotifier = null;
+var globalErrorStatus = null;
+var globalErrorStatusText = null;
+var globalResponseObject = null;
+
+function resetGlobals() {
+ globalNotifier = null;
+ globalErrorStatus = null;
+ globalErrorStatusText = null;
+ globalResponseObject = null;
+}
+
+// nothing yet.
Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AnyTests.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/cxf/trunk/rt/javascript/src/test/resources/wsdl/hello_world_any.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/wsdl/hello_world_any.wsdl?rev=606561&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/wsdl/hello_world_any.wsdl (added)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/wsdl/hello_world_any.wsdl Sun Dec 23 07:07:53 2007
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<wsdl:definitions name="HelloWorld"
+ targetNamespace="uri:cxf.apache.org:jstest:any"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="uri:cxf.apache.org:jstest:any"
+ xmlns:x1="uri:cxf.apache.org:jstest:types:any"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema targetNamespace="uri:cxf.apache.org:jstest:types:any"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="uri:cxf.apache.org:jstest:types:any"
+ elementFormDefault="qualified">
+
+ <simpleType name="MyStringType">
+ <restriction base="string">
+ <maxLength value="30" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="alternative1">
+ <sequence>
+ <element name="chalk" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="alternative2">
+ <sequence>
+ <element name="cheese" type="int" />
+ </sequence>
+ </complexType>
+
+ <element name="acceptAny1">
+ <complexType>
+ <sequence>
+ <element name='before' type='string' />
+ <any minOccurs='1' />
+ <element name='after' type='string' />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="acceptAnyN">
+ <complexType>
+ <sequence>
+ <element name='before' type='string' />
+ <any minOccurs='1' maxOccurs='10' />
+ <element name='after' type='string' />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="acceptAnyOptional">
+ <complexType>
+ <sequence>
+ <element name='before' type='string' />
+ <any minOccurs='0' maxOccurs='1' />
+ <element name='after' type='string' />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name='returnAny1'>
+ <complexType/>
+ </element>
+
+ <element name='returnAnyN'>
+ <complexType/>
+ </element>
+
+ <element name='returnAnyOptional'>
+ <complexType/>
+ </element>
+
+ </schema>
+
+ </wsdl:types>
+
+ <wsdl:message name="acceptAny1">
+ <wsdl:part name="in" element="x1:acceptAny1" />
+ </wsdl:message>
+
+ <wsdl:message name="acceptAnyN">
+ <wsdl:part name="in" element="x1:acceptAnyN" />
+ </wsdl:message>
+
+ <wsdl:message name="acceptAnyOptional">
+ <wsdl:part name="in" element="x1:acceptAnyOptional" />
+ </wsdl:message>
+
+ <wsdl:message name="returnAny1">
+ <wsdl:part name="in" element="x1:returnAny1" />
+ </wsdl:message>
+
+ <wsdl:message name="returnAny1Response">
+ <wsdl:part name="out" element="x1:acceptAny1" />
+ </wsdl:message>
+
+ <wsdl:message name="returnAnyN">
+ <wsdl:part name="in" element="x1:returnAnyN" />
+ </wsdl:message>
+
+ <wsdl:message name="returnAnyNResponse">
+ <wsdl:part name="out" element="x1:acceptAnyN" />
+ </wsdl:message>
+
+ <wsdl:message name="returnAnyOptional">
+ <wsdl:part name="in" element="x1:returnAnyOptional" />
+ </wsdl:message>
+
+ <wsdl:message name="returnAnyOptionalResponse">
+ <wsdl:part name="out" element="x1:acceptAnyOptional" />
+ </wsdl:message>
+
+ <wsdl:portType name="AcceptAny">
+ <wsdl:operation name="acceptAny1">
+ <wsdl:input name="acceptAny1" message="tns:acceptAny1" />
+ </wsdl:operation>
+
+ <wsdl:operation name="acceptAnyN">
+ <wsdl:input name="acceptAnyN" message="tns:acceptAnyN" />
+ </wsdl:operation>
+
+ <wsdl:operation name="acceptAnyOptional">
+ <wsdl:input name="acceptAnyOptional"
+ message="tns:acceptAnyOptional" />
+ </wsdl:operation>
+
+ <wsdl:operation name="returnAny1">
+ <wsdl:input name="returnAny1" message="tns:returnAny1" />
+ <wsdl:output name="returnAny1Response" message="tns:returnAny1Response" />
+ </wsdl:operation>
+
+ <wsdl:operation name="returnAnyN">
+ <wsdl:input name="returnAnyN" message="tns:returnAnyN" />
+ <wsdl:output name="returnAnyNResponse" message="tns:returnAnyNResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="returnAnyOptional">
+ <wsdl:input name="returnAnyOptional" message="tns:returnAnyOptional" />
+ <wsdl:output name="returnAnyOptionalResponse" message="tns:returnAnyOptionalResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+ <wsdl:binding name="AcceptAny" type="tns:AcceptAny">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="acceptAny1">
+ <soap:operation style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ </wsdl:operation>
+ <wsdl:operation name="acceptAnyN">
+ <soap:operation style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ </wsdl:operation>
+ <wsdl:operation name="acceptAnyOptional">
+ <soap:operation style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ </wsdl:operation>
+
+ <wsdl:operation name="returnAny1">
+ <soap:operation style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="returnAnyN">
+ <soap:operation style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="returnAnyOptional">
+ <soap:operation style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AcceptAnyService">
+ <wsdl:port binding="tns:AcceptAny" name="AcceptAny">
+ <soap:address location="http://localhost:9000/anyTests" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+
Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/wsdl/hello_world_any.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/wsdl/hello_world_any.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/wsdl/hello_world_any.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml