final static public Attribute[] parse(String text) {
List<Attribute> list = new ArrayList<Attribute>();
text = trimText(text);
RefsDecoder refsDecoder = new RefsDecoder();
while(text.length() > 0) {
Object [] components = getName(text);
if(components == null) return list.toArray(new Attribute[list.size()]);
String name = (String)components[0];
text = (String)components[1];
if(components.length > 2) {
list.add(new Attribute(name, null));
continue;
}
String value = "";
char mark = '\"';
if(text.length() > 0) {
components = getValue(text);
value = (String)components[0];
// System.out.println(" ========== > "+ value);
text = (String)components[1];
mark = (Character)components[2];
}
if(mark != '\"' && mark != '\'') mark = '\"';
if(value.indexOf(REF_START) > -1) {
value = new String(refsDecoder.decode(value.toCharArray()));
}
list.add(new Attribute(name, value));
}
return list.toArray(new Attribute[list.size()]);
}