use of nu.validator.saxtree.TreeParser in project validator by validator.
the class MessageEmitterAdapter method elaborateContentModelandContext.
private void elaborateContentModelandContext(Name parent, Name child) throws SAXException {
DocumentFragment contentModelDds = spec.contentModelDescription(parent);
DocumentFragment contextDds = spec.contextDescription(child);
if (contentModelDds != null || contextDds != null) {
ContentHandler ch = emitter.startElaboration();
if (ch != null) {
TreeParser treeParser = new TreeParser(ch, null);
XhtmlSaxEmitter xhtmlSaxEmitter = new XhtmlSaxEmitter(ch);
xhtmlSaxEmitter.startElement("dl");
if (contextDds != null) {
emitContextDt(xhtmlSaxEmitter, child);
treeParser.parse(contextDds);
}
if (contentModelDds != null) {
emitContentModelDt(xhtmlSaxEmitter, parent);
treeParser.parse(contentModelDds);
}
xhtmlSaxEmitter.endElement("dl");
}
emitter.endElaboration();
}
}
use of nu.validator.saxtree.TreeParser in project validator by validator.
the class MessageEmitterAdapter method elaborateElementSpecificAttributes.
private void elaborateElementSpecificAttributes(Name elt, Name attribute) throws SAXException {
if ("input".equals(elt.getLocalName())) {
ContentHandler ch = emitter.startElaboration();
if (ch != null) {
XhtmlSaxEmitter xhtmlSaxEmitter = new XhtmlSaxEmitter(ch);
elaborateInputAttributes(xhtmlSaxEmitter, elt, attribute);
}
emitter.endElaboration();
} else {
DocumentFragment dds = spec.elementSpecificAttributesDescription(elt);
if (dds != null) {
ContentHandler ch = emitter.startElaboration();
if (ch != null) {
TreeParser treeParser = new TreeParser(ch, null);
XhtmlSaxEmitter xhtmlSaxEmitter = new XhtmlSaxEmitter(ch);
xhtmlSaxEmitter.startElement("dl");
emitElementSpecificAttributesDt(xhtmlSaxEmitter, elt);
treeParser.parse(dds);
xhtmlSaxEmitter.endElement("dl");
}
emitter.endElaboration();
}
}
}
use of nu.validator.saxtree.TreeParser in project validator by validator.
the class MessageEmitterAdapter method elaborateContentModel.
/**
* @param elt
* @throws SAXException
*/
private void elaborateContentModel(Name elt) throws SAXException {
DocumentFragment dds = spec.contentModelDescription(elt);
if (dds != null) {
ContentHandler ch = emitter.startElaboration();
if (ch != null) {
TreeParser treeParser = new TreeParser(ch, null);
XhtmlSaxEmitter xhtmlSaxEmitter = new XhtmlSaxEmitter(ch);
xhtmlSaxEmitter.startElement("dl");
emitContentModelDt(xhtmlSaxEmitter, elt);
treeParser.parse(dds);
xhtmlSaxEmitter.endElement("dl");
}
emitter.endElaboration();
}
}
use of nu.validator.saxtree.TreeParser in project validator by validator.
the class MessageEmitterAdapter method elaborateDatatypes.
private void elaborateDatatypes(Map<String, DatatypeException> map) throws SAXException {
Set<DocumentFragment> fragments = new HashSet<>();
for (Map.Entry<String, DatatypeException> entry : map.entrySet()) {
DatatypeException ex = entry.getValue();
if (ex instanceof Html5DatatypeException) {
Html5DatatypeException ex5 = (Html5DatatypeException) ex;
DocumentFragment fragment = HTML5_DATATYPE_ADVICE.get(ex5.getDatatypeClass());
if (fragment != null) {
fragments.add(fragment);
}
}
}
if (!fragments.isEmpty()) {
ContentHandler ch = emitter.startElaboration();
if (ch != null) {
TreeParser treeParser = new TreeParser(ch, null);
XhtmlSaxEmitter xhtmlSaxEmitter = new XhtmlSaxEmitter(ch);
xhtmlSaxEmitter.startElement("dl");
for (DocumentFragment fragment : fragments) {
treeParser.parse(fragment);
}
xhtmlSaxEmitter.endElement("dl");
}
emitter.endElaboration();
}
}
Aggregations