public abstract class MXMLDialect extends Object
Each MXML dialect has a unique language namespace, such as
"http://ns.adobe.com/mxml/2009"
for MXML 2009.
You can use an MXML dialect to get the XML name for various core tags of the
language, such as ("http://ns.adobe.com/mxml/2009", "Library")
for the <Library>
tag of MXML 2009. The name will be
null
if the tag is not supported in the dialect. For example,
the <Library>
tag does not exist in MXML 2006.
You can also use an MXML dialect to perform core MXML parsing, such as
parsing ActionScript values of type Boolean
, int
,
etc. from attribute values and character data.
Static methods on this class allow you to determine whether a URI is language namespace for a dialect of MXML, and to get the dialect object for that namespace.
Modifier and Type | Class and Description |
---|---|
static class |
MXMLDialect.TextParsingFlags
Flags that affect how the parsing methods work.
|
Modifier and Type | Field and Description |
---|---|
protected XMLName |
bindingXMLName |
protected XMLName |
componentXMLName |
protected XMLName |
declarationsXMLName |
static MXMLDialect |
DEFAULT
The
MXMLDialect representing the default dialect of MXML. |
protected XMLName |
definitionXMLName |
protected XMLName |
libraryXMLName |
protected XMLName |
metadataXMLName |
protected XMLName |
modelXMLName |
static MXMLDialect |
MXML_2006
The
MXMLDialect representing MXML 2006. |
static MXMLDialect |
MXML_2009
The
MXMLDialect representing MXML 2009. |
static MXMLDialect |
MXML_2012
The
MXMLDialect representing MXML 2012 (experimental). |
protected XMLName |
privateXMLName |
protected XMLName |
reparentXMLName |
protected XMLName |
scriptXMLName |
protected XMLName |
styleXMLName |
Modifier | Constructor and Description |
---|---|
protected |
MXMLDialect(String languageNamespace,
int year)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract String |
collapseWhitespace(String s,
char replacementChar)
Removes whitespace from the input string and returns a string that
contains at most 1 'replacementChar' character between each word.
|
static MXMLDialect |
getDialectForLanguageNamespace(String uri)
Gets the
MXMLDialect object corresponding to a specified
language namespace. |
String |
getLanguageNamespace()
Gets the language namespace for this dialect of MXML.
|
static MXMLDialect |
getMXMLDialect(PrefixMap rootPrefixMap)
Given a
PrefixMap representing the xmlns
attributes on the root tag, determines which dialect of MXML is being
used. |
Character |
getNamedEntity(String entityName)
Gets the character corresponding to an entity name in this dialect of
MXML.
|
boolean |
isEqualToOrAfter(MXMLDialect other)
Determines whether this dialect is equal to, or later than, another
dialect.
|
boolean |
isEqualToOrBefore(MXMLDialect other)
Determines whether this dialect is equal to, or earlier than, another
dialect.
|
static boolean |
isLanguageNamespace(String uri)
Determines whether a specified URI is the language namespace for a
supported dialect of MXML.
|
abstract boolean |
isWhitespace(char c)
Determines whether a character is considered whitespace in this dialect
of MXML.
|
abstract boolean |
isWhitespace(String s)
Determines whether a text String contains only characters that are
considered whitespace in this dialect of MXML.
|
abstract List<Object> |
parseArray(FlexProject project,
String s,
EnumSet<MXMLDialect.TextParsingFlags> flags)
Parses an ActionScript
Array value from a string. |
abstract Boolean |
parseBoolean(FlexProject project,
String s,
EnumSet<MXMLDialect.TextParsingFlags> flags)
Parses an ActionScript
Boolean value from a string. |
abstract Integer |
parseInt(FlexProject project,
String s,
EnumSet<MXMLDialect.TextParsingFlags> flags)
Parses an ActionScript
int value from a string. |
abstract Number |
parseNumber(FlexProject project,
String s,
EnumSet<MXMLDialect.TextParsingFlags> flags)
Parses an ActionScript
Number value from a string. |
abstract Object |
parseObject(FlexProject project,
String s,
EnumSet<MXMLDialect.TextParsingFlags> flags)
Parses an ActionScript value from a string.
|
abstract String |
parseString(FlexProject project,
String s,
EnumSet<MXMLDialect.TextParsingFlags> flags)
Parses an ActionScript
String value from a string. |
abstract Long |
parseUint(FlexProject project,
String s,
EnumSet<MXMLDialect.TextParsingFlags> flags)
Parses an ActionScript
uint value from a string. |
XMLName |
resolveArray()
Gets the XML name of the
<Array> tag in this dialect of MXML. |
XMLName |
resolveBinding()
Gets the XML name of the
<Binding> tag in this dialect of MXML. |
XMLName |
resolveBoolean()
Gets the XML name of the
<Boolean> tag in this dialect of MXML. |
XMLName |
resolveClass()
Gets the XML name of the
<Class> tag in this dialect of MXML. |
XMLName |
resolveComponent()
Gets the XML name of the
<Component> tag in this dialect of MXML. |
XMLName |
resolveDate()
Gets the XML name of the
<Date> tag in this dialect of MXML. |
XMLName |
resolveDeclarations()
Gets the XML name of the
<De3clarations> tag in this dialect of
MXML. |
XMLName |
resolveDefinition()
Gets the XML name of the
<Definition> tag in this dialect of
MXML. |
XMLName |
resolveFunction()
Gets the XML name of the
<Function> tag in this dialect of MXML. |
XMLName |
resolveInt()
Gets the XML name of the
<int> tag in this dialect of MXML. |
XMLName |
resolveLibrary()
Gets the XML name of the
<Library> tag in this dialect of MXML. |
XMLName |
resolveMetadata()
Gets the XML name of the
<Metadata> tag in this dialect of MXML. |
XMLName |
resolveModel()
Gets the XML name of the
<Model> tag in this dialect of MXML. |
XMLName |
resolveNumber()
Gets the XML name of the
<Number> tag in this dialect of MXML. |
XMLName |
resolveObject()
Gets the XML name of the
<Object> tag in this dialect of MXML. |
XMLName |
resolvePrivate()
Gets the XML name of the
<Private> tag in this dialect of MXML. |
XMLName |
resolveReparent()
Gets the XML name of the
<Reparent> tag in this dialect of MXML. |
XMLName |
resolveScript()
Gets the XML name of the
<Script> tag in this dialect of MXML. |
XMLName |
resolveString()
Gets the XML name of the
<String> tag in this dialect of MXML. |
XMLName |
resolveStyle()
Gets the XML name of the
<Style> tag in this dialect of MXML. |
XMLName |
resolveUint()
Gets the XML name of the
<uint> tag in this dialect of MXML. |
XMLName |
resolveXML()
Gets the XML name of the
<XML> tag in this dialect of MXML. |
XMLName |
resolveXMLList()
Gets the XML name of the
<XMLList> tag in this dialect of MXML. |
abstract String[] |
splitAndTrim(String s)
Splits a string at commas and then trims whitespace from each part.
|
abstract String |
trim(String s)
Removes any leading and trailing characters from a String that are
considered whitespace in this version of MXML.
|
public static final MXMLDialect MXML_2012
MXMLDialect
representing MXML 2012 (experimental).public static final MXMLDialect MXML_2009
MXMLDialect
representing MXML 2009.public static final MXMLDialect MXML_2006
MXMLDialect
representing MXML 2006.public static final MXMLDialect DEFAULT
MXMLDialect
representing the default dialect of MXML. It
is used when the dialect is not explicitly expressed.protected XMLName bindingXMLName
protected XMLName componentXMLName
protected XMLName declarationsXMLName
protected XMLName definitionXMLName
protected XMLName libraryXMLName
protected XMLName metadataXMLName
protected XMLName modelXMLName
protected XMLName privateXMLName
protected XMLName reparentXMLName
protected XMLName scriptXMLName
protected XMLName styleXMLName
protected MXMLDialect(String languageNamespace, int year)
languageNamespace
- The language namespace URI that identifies this
dialect of MXML, such as "http://ns.adobe.com/mxml/2009"
for
MXML 2009.year
- The numeric value (such as 2009
) used for
comparing different dialects of MXML.public static boolean isLanguageNamespace(String uri)
The supported URIs are:
"http://www.adobe.com/2006/mxml"
for MXML 2006"http://ns.adobe.com/mxml/2009"
for MXML 2009"http://ns.adobe.com/mxml/2012"
for MXML 2012uri
- A URI specifying a language namespace.true
if the URI is a supported language namespace.public static MXMLDialect getDialectForLanguageNamespace(String uri)
MXMLDialect
object corresponding to a specified
language namespace.uri
- A URI string specifying a langauge namespace.MXMLDialect
or null
.public static MXMLDialect getMXMLDialect(PrefixMap rootPrefixMap)
PrefixMap
representing the xmlns
attributes on the root tag, determines which dialect of MXML is being
used.rootPrefixMap
- A PrefixMap
.MXMLDialect
.public String getLanguageNamespace()
For MXML 2009, for example, this is
"http://ns.adobe.com/mxml/2009"
.
public boolean isEqualToOrAfter(MXMLDialect other)
other
- Another MXMLDialect
.true
public boolean isEqualToOrBefore(MXMLDialect other)
other
- Another MXMLDialect
.true
public XMLName resolveArray()
<Array>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveBinding()
<Binding>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveBoolean()
<Boolean>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveClass()
<Class>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveComponent()
<Component>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveDeclarations()
<De3clarations>
tag in this dialect of
MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveDate()
<Date>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveDefinition()
<Definition>
tag in this dialect of
MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveFunction()
<Function>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveInt()
<int>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveLibrary()
<Library>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveMetadata()
<Metadata>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveModel()
<Model>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveNumber()
<Number>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveObject()
<Object>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolvePrivate()
<Private>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveReparent()
<Reparent>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveScript()
<Script>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveString()
<String>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveStyle()
<Style>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveUint()
<uint>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveXML()
<XML>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public XMLName resolveXMLList()
<XMLList>
tag in this dialect of MXML.XMLName
or null
if this tag is not
supported.public Character getNamedEntity(String entityName)
For example, if you pass the entity name "lt"
, this returns
the character '>'
.
null
if the entity name is invalid
in this dialect of MXML.public abstract boolean isWhitespace(char c)
c
- The character.true
if the character is whitespace.public abstract boolean isWhitespace(String s)
s
- The string.public abstract String collapseWhitespace(String s, char replacementChar)
This method can be used to strip newlines, tabs, multiple spaces, etc. between words and replace them with a single space.
s
- The input String.replacementChar
- The character that replaces whitespace between
words.public abstract String trim(String s)
s
- A String.public abstract String[] splitAndTrim(String s)
s
- The input string.public abstract Boolean parseBoolean(FlexProject project, String s, EnumSet<MXMLDialect.TextParsingFlags> flags)
Boolean
value from a string.project
- The FlexProject
within which the MXML is being
parsed.s
- The string to be parsed.flags
- A set of flags controlling the text parsing.Boolean
representing the ActionScript
Boolean
, or null
.public abstract Integer parseInt(FlexProject project, String s, EnumSet<MXMLDialect.TextParsingFlags> flags)
int
value from a string.project
- The FlexProject
within which the MXML is being
parsed.s
- The string to be parsed.flags
- A set of flags controlling the text parsing.Integer
representing the ActionScript
int
, or null
.public abstract Long parseUint(FlexProject project, String s, EnumSet<MXMLDialect.TextParsingFlags> flags)
uint
value from a string.project
- The FlexProject
within which the MXML is being
parsed.s
- The string to be parsed.flags
- A set of flags controlling the text parsing.Long
representing the ActionScript
uint
, or null
.public abstract Number parseNumber(FlexProject project, String s, EnumSet<MXMLDialect.TextParsingFlags> flags)
Number
value from a string.project
- The FlexProject
within which the MXML is being
parsed.s
- The string to be parsed.flags
- A set of flags controlling the text parsing.Number
representing the ActionScript
Number
, or null
.public abstract String parseString(FlexProject project, String s, EnumSet<MXMLDialect.TextParsingFlags> flags)
String
value from a string.project
- The FlexProject
within which the MXML is being
parsed.s
- The string to be parsed.flags
- A set of flags controlling the text parsing.String
representing the ActionScript
String
, or null
.public abstract List<Object> parseArray(FlexProject project, String s, EnumSet<MXMLDialect.TextParsingFlags> flags)
Array
value from a string.project
- The FlexProject
within which the MXML is being
parsed.s
- The string to be parsed.flags
- A set of flags controlling the text parsing.List
of Java Object
instances
representing the elements of the ActionScript Array
, or
null
.public abstract Object parseObject(FlexProject project, String s, EnumSet<MXMLDialect.TextParsingFlags> flags)
project
- The FlexProject
within which the MXML is being
parsed.s
- The string to be parsed.flags
- A set of flags controlling the text parsing.Object
representing the ActionScript value,
or null
.Copyright © 2016 The Apache Software Foundation. All rights reserved.