String name = attributes.getValue("name");
if (name != null)
{
name = name.trim();
if (name.length() <= 0)
throw new MessageException("Array item names cannot be the empty string.");
char c = name.charAt(0);
if (!(Character.isLetterOrDigit(c) || c == '_'))
throw new MessageException("Invalid item name: " + name +
". Array item names must start with a letter, a digit or the underscore '_' character.");
}
else
{
throw new MessageException("Array item must have a name attribute.");
}
//Check that we're expecting an ECMA array
Object o = objectStack.peek();
if (!(o instanceof Map))
{
throw new MessageException("Unexpected array item name: " + name +
". Please set the ecma attribute to 'true'.");
}
arrayPropertyStack.push(name);
}