public class XMLTools
extends java.lang.Object
Constructor and Description |
---|
XMLTools() |
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.
|
public static void loadXMLSchema(java.lang.String schemaURL, XSDLoadCallback callback)
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).
schemaURL
- URL to load the schema fromcallback
- the callbackpublic static void loadXMLSchema(java.lang.String schemaURL, XSDLoadCallback callback, RPCRequest requestProperties)
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).
schemaURL
- URL to load the schema fromcallback
- the callbackrequestProperties
- additional properties to set on the RPCRequest that will be issuedpublic static void loadXMLSchema(java.lang.String schemaURL, XSDLoadCallback callback, RPCRequest requestProperties, boolean autoLoadImports)
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).
schemaURL
- URL to load the schema fromcallback
- the callbackrequestProperties
- additional properties to set on the RPCRequest that will be issuedautoLoadImports
- 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 loadedpublic static void loadWSDL(java.lang.String wsdlURL, WSDLLoadCallback callback)
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)
wsdlURL
- URL to load the WSDL file fromcallback
- the callbackpublic static void loadWSDL(java.lang.String wsdlURL, WSDLLoadCallback callback, RPCRequest requestProperties)
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)
wsdlURL
- URL to load the WSDL file fromcallback
- the callbackrequestProperties
- additional properties to set on the RPCRequest that will be issuedpublic static void loadWSDL(java.lang.String wsdlURL, WSDLLoadCallback callback, RPCRequest requestProperties, boolean autoLoadImports)
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)
wsdlURL
- URL to load the WSDL file fromcallback
- the callbackrequestProperties
- additional properties to set on the RPCRequest that will be issuedautoLoadImports
- 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 loadedpublic static java.lang.String selectString(java.lang.Object element, java.lang.String expression)
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.
element
- Native XMLElement, document or String xml to select fromexpression
- XPath expression to use to select nodespublic static java.lang.String selectString(java.lang.Object element, java.lang.String expression, java.util.Map namespaces)
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.
element
- Native XMLElement, document or String xml to select fromexpression
- XPath expression to use to select nodesnamespaces
- namespacespublic static java.lang.Object selectNodes(java.lang.Object element, java.lang.String expression)
element
- Native XMLElement,document or string xml to select fromexpression
- XPath expression to use to select nodespublic static java.lang.Object selectNodes(java.lang.Object element, java.lang.String expression, java.util.Map namespaces)
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.
element
- Native XMLElement,document to select fromexpression
- XPath expression to use to select nodesnamespaces
- namespace mapping used by the expression as prefix -> URI mappingpublic static com.google.gwt.json.client.JSONArray selectObjects(java.lang.Object element, java.lang.String expression)
element
- Object to select results fromexpression
- XPath expressionpublic static com.google.gwt.core.client.JavaScriptObject toJS(java.lang.Object elements)
elements
- XMLElement or XMLDocument element to tranform to JS