All Packages Class Hierarchy This Package Previous Next Index
Class org.xmlmiddleware.xmldbms.maps.factories.XMLNameChecker
java.lang.Object
|
+----org.xmlmiddleware.xmldbms.maps.factories.XMLNameChecker
- public class XMLNameChecker
- extends Object
Checks if names conform to the rules of the XML Name production.
XMLNameChecker checks that a name conforms to the rules of the XML Name
production. It also checks that new element type names do not collide with
existing element type names and that new attribute names do not collide with
existing attribute names. Names are modified as follows:
- Any characters not supported by the Name production are discarded.
- Names are checked against currently used names. If any collisions are
found, then names are prepended until a unique name is constructed.
(This is designed to be used with database names, where a column name is
prepended with its table, schema, catalog, etc. name.) If the name is
still not unique or if no names to prepend were passed, then a number
(starting with 1) is appended until a non-colliding name is found.
- Version:
- 2.0
- Author:
- Ronald Bourret
-
XMLNameChecker()
- Construct a new XMLNameChecker.
-
checkAttributeName(String[], XMLName, String, String, String)
- Checks an attribute name.
-
checkElementTypeName(String[], String, String, String)
- Checks an element type name.
-
startNewSession()
- Start a new name-checking session.
XMLNameChecker
public XMLNameChecker()
- Construct a new XMLNameChecker.
startNewSession
public void startNewSession()
- Start a new name-checking session.
This method removes all names from the lists of element type and attribute names
created during the previous session. Thus, names are checked for collisions
only against names created after this call and before the next call to
startNewSession().
checkElementTypeName
public XMLName checkElementTypeName(String prefixes[],
String namespaceURI,
String localName,
String namespacePrefix) throws XMLMiddlewareException
- Checks an element type name.
The prefixes argument is designed to be used when constructing element type
names from database names. When the element type name is constructed from a column
name, it should contain the table, schema, catalog, and database names. When the
element type name is constructed from a table name, it should contain the schema,
catalog, and database names. If the prefixes argument is null, collisions are
resolved by appending numbers starting with 1.
- Parameters:
- prefixes - An array of prefixes to prepend to the name to resolve
collisions. May be null.
- namespaceURI - The URI of the namespace in which the element type name resides. May be null.
- localName - The local part of the element type name to check.
- namespacePrefix - The prefix of the namespace in which the element type name
resides. May be null, even if the namespaceURI argument is non-null.
- Returns:
- A unique element type name.
- Throws: XMLMiddlewareException
- Thrown if a valid name cannot be constructed.
checkAttributeName
public XMLName checkAttributeName(String prefixes[],
XMLName elementTypeName,
String namespaceURI,
String localName,
String namespacePrefix) throws XMLMiddlewareException
- Checks an attribute name.
The prefixes argument is designed to be used when constructing attribute
names from database names. It should contain the table, schema, catalog, and
database names. If the prefixes argument is null, collisions are resolved
by appending numbers starting with 1.
- Parameters:
- prefixes - An array of prefixes to prepend to the name to resolve
collisions. May be null.
- elementTypeName - XMLName of the element type name to which the attribute belongs.
- namespaceURI - The URI of the namespace in which the attribute name resides.
May be null.
- localName - The local part of the attribute name to check.
- namespacePrefix - The prefix of the namespace in which the attribute name
resides. May be null, even if the namespaceURI argument is non-null.
- Returns:
- A unique attribute name.
- Throws: XMLMiddlewareException
- Thrown if a valid name cannot be constructed.
All Packages Class Hierarchy This Package Previous Next Index