com.smartgwt.client.data

## Class XMLTools

- java.lang.Object
- - com.smartgwt.client.data.XMLTools

-     public class XMLTools
      extends java.lang.Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLTools()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `loadWSDL(java.lang.String wsdlURL, WSDLLoadCallback callback)` Load a WSDL file and create an instance of WebService that allows invoking operations and binding DataSources to web service operations.
    `static void` | `loadWSDL(java.lang.String wsdlURL, WSDLLoadCallback callback, RPCRequest requestProperties)` Load a WSDL file and create an instance of WebService that allows invoking operations and binding DataSources to web service operations.
    `static void` | `loadWSDL(java.lang.String wsdlURL, WSDLLoadCallback callback, RPCRequest requestProperties, boolean autoLoadImports)` Load a WSDL file and create an instance of WebService that allows invoking operations and binding DataSources to web service operations.
    `static void` | `loadXMLSchema(java.lang.String schemaURL, XSDLoadCallback callback)` Load an XML file containing XML schema definitions and create DataSource and SimpleType objects to represent the schema.
    `static void` | `loadXMLSchema(java.lang.String schemaURL, XSDLoadCallback callback, RPCRequest requestProperties)` Load an XML file containing XML schema definitions and create DataSource and SimpleType objects to represent the schema.
    `static void` | `loadXMLSchema(java.lang.String schemaURL, XSDLoadCallback callback, RPCRequest requestProperties, boolean autoLoadImports)` Load an XML file containing XML schema definitions and create DataSource and SimpleType objects to represent the schema.
    `static java.lang.Object` | `selectNodes(java.lang.Object element, java.lang.String expression)` Retrieve a set of nodes from an XML element or document based on an XPath expression.
    `static java.lang.Object` | `selectNodes(java.lang.Object element, java.lang.String expression, java.util.Map namespaces)` Retrieve a set of nodes from an XML element or document based on an XPath expression.
    `static com.google.gwt.json.client.JSONArray` | `selectObjects(java.lang.Object element, java.lang.String expression)` Applies an XPath expression to JavaScript objects, returning matching objects.
    `static java.lang.String` | `selectString(java.lang.Object element, java.lang.String expression)` Retrieve a string value from an XML element or document based on an XPath expression.
    `static java.lang.String` | `selectString(java.lang.Object element, java.lang.String expression, java.util.Map namespaces)` Retrieve a string value from an XML element or document based on an XPath expression.
    `static com.google.gwt.core.client.JavaScriptObject` | `toJS(java.lang.Object elements)` ranslates an XML fragment to JavaScript collections.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XMLTools

          public XMLTools()

  - ### Method Detail

    - #### loadXMLSchema

          public static void loadXMLSchema(java.lang.String schemaURL,
                           XSDLoadCallback callback)

      Load an XML file containing XML schema definitions and create DataSource and SimpleType objects to represent the schema. You can use to loaded schema to bind ISC components, perform validation, create editing interfaces, and build other metadata-driven interfaces.

      All <xsd:complexType> declarations become ISC DataSources, and all <xsd:simpleType> definitions become atomic type definitions.

      By default, named complexType definitions and named element definitions containing complexTypes become global DataSources, that is, they can be fetched with DataSource.getDataSource(). Inline complexType definitions get automatically generated names.

      Named simpleType declarations become global ISC atomic types, that is, subsequently defined DataSources can use them for DataSourceField.type. XML schema "restrictions" for simple types are automatically translated to DataSourceField.valueMap or DataSourceField.validators as appropriate.

      The created SchemaSet object is available in the callback as the single parameter "schemaSet", or can retrieved via SchemaSet.get(schemaNamespace).

      NOTE: required fields: the XML concept of "required" for an attribute or subelement, expressed via use="required" (for an attribute) or minOccurs > 0 (for a subelement), is that the attribute or element must be present in the XML document but can have any value, including being empty or null. The SmartGWT notion of required means non-null. You can express the SmartClient notion of required in XML Schema with the combination of maxOccurs>0 and a minLength or length "restriction", and SmartClient will recognize the field as SmartClient-required, with all of the behaviors that implies (eg, specially styled form titles, automatic validation, etc).

      Parameters:
        `schemaURL` - URL to load the schema from
        `callback` - the callback

    - #### loadXMLSchema

          public static void loadXMLSchema(java.lang.String schemaURL,
                           XSDLoadCallback callback,
                           RPCRequest requestProperties)

      Load an XML file containing XML schema definitions and create DataSource and SimpleType objects to represent the schema. You can use to loaded schema to bind ISC components, perform validation, create editing interfaces, and build other metadata-driven interfaces.

      All <xsd:complexType> declarations become ISC DataSources, and all <xsd:simpleType> definitions become atomic type definitions.

      By default, named complexType definitions and named element definitions containing complexTypes become global DataSources, that is, they can be fetched with DataSource.getDataSource(). Inline complexType definitions get automatically generated names.

      Named simpleType declarations become global ISC atomic types, that is, subsequently defined DataSources can use them for DataSourceField.type. XML schema "restrictions" for simple types are automatically translated to DataSourceField.valueMap or DataSourceField.validators as appropriate.

      The created SchemaSet object is available in the callback as the single parameter "schemaSet", or can retrieved via SchemaSet.get(schemaNamespace).

      NOTE: required fields: the XML concept of "required" for an attribute or subelement, expressed via use="required" (for an attribute) or minOccurs > 0 (for a subelement), is that the attribute or element must be present in the XML document but can have any value, including being empty or null. The SmartGWT notion of required means non-null. You can express the SmartClient notion of required in XML Schema with the combination of maxOccurs>0 and a minLength or length "restriction", and SmartClient will recognize the field as SmartClient-required, with all of the behaviors that implies (eg, specially styled form titles, automatic validation, etc).

      Parameters:
        `schemaURL` - URL to load the schema from
        `callback` - the callback
        `requestProperties` - additional properties to set on the RPCRequest that will be issued

    - #### loadXMLSchema

          public static void loadXMLSchema(java.lang.String schemaURL,
                           XSDLoadCallback callback,
                           RPCRequest requestProperties,
                           boolean autoLoadImports)

      Load an XML file containing XML schema definitions and create DataSource and SimpleType objects to represent the schema. You can use to loaded schema to bind ISC components, perform validation, create editing interfaces, and build other metadata-driven interfaces.

      All <xsd:complexType> declarations become ISC DataSources, and all <xsd:simpleType> definitions become atomic type definitions.

      By default, named complexType definitions and named element definitions containing complexTypes become global DataSources, that is, they can be fetched with DataSource.getDataSource(). Inline complexType definitions get automatically generated names.

      Named simpleType declarations become global ISC atomic types, that is, subsequently defined DataSources can use them for DataSourceField.type. XML schema "restrictions" for simple types are automatically translated to DataSourceField.valueMap or DataSourceField.validators as appropriate.

      The created SchemaSet object is available in the callback as the single parameter "schemaSet", or can retrieved via SchemaSet.get(schemaNamespace).

      NOTE: required fields: the XML concept of "required" for an attribute or subelement, expressed via use="required" (for an attribute) or minOccurs > 0 (for a subelement), is that the attribute or element must be present in the XML document but can have any value, including being empty or null. The SmartGWT notion of required means non-null. You can express the SmartClient notion of required in XML Schema with the combination of maxOccurs>0 and a minLength or length "restriction", and SmartClient will recognize the field as SmartClient-required, with all of the behaviors that implies (eg, specially styled form titles, automatic validation, etc).

      Parameters:
        `schemaURL` - URL to load the schema from
        `callback` - the callback
        `requestProperties` - additional properties to set on the RPCRequest that will be issued
        `autoLoadImports` - if set, xsd:import statements will be processed automatically to load dependent XSD files where a "location" is specified. The callback will not fire until all dependencies have been loaded

    - #### loadWSDL

          public static void loadWSDL(java.lang.String wsdlURL,
                      WSDLLoadCallback callback)

      Load a WSDL file and create an instance of WebService that allows invoking operations and binding DataSources to web service operations. The created WebService object is available in the callback as the single parameter "service", or can retrieved via WebService.get(serviceNamespace).

      XML Schema present in the WSDL file will also will also be processed as described in XMLTools.loadXMLSchema().

      Platform notes: loadWSDL() is not supported in Safari 2.0 (but is supported in Safari 3.0.3 and greater)

      Parameters:
        `wsdlURL` - URL to load the WSDL file from
        `callback` - the callback

    - #### loadWSDL

          public static void loadWSDL(java.lang.String wsdlURL,
                      WSDLLoadCallback callback,
                      RPCRequest requestProperties)

      Load a WSDL file and create an instance of WebService that allows invoking operations and binding DataSources to web service operations. The created WebService object is available in the callback as the single parameter "service", or can retrieved via WebService.get(serviceNamespace).

      XML Schema present in the WSDL file will also will also be processed as described in XMLTools.loadXMLSchema().

      Platform notes: loadWSDL() is not supported in Safari 2.0 (but is supported in Safari 3.0.3 and greater)

      Parameters:
        `wsdlURL` - URL to load the WSDL file from
        `callback` - the callback
        `requestProperties` - additional properties to set on the RPCRequest that will be issued

    - #### loadWSDL

          public static void loadWSDL(java.lang.String wsdlURL,
                      WSDLLoadCallback callback,
                      RPCRequest requestProperties,
                      boolean autoLoadImports)

      Load a WSDL file and create an instance of WebService that allows invoking operations and binding DataSources to web service operations. The created WebService object is available in the callback as the single parameter "service", or can retrieved via WebService.get(serviceNamespace).

      XML Schema present in the WSDL file will also will also be processed as described in XMLTools.loadXMLSchema().

      Platform notes: loadWSDL() is not supported in Safari 2.0 (but is supported in Safari 3.0.3 and greater)

      Parameters:
        `wsdlURL` - URL to load the WSDL file from
        `callback` - the callback
        `requestProperties` - additional properties to set on the RPCRequest that will be issued
        `autoLoadImports` - if set, xsd:import statements will be processed automatically to load dependent XSD files where a "location" is specified. The callback will not fire until all dependencies have been loaded

    - #### selectString

          public static java.lang.String selectString(java.lang.Object element,
                                      java.lang.String expression)

      Retrieve a string value from an XML element or document based on an XPath expression. If more than one node matches, only the first node's value will be returned.

      Namespacing works as described under XMLTools.selectNodes()

      NOTE: this API cannot be supported on the Safari web browser for versions prior to 3.0.3.

      Parameters:
        `element` - Native XMLElement, document or String xml to select from
        `expression` - XPath expression to use to select nodes
      Returns:
        result of the XPath, in String form

    - #### selectString

          public static java.lang.String selectString(java.lang.Object element,
                                      java.lang.String expression,
                                      java.util.Map namespaces)

      Retrieve a string value from an XML element or document based on an XPath expression. If more than one node matches, only the first node's value will be returned.

      Namespacing works as described under XMLTools.selectNodes()

      NOTE: this API cannot be supported on the Safari web browser for versions prior to 3.0.3.

      Parameters:
        `element` - Native XMLElement, document or String xml to select from
        `expression` - XPath expression to use to select nodes
        `namespaces` - namespaces
      Returns:
        result of the XPath, in String form

    - #### selectNodes

          public static java.lang.Object selectNodes(java.lang.Object element,
                                     java.lang.String expression)

      Retrieve a set of nodes from an XML element or document based on an XPath expression.
      Parameters:
        `element` - Native XMLElement,document or string xml to select from
        `expression` - XPath expression to use to select nodes
      Returns:
        list of nodes matching XPath

    - #### selectNodes

          public static java.lang.Object selectNodes(java.lang.Object element,
                                     java.lang.String expression,
                                     java.util.Map namespaces)

      Retrieve a set of nodes from an XML element or document based on an XPath expression.

      If the target document is namespaced, namespace prefixes declared in the document element of the target document will be available, as well as the default namespace, if declared, under the prefix "default".

      To declare your own namespace prefixes, provide a prefix to URI mapping as a simple JS Object, for example:

      { az : "http://webservices.amazon.com/AWSECommerceService/2005-03-23", xsd : "http://www.w3.org/2001/XMLSchema" }

      NOTE: this API cannot be supported on the Safari web browser for versions earlier than 3.0.3.

      Parameters:
        `element` - Native XMLElement,document to select from
        `expression` - XPath expression to use to select nodes
        `namespaces` - namespace mapping used by the expression as prefix -> URI mapping
      Returns:
        list of nodes matching XPath

    - #### selectObjects

          public static com.google.gwt.json.client.JSONArray selectObjects(java.lang.Object element,
                                                           java.lang.String expression)

      Applies an XPath expression to JavaScript objects, returning matching objects.
      Parameters:
        `element` - Object to select results from
        `expression` - XPath expression
      Returns:
        Array of matching objects, or null for no match

    - #### toJS

          public static com.google.gwt.core.client.JavaScriptObject toJS(java.lang.Object elements)

      ranslates an XML fragment to JavaScript collections.
      Parameters:
        `elements` - XMLElement or XMLDocument element to tranform to JS
      Returns:
        The resulting JavaScript collection