final String name = this.tagcontent
.toString();
if (attrs == null) {
attrs = new CAttr[2];
}
attrs[count++] = new CAttr(name, name,
null, null, true);
attrs[count - 1].needToDecode = false;
this.parseSTARTTag(tag, attrs, count,
indexSep);
this.tagcontent.reset();
has1stLetter = false;
continue;
}
continue;
} // end if
else if (CXmlParser
.VALID_XML11_FIRST_LETTERS(n)
|| (n == '=')) {
has1stLetter = false;
// attribute found
if (n != '=') {
this.tagcontent.append(n);
while ((ic = this.read()) != -1) {
n = (char) ic;
if ((n == ' ') || (n == '\r')
|| (n == '\n')
|| (n == '\t')
|| (n == '=') || (n == 160)) {
break;
} // end if
this.tagcontent.append(n);
}
}
// bon on a le nom
final String name = this.tagcontent
.toString();
this.tagcontent.reset();
if (ic == -1) {
if (attrs == null) {
attrs = new CAttr[1];
}
attrs[count++] = new CAttr(name, name,
null, null, true);
attrs[count - 1].needToDecode = false;
this.parseSTARTTag(tag, attrs, count,
indexSep);
break;
}
while ((n == ' ') || (n == '\r')
|| (n == '\n') || (n == '\t')
|| (n == 160)) {
if ((ic = this.read()) == -1) {
break;
}
n = (char) ic;
}
if (ic == -1) {
break;
}
if (n == '=') {
// go to read value
if ((ic = this.read()) == -1) {
break;
}
n = (char) ic;
while ((n == ' ') || (n == '\r')
|| (n == '\n') || (n == '\t')
|| (n == 160)) {
if ((ic = this.read()) == -1) {
break;
}
n = (char) ic;
}
if (ic == -1) {
break;
}
if (n == '\"') {
// read till next "
if ((ic = this.read()) == -1) {
break;
}
n = (char) ic;
boolean needToDecode = false;
if (n == '&') {
needToDecode = true;
}
while (n != '\"') {
this.tagcontent.append(n);
if ((ic = this.read()) == -1) {
break;
}
n = (char) ic;
if (n == '&') {
needToDecode = true;
}
}
if (attrs == null) {
attrs = new CAttr[2];
}
if (count == attrs.length) {
final CAttr[] nattrs = new CAttr[attrs.length * 2 + 2];
System.arraycopy(attrs, 0,
nattrs, 0, count);
attrs = nattrs;
}
attrs[count++] = new CAttr(name,
this.tagcontent.toString(),
null, null, true);
if (!needToDecode) {
attrs[count - 1].needToDecode = false;
}
this.tagcontent.reset();
continue;
} else if (n == '\'') {
// read till next '
if ((ic = this.read()) == -1) {
break;
}
n = (char) ic;
boolean needToDecode = false;
if (n == '&') {
needToDecode = true;
}
while (n != '\'') {
this.tagcontent.append(n);
if ((ic = this.read()) == -1) {
break;
}
n = (char) ic;
if (n == '&') {
needToDecode = true;
}
}
if (attrs == null) {
attrs = new CAttr[2];
}
if (count == attrs.length) {
final CAttr[] nattrs = new CAttr[attrs.length * 2 + 2];
System.arraycopy(attrs, 0,
nattrs, 0, count);
attrs = nattrs;
}
attrs[count++] = new CAttr(name,
this.tagcontent.toString(),
null, null, true);
if (!needToDecode) {
attrs[count - 1].needToDecode = false;
}
this.tagcontent.reset();
continue;
} else {
this.tagcontent.append(n);
boolean needToDecode = false;
if (n == '&') {
needToDecode = true;
}
while ((ic = this.read()) != -1) {
n = (char) ic;
if ((n == ' ') || (n == '\r')
|| (n == '\n')
|| (n == '\t')
|| (n == '>')
|| (n == 160)) {
break;
}
this.tagcontent.append(n);
if (n == '&') {
needToDecode = true;
}
}
if (attrs == null) {
attrs = new CAttr[2];
}
if (count == attrs.length) {
final CAttr[] nattrs = new CAttr[attrs.length * 2 + 2];
System.arraycopy(attrs, 0,
nattrs, 0, count);
attrs = nattrs;
}
attrs[count++] = new CAttr(name,
this.tagcontent.toString(),
null, null, true);
if (!needToDecode) {
attrs[count - 1].needToDecode = false;
}
this.tagcontent.reset();
if (n == '>') {
break;
}
continue;
}
} else if (n == '/') {
if (attrs == null) {
attrs = new CAttr[1];
}
if (count == attrs.length) {
final CAttr[] nattrs = new CAttr[attrs.length * 2 + 2];
System.arraycopy(attrs, 0, nattrs,
0, count);
attrs = nattrs;
}
attrs[count++] = new CAttr(name, name,
null, null, true);
attrs[count - 1].needToDecode = false;
this.parseEMPTYTag(tag, attrs, count,
indexSep);
ic = this.read();
break;
} else if (n == '<') {
// struct.hasprev = true;
this.iprev = n;
break;
} else {
if (attrs == null) {
attrs = new CAttr[2];
}
if (count == attrs.length) {
final CAttr[] nattrs = new CAttr[attrs.length * 2 + 2];
System.arraycopy(attrs, 0, nattrs,
0, count);
attrs = nattrs;
}
attrs[count++] = new CAttr(name, name,
null, null, true);
// struct.hasprev = true;
this.iprev = n;
continue;
}