com.isomorphic.xml

## Class XML

- java.lang.Object
- - com.isomorphic.base.Base
  - - com.isomorphic.xml.XML

-     public class XML
      extends Base

  Provides programmatic access to the SmartClient XML processor.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `recordToXML(java.lang.String tagName, java.util.Map record, DataSource ds, java.io.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(java.lang.String tagName, java.util.Map record, java.io.Writer out)` Takes a Map and serializes it into XML.
    `static void` | `recordToXML(java.lang.String tagName, java.util.Map record, java.io.Writer out, DSRequest dsRequest)` Takes a Map and serializes it into XML.
    `static ValidationContext` | `toJS(org.w3c.dom.Element element, java.io.Writer out)` Converts XML from the passed Element object to JavaScript and writes it to the supplied Writer.
    `static ValidationContext` | `toJS(java.io.Reader reader, java.util.Locale locale, java.io.Writer out)` Converts XML read from the provided Reader to JavaScript and writes it to the supplied Writer.
    `static ValidationContext` | `toJS(java.lang.String xml, java.util.Locale locale, java.io.Writer out)` 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` | `toJS(java.lang.String xml, java.io.Writer out)` Converts an XML string to JavaScript and writes it to the supplied Writer.

- - ### Method Detail

    - #### toJS

          public static ValidationContext toJS(java.lang.String xml,
                                               java.io.Writer out)
                                        throws java.lang.Exception

      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 string
        `out` - writer where the generated JS output should be written
      Throws:
        `java.lang.Exception`
      See Also:
        `JSTranslater.toJS(Object, Writer)`

    - #### toJS

          public static ValidationContext toJS(java.lang.String xml,
                                               java.util.Locale locale,
                                               java.io.Writer out)
                                        throws java.lang.Exception

      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 string
        `locale` - Locale object to use for resolving i18n tags in the supplied XML
        `out` - writer where the generated JS output should be written
      Throws:
        `java.lang.Exception`
      See Also:
        `JSTranslater.toJS(Object, Writer)`

    - #### toJS

          public static ValidationContext toJS(java.io.Reader reader,
                                               java.util.Locale locale,
                                               java.io.Writer out)
                                        throws java.lang.Exception

      Converts XML read from the provided Reader to JavaScript and writes it to the supplied Writer.
      Parameters:
        `reader` - reader containing xml
        `locale` - Locale to use when resolving any i18n tags in the supplied XML
        `out` - writer where the generated JS output should be written
      Throws:
        `java.lang.Exception`

    - #### toJS

          public static ValidationContext toJS(org.w3c.dom.Element element,
                                               java.io.Writer out)
                                        throws java.lang.Exception

      Converts XML from the passed Element object to JavaScript and writes it to the supplied Writer.
      Parameters:
        `element` - xml element to be converted
        `out` - writer where the generated JS output should be written
      Throws:
        `java.lang.Exception`

    - #### recordToXML

          public static void recordToXML(java.lang.String tagName,
                                         java.util.Map record,
                                         java.io.Writer out)
                                  throws java.lang.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 generate
        `record` - The Map to render as XML
        `out` - Writer to output the XML to
      Throws:
        `java.lang.Exception`

    - #### recordToXML

          public static void recordToXML(java.lang.String tagName,
                                         java.util.Map record,
                                         java.io.Writer out,
                                         DSRequest dsRequest)
                                  throws java.lang.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 generate
        `record` - The Map to render as XML
        `out` - Writer to output the XML to
        `dsRequest` - A DSRequest to use as context for the serialization. Pass as null if not appropriate
      Throws:
        `java.lang.Exception`

    - #### recordToXML

          public static void recordToXML(java.lang.String tagName,
                                         java.util.Map record,
                                         DataSource ds,
                                         java.io.Writer out)
                                  throws java.lang.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 generate
        `record` - The Map to render as XML
        `ds` - DataSource to use as template for the serialization.
        `out` - Writer to output the XML to
      Throws:
        `java.lang.Exception`