- All Known Subinterfaces:
SDOXSDHelper
- All Known Implementing Classes:
SDOXSDHelperDelegate
,SDOXSDHelperDelegator
public interface XSDHelper
Provides access to additional information when the
Type or Property is defined by an XML Schema (XSD).
In case Types or Properties are not defined from an XML Schema,
methods return information corresponding to what would be the generated XSD.
Defines Types from an XSD.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefine
(InputStream xsdInputStream, String schemaLocation) Define XML Schema as Types.Define XML Schema as Types.Define the XML Schema as Types.Generate an XML Schema Declaration (XSD) from Types.Generate an XML Schema Declaration (XSD) from Types.getAppinfo
(Property property, String source) Return the content of the appinfo declared for this Property and source.getAppinfo
(Type type, String source) Return the appinfo declared for this Type and source.getGlobalProperty
(String uri, String propertyName, boolean isElement) Returns the Property defined by the named global element or attribute in the targetNamespace uri, or null if not found.getLocalName
(Property property) Returns the local name as declared in the XSD.getLocalName
(Type type) Returns the local name as declared in the XSD.getNamespaceURI
(Property property) Returns the namespace URI as declared in the XSD.getNamespaceURI
(Type type) Returns the namespace URI as declared in the XSD.boolean
isAttribute
(Property property) Returns true if the property is declared as an attribute in the XSD.boolean
Returns true if the property is declared as an element in the XSD.boolean
Returns true if the Type is declared to contain mixed content.boolean
Indicates if this helper contains XSD information for the specified type.
-
Field Details
-
INSTANCE
The default XSDHelper.
-
-
Method Details
-
getLocalName
Returns the local name as declared in the XSD.- Parameters:
type
- to return local name for.- Returns:
- the local name as declared in the XSD. If
type
is one of the predefined SDO types, the result is undefined.
-
getLocalName
Returns the local name as declared in the XSD.- Parameters:
property
- to return local name for.- Returns:
- the local name as declared in the XSD.
-
getNamespaceURI
Returns the namespace URI as declared in the XSD. If the XSD has no namespace URI, then""
is returned.- Parameters:
property
- to return namespace URI for.- Returns:
- the namespace URI as declared in the XSD.
-
getNamespaceURI
Returns the namespace URI as declared in the XSD. If the XSD has no namespace URI, then""
is returned.- Parameters:
type
- to return namespace URI for- Returns:
- the namespace URI as declared in the XSD.
-
isAttribute
Returns true if the property is declared as an attribute in the XSD. Returns false if not known or for advanced cases. It is possible for both isAttribute and isElement to return false but they will not both return true.- Parameters:
property
- to identify if an attribute.- Returns:
- true if the property is declared as an attribute in the XSD.
-
isElement
Returns true if the property is declared as an element in the XSD. Returns false if not known or for advanced cases. It is possible for both isAttribute and isElement to return false but they will not both return true.- Parameters:
property
- to identify if an element.- Returns:
- true if the property is declared as an element in the XSD.
-
isMixed
Returns true if the Type is declared to contain mixed content. A DataObject's mixed content values are typically accessed via a Sequence.- Parameters:
type
- to identify if mixed content.- Returns:
- true if the Type is declared to contain mixed content.
-
isXSD
Indicates if this helper contains XSD information for the specified type.- Parameters:
type
- the type.- Returns:
- true if this helper contains XSD information for the specified type.
-
getGlobalProperty
Returns the Property defined by the named global element or attribute in the targetNamespace uri, or null if not found. If the SDO name for a property is different than the XSD name, then only the XSD name is used for the lookup. Passing innull
or""
for theuri
parameter means that an element/attribute defined in a Schema with no target namespace will be returned.- Parameters:
uri
- The uri of the targetNamespace.propertyName
- The name of the global property.isElement
- is true for global elements, false for global attributes.- Returns:
- the Property defined by the named global element or attribute in the targetNamespace uri, or null if not found.
-
getAppinfo
Return the appinfo declared for this Type and source. The appinfo start and end tags and content are returned. The xml namespace context is preserved in the appinfo element. If more than one appinfo with the same source is declared on the same Type their contents are concatenated.- Parameters:
type
- the type with the appinfo declarationsource
- the source of the appinfo declaration.- Returns:
- the appinfo declared for this Type and source.
-
getAppinfo
Return the content of the appinfo declared for this Property and source. If the property is defined by ref= the appinfo of the referenced element or attribute is included. The appinfo start and end tags and content are returned. The xml namespace context is preserved in the appinfo element. If more than one appinfo with the same source is declared on the same Type their contents are concatenated.- Parameters:
property
- the Property with the appinfo declarationsource
- the source of the appinfo declaration.- Returns:
- the appinfo declared for this Property and source.
-
define
Define the XML Schema as Types. The Types are available throughTypeHelper.getType(java.lang.String, java.lang.String)
methods. Same as define(new StringReader(xsd), null)- Parameters:
xsd
- the XML Schema.- Returns:
- the defined Types. Not all of the XML Schema types cause an SDO type to be defined (for example in case of duplicates), the returned list only includes the newly defined types.
- Throws:
IllegalArgumentException
- if the Types could not be defined.
-
define
Define XML Schema as Types. The Types are available throughTypeHelper.getType(java.lang.String, java.lang.String)
methods.- Parameters:
xsdReader
- reader to an XML Schema.schemaLocation
- the URI of the location of the schema, used for processing relative imports and includes. May be null if not used.- Returns:
- the defined Types. Not all of the XML Schema types cause an SDO type to be defined (for example in case of duplicates), the returned list only includes the newly defined types.
- Throws:
IllegalArgumentException
- if the Types could not be defined.
-
define
Define XML Schema as Types. The Types are available throughTypeHelper.getType(java.lang.String, java.lang.String)
methods.- Parameters:
xsdInputStream
- input stream to an XML Schema.schemaLocation
- the URI of the location of the schema, used for processing relative imports and includes. May be null if not used.- Returns:
- the defined Types. Not all of the XML Schema types cause an SDO type to be defined (for example in case of duplicates), the returned list only includes the newly defined types.
- Throws:
IllegalArgumentException
- if the Types could not be defined.
-
generate
Generate an XML Schema Declaration (XSD) from Types. Same as generate(types, null);- Parameters:
types
- a List containing the Types- Returns:
- a String containing the generated XSD.
- Throws:
IllegalArgumentException
- if the XSD could not be generated.
-
generate
Generate an XML Schema Declaration (XSD) from Types. Round trip from SDO to XSD to SDO is supported. Round trip from XSD to SDO to XSD is not supported. Use the original schema if one exists instead of generating a new one, as the generated XSD validates a different set of documents than the original XSD. Generating an XSD does not affect the XSDHelper or the Types. The Types must all have the same URI. The result is a String containing the generated XSD. All Types referenced with the same URI will be generated in the XSD and the list will be expanded to include all types generated. Any Types referenced with other URIs will cause imports to be produced as appropriate. Imports will include a schemaLocation if a Map is provided with an entry of the form key=import target namespace, value=schemaLocation- Parameters:
types
- a List containing the TypesnamespaceToSchemaLocation
- map of target namespace to schema locations or null- Returns:
- a String containing the generated XSD.
- Throws:
IllegalArgumentException
- if the XSD could not be generated.
-