Opening and Using XML Files in Mashups
You can construct variables in a mashup from XML content in files using the XMLConstructorFromFile macro. This macro is installed with the EMML Reference Runtime Engine and is available for use in any mashup script.
Deploying XML Source Files for Mashups
To use XML files as source data for mashup scripts, the file must be deployed in the EMML Engine classpath. Add your XML file to the web-apps-home/emml/WEB-INF/classes folder.
XML Character Encoding Support
The Mashup Server support for different character encodings in XML files is dependent on these factors:
The optional encoding attribute in the XML declaration (<?xml ?>) at the beginning of an XML file. If present, the value of this attribute identifies the character encoding that is used to read the file. Errors can occur if this value does not match the actual character encoding of the file or if the parser does not support this character encoding.
If this attribute is not specified, the XML parser may deduce the character encoding or may read the file assuming UTF-8 as the character encoding.
The character encodings supported by the JAXP-compliant parser in the JDK version deployed on the EMML Engine host. This typically is the Xerces parser shipped in the JDK. See your JDK documentation for specific information on parser character encoding support.
<macro:XMLConstructorFromFile>
Use the following attributes to define the input parameters for this macro and receive the results:
| Attribute | Required | Description |
|---|---|---|
filename |
yes |
The name of the XML file to open. This file must be deployed in the EMML Reference Runtime Engine. See also XML Character Encoding Support for more information. |
outputvariable |
yes |
The name of the document-type variable to receive the contents of this XML file. |
<macro:XMLConstructorFromFile> Examples
<mashup name="formatCSVBasic"
xmlns="http://www.openemml.org/2009-04-15/EMMLSchema"
xsi:schemaLocation="http://www.openemml.org/2009-04-15/EMMLSchema
../schema/EMMLSpec.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:macro="http://www.openemml.org/2009-04-15/EMMLMacro">
...
<variables>
<variable name="xmlConfigData" type="document"/>
</variables>
<macro:XMLConstructorFromFile
filename="myXMLDoc.xml"
outputvariable="$xmlConfigData"/>
...
Enterprise Mashup Markup Language (EMML) Documentation is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
