schema2template.model
Class XMLModel

java.lang.Object
  extended by schema2template.model.XMLModel

public class XMLModel
extends Object

The most important model, the first access to the XML Schema information. Provides all XML attribute and XML element definitions from the schema. All further information can be accessed from those definitions (e.g. dependencies, constant values, data types, etc.).


Constructor Summary
XMLModel(com.sun.msv.grammar.Expression root)
          Constructs new model by the MSV root expression
 
Method Summary
static String camelCase(QNamed def)
          Convert a-few:words into AFewWords in CamelCase spelling
static String camelCase(String raw)
          Convert a-few:words into AFewWords in CamelCase spelling
static String constantCase(QNamed def)
          Convert a-few:words into A_FEW_WORDS in spelling used for Java constants
static String constantCase(String raw)
          Convert a-few:words into A_FEW_WORDS in spelling used for Java constants
static String escapeKeyword(QNamed in)
          (Java) member variable may not start with a number, so escape it
static String escapeKeyword(String in)
          (Java) Keyword may not start with a number, so escape it
static String escapeLiteral(QNamed in)
          Escape the quotation marks of String literals
static String escapeLiteral(String in)
          Escape the quotation marks of String literals
static String extractLocalname(QNamed def)
          Extract localname local from ns:local name
static String extractLocalname(String name)
          Extract localname local from ns:local name
static String extractNamespace(QNamed def)
          Extract namespace ns from ns:local name
static String extractNamespace(String name)
          Extract namespace ns from ns:local name
static String firstWord(QNamed def)
          Maybe not used anymore: Get first word out of a QNamed object containing delimiters like "-:/ _.,"
static String firstWord(String raw)
          Assist method for camel-case adaptions or namespace extraction.
 QNamedPuzzleComponent getAttribute(String name)
          Get attribute by tag name.
 PuzzlePiece getAttribute(String name, int hashCode)
          Get attribute by tag name and hash code.
 PuzzlePieceSet getAttributes()
          Get all attributes, sorted by ns:local name.
 QNamedPuzzleComponent getElement(String name)
          Get element(s) by tag name.
 PuzzlePiece getElement(String name, int hashCode)
          Get element by tag name and hash code.
 PuzzlePieceSet getElements()
          Get all elements, sorted by ns:local name.
static String javaCase(QNamed def)
          Convert a-few:words into aFewWords in spelling for java method names
static String javaCase(String raw)
          Convert a-few:words into aFewWords in spelling for java method names
static String lastWord(QNamed def)
          Maybe not used anymore: Get last word out of a String containing delimiters like "-:/ _.,"
static String lastWord(String raw)
          Maybe not used anymore: Get last word out of a String containing delimiters like "-:/ _.,"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLModel

public XMLModel(com.sun.msv.grammar.Expression root)
Constructs new model by the MSV root expression

Parameters:
root - MSV root Expression
Method Detail

getElements

public PuzzlePieceSet getElements()
Get all elements, sorted by ns:local name.

Returns:
Unmodifiable SortedSet of elements

getAttributes

public PuzzlePieceSet getAttributes()
Get all attributes, sorted by ns:local name.

Returns:
Unmodifiable SortedSet of attributes

getElement

public QNamedPuzzleComponent getElement(String name)
Get element(s) by tag name. If there are multiple elements sharing the same tag name, a PuzzlePieceSet is returned. If not, a single PuzzlePiece is returned.

Parameters:
name -
Returns:
Element PuzzlePiece(s)

getElement

public PuzzlePiece getElement(String name,
                              int hashCode)
Get element by tag name and hash code. The hash code distincts Elements sharing the same tag name.

Parameters:
name -
hashCode -
Returns:
Element PuzzlePiece

getAttribute

public QNamedPuzzleComponent getAttribute(String name)
Get attribute by tag name. If there are multiple attributes sharing the same tag name, a PuzzlePieceSet is returned. If not, a single PuzzlePiece is returned.

Parameters:
name -
Returns:
Attribute PuzzlePiece(s)

getAttribute

public PuzzlePiece getAttribute(String name,
                                int hashCode)
Get attribute by tag name and hash code. The hash code distincts Attributes sharing the same tag name.

Parameters:
name -
hashCode -
Returns:
Attribute PuzzlePiece

camelCase

public static String camelCase(String raw)
Convert a-few:words into AFewWords in CamelCase spelling

Parameters:
raw - input String
Returns:
filtered output String

camelCase

public static String camelCase(QNamed def)
Convert a-few:words into AFewWords in CamelCase spelling

Parameters:
def - input
Returns:
filtered output String

javaCase

public static String javaCase(String raw)
Convert a-few:words into aFewWords in spelling for java method names

Parameters:
raw - input String
Returns:
filtered output String

javaCase

public static String javaCase(QNamed def)
Convert a-few:words into aFewWords in spelling for java method names

Parameters:
def - input
Returns:
filtered output String

constantCase

public static String constantCase(String raw)
Convert a-few:words into A_FEW_WORDS in spelling used for Java constants

Parameters:
raw - input String
Returns:
filtered output String

constantCase

public static String constantCase(QNamed def)
Convert a-few:words into A_FEW_WORDS in spelling used for Java constants

Parameters:
def - input
Returns:
filtered output String

firstWord

public static String firstWord(String raw)
Assist method for camel-case adaptions or namespace extraction. Maybe not used anymore: Get first word out of a String containing delimiters like "-:/ _.,"

Parameters:
raw - input String
Returns:
filtered output String

firstWord

public static String firstWord(QNamed def)
Maybe not used anymore: Get first word out of a QNamed object containing delimiters like "-:/ _.,"

Parameters:
def - input
Returns:
first word

lastWord

public static String lastWord(String raw)
Maybe not used anymore: Get last word out of a String containing delimiters like "-:/ _.,"

Parameters:
raw - input
Returns:
last word

lastWord

public static String lastWord(QNamed def)
Maybe not used anymore: Get last word out of a String containing delimiters like "-:/ _.,"

Parameters:
def - input
Returns:
last word

escapeKeyword

public static String escapeKeyword(QNamed in)
(Java) member variable may not start with a number, so escape it

Parameters:
in - raw input
Returns:
filtered output, starting with a literal

escapeKeyword

public static String escapeKeyword(String in)
(Java) Keyword may not start with a number, so escape it

Parameters:
in - raw input
Returns:
filtered output, starting with a literal

escapeLiteral

public static String escapeLiteral(QNamed in)
Escape the quotation marks of String literals

Parameters:
in - raw input
Returns:
filtered output, with escaped quotation marks

escapeLiteral

public static String escapeLiteral(String in)
Escape the quotation marks of String literals

Parameters:
in - raw input
Returns:
filtered output, with escaped quotation marks

extractNamespace

public static String extractNamespace(String name)
Extract namespace ns from ns:local name

Parameters:
name - in form ns:local
Returns:
ns part from ns:local name

extractNamespace

public static String extractNamespace(QNamed def)
Extract namespace ns from ns:local name

Parameters:
def - QNamed object
Returns:
ns part from ns:local name

extractLocalname

public static String extractLocalname(String name)
Extract localname local from ns:local name

Parameters:
name - in form ns:local
Returns:
local part from ns:local name

extractLocalname

public static String extractLocalname(QNamed def)
Extract localname local from ns:local name

Parameters:
def - QNamed object
Returns:
local part from ns:local name


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.