use of com.thaiopensource.xml.util.Name in project validator by validator.
the class MessageEmitterAdapter method elaboration.
private void elaboration(Exception e) throws SAXException {
if (!(e instanceof AbstractValidationException || e instanceof VnuBadAttrValueException || e instanceof VnuBadElementNameException || e instanceof DatatypeMismatchException)) {
return;
}
if (e instanceof ImpossibleAttributeIgnoredException) {
ImpossibleAttributeIgnoredException ex = (ImpossibleAttributeIgnoredException) e;
Name elt = ex.getCurrentElement();
elaborateElementSpecificAttributes(elt, ex.getAttributeName());
} else if (e instanceof OnlyTextNotAllowedException) {
OnlyTextNotAllowedException ex = (OnlyTextNotAllowedException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof OutOfContextElementException) {
OutOfContextElementException ex = (OutOfContextElementException) e;
Name parent = ex.getParent();
Name child = ex.getCurrentElement();
elaborateContentModelandContext(parent, child);
} else if (e instanceof RequiredAttributesMissingException) {
RequiredAttributesMissingException ex = (RequiredAttributesMissingException) e;
Name elt = ex.getCurrentElement();
elaborateElementSpecificAttributes(elt);
} else if (e instanceof RequiredAttributesMissingOneOfException) {
RequiredAttributesMissingOneOfException ex = (RequiredAttributesMissingOneOfException) e;
Name elt = ex.getCurrentElement();
elaborateElementSpecificAttributes(elt);
} else if (e instanceof RequiredElementsMissingException) {
RequiredElementsMissingException ex = (RequiredElementsMissingException) e;
Name elt = ex.getParent();
elaborateContentModel(elt);
} else if (e instanceof RequiredElementsMissingOneOfException) {
RequiredElementsMissingOneOfException ex = (RequiredElementsMissingOneOfException) e;
Name elt = ex.getParent();
elaborateContentModel(elt);
} else if (e instanceof StringNotAllowedException) {
StringNotAllowedException ex = (StringNotAllowedException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof TextNotAllowedException) {
TextNotAllowedException ex = (TextNotAllowedException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof UnfinishedElementException) {
UnfinishedElementException ex = (UnfinishedElementException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof UnfinishedElementOneOfException) {
UnfinishedElementOneOfException ex = (UnfinishedElementOneOfException) e;
Name elt = ex.getCurrentElement();
elaborateContentModel(elt);
} else if (e instanceof UnknownElementException) {
UnknownElementException ex = (UnknownElementException) e;
Name elt = ex.getParent();
elaborateContentModel(elt);
} else if (e instanceof BadAttributeValueException) {
BadAttributeValueException ex = (BadAttributeValueException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
} else if (e instanceof VnuBadAttrValueException) {
VnuBadAttrValueException ex = (VnuBadAttrValueException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
} else if (e instanceof VnuBadElementNameException) {
VnuBadElementNameException ex = (VnuBadElementNameException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
} else if (e instanceof DatatypeMismatchException) {
DatatypeMismatchException ex = (DatatypeMismatchException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
} else if (e instanceof StringNotAllowedException) {
StringNotAllowedException ex = (StringNotAllowedException) e;
Map<String, DatatypeException> map = ex.getExceptions();
elaborateDatatypes(map);
}
}
use of com.thaiopensource.xml.util.Name in project validator by validator.
the class Html5SpecBuilder method characters.
/**
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
*/
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
switch(state) {
case AWAITING_HEADING:
break;
case IN_H4:
referenceText.append(ch, start, length);
if (nameText.length() != 0) {
Matcher m = THE.matcher(referenceText);
if (m.matches()) {
String ln = nameText.toString().intern();
if ("" == ln) {
throw new SAXParseException("Malformed spec: no element " + currentName, locator);
}
currentName = new Name(NS, ln);
if (!urisByElement.containsKey(currentName)) {
if (currentId == null) {
state = State.AWAITING_HEADING;
// throw new SAXParseException(
// "Malformed spec: no element id.", locator);
}
urisByElement.put(currentName, SPEC_LINK_URI + "#" + currentId);
}
}
}
break;
case IN_CODE_IN_H4:
nameText.append(ch, start, length);
break;
case AWAITING_ELEMENT_DL:
break;
case IN_ELEMENT_DL_START:
break;
case IN_CATEGORIES_DT:
case IN_CONTEXT_DT:
case IN_CONTENT_MODEL_DT:
case IN_TAG_OMISSION_DT:
case IN_ATTRIBUTES_DT:
referenceText.append(ch, start, length);
break;
case CAPTURING_CATEGORIES_DDS:
case CAPTURING_CONTEXT_DDS:
case CAPTURING_CONTENT_MODEL_DDS:
case CAPTURING_TAG_OMISSION_DDS:
case CAPTURING_ATTRIBUTES_DDS:
if (ignoreTextNodes) {
ignoreTextNodes = false;
} else {
fragmentBuilder.characters(ch, start, length);
}
break;
}
}
Aggregations