Package com.isomorphic.xml
Class XML
java.lang.Object
com.isomorphic.base.Base
com.isomorphic.xml.XML
- All Implemented Interfaces:
com.isomorphic.base.IAutoConfigurable
public class XML extends com.isomorphic.base.Base
Provides programmatic access to the SmartClient XML processor.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
recordToXML
(String tagName, Map record, DataSource ds, Writer out) Takes a Map and serializes it into XML based on the declarations in the DataSource similar to the client-side API Datasource.xmlSerialize().static void
recordToXML
(String tagName, Map record, Writer out) Takes a Map and serializes it into XML.static void
recordToXML
(String tagName, Map record, Writer out, boolean useAttributes, DSRequest dsRequest) Takes a Map and serializes it into XML based on the declarations in the DataSource similar to the client-side API Datasource.xmlSerialize().static void
recordToXML
(String tagName, Map record, Writer out, DSRequest dsRequest) Takes a Map and serializes it into XML.static ValidationContext
Converts XML read from the provided Reader to JavaScript and writes it to the supplied Writer.static ValidationContext
Converts an XML string to JavaScript and writes it to the supplied Writer.static ValidationContext
Converts an XML string to JavaScript, using the passed-in Locale to resolve any<fmt:message>
i18n tags, and writes it to the supplied Writer.static ValidationContext
Converts XML from the passed Element object to JavaScript and writes it to the supplied Writer.
-
Method Details
-
toJS
Converts an XML string to JavaScript and writes it to the supplied Writer.XML.toJS(String) and XML.toJS(Reader) use the XML->JS translation supported by JSTranslater.toJS(), including translation of XML to live SmartClient components. These are convenience methods that assume the inbound String or Reader contains XML.
- Parameters:
xml
- xml stringout
- writer where the generated JS output should be written- Throws:
Exception
- See Also:
-
toJS
Converts an XML string to JavaScript, using the passed-in Locale to resolve any<fmt:message>
i18n tags, and writes it to the supplied Writer.XML.toJS(String) and XML.toJS(Reader) use the XML->JS translation supported by JSTranslater.toJS(), including translation of XML to live SmartClient components. These are convenience methods that assume the inbound String or Reader contains XML.
- Parameters:
xml
- xml stringlocale
- Locale object to use for resolving i18n tags in the supplied XMLout
- writer where the generated JS output should be written- Throws:
Exception
- See Also:
-
toJS
Converts XML read from the provided Reader to JavaScript and writes it to the supplied Writer.- Parameters:
reader
- reader containing xmllocale
- Locale to use when resolving any i18n tags in the supplied XMLout
- writer where the generated JS output should be written- Throws:
Exception
-
toJS
Converts XML from the passed Element object to JavaScript and writes it to the supplied Writer.- Parameters:
element
- xml element to be convertedout
- writer where the generated JS output should be written- Throws:
Exception
-
recordToXML
Takes a Map and serializes it into XML. Each key/value pair becomes an XML attribute, and any value that is not an atomic type - such as a string, number or date - is output via a recursive call to this method.- Parameters:
tagName
- The XML tag to generaterecord
- The Map to render as XMLout
- Writer to output the XML to- Throws:
Exception
-
recordToXML
public static void recordToXML(String tagName, Map record, Writer out, DSRequest dsRequest) throws Exception Takes a Map and serializes it into XML. Each key/value pair becomes an XML attribute, and any value that is not an atomic type - such as a string, number or date - is output via a recursive call to this method.- Parameters:
tagName
- The XML tag to generaterecord
- The Map to render as XMLout
- Writer to output the XML todsRequest
- A DSRequest to use as context for the serialization. Pass as null if not appropriate- Throws:
Exception
-
recordToXML
public static void recordToXML(String tagName, Map record, DataSource ds, Writer out) throws Exception Takes a Map and serializes it into XML based on the declarations in the DataSource similar to the client-side API Datasource.xmlSerialize(). Each key/value pair becomes an XML attribute, and any value that is not an atomic type - such as a string, number or date - is output via a recursive call to this method.- Parameters:
tagName
- The XML tag to generaterecord
- The Map to render as XMLds
- DataSource to use as template for the serialization.out
- Writer to output the XML to- Throws:
Exception
-
recordToXML
public static void recordToXML(String tagName, Map record, Writer out, boolean useAttributes, DSRequest dsRequest) throws Exception Takes a Map and serializes it into XML based on the declarations in the DataSource similar to the client-side API Datasource.xmlSerialize(). Unlike the other recordToXML signatures, this one provides a way to control whether each key/value pair becomes an XML attribute (useAttributes=true) or an XML element (useAttributes=false). Behaves identically otherwise.- Parameters:
tagName
- The XML tag to generaterecord
- The Map to render as XMLout
- Writer to output the XML touseAttributes
- If true, output name/value pairs as XML attributes. XML elements otherwise.dsRequest
- A DSRequest to use as context for the serialization, if appropriate. Null values are permitted.- Throws:
Exception
-