/** * Create a new doctype element. * @param name the doctype's name * @param publicId the doctype's public ID * @param systemId the doctype's system ID * @param baseUri unused * @deprecated */ public DocumentType(String name, String publicId, String systemId, String baseUri) { attr(NAME, name); attr(PUBLIC_ID, publicId); if (has(PUBLIC_ID)) { attr(PUB_SYS_KEY, PUBLIC_KEY); } attr(SYSTEM_ID, systemId); }
DocumentType doctype = new DocumentType("html", "", "", document.baseUri()); document.child(0).before(doctype);
void insert(Token.Doctype d) { DocumentType doctypeNode = new DocumentType(settings.normalizeTag(d.getName()), d.getPublicIdentifier(), d.getSystemIdentifier()); doctypeNode.setPubSysKey(d.getPubSysKey()); insertNode(doctypeNode); }
DocumentType html5doc = new DocumentType("html", "", "", ""); doctype.replaceWith(html5doc);
public void setPubSysKey(String value) { if (value != null) attr(PUB_SYS_KEY, value); }
async.parallel({ type: function(callback) { var type = new DocumentType({...}); type.save(function(err) {callback(null, type)}); }, document: function(callback) { var document = new Document({...}); document.save(function(err) {callback(null, document)}); } }, function(err, results) { results.document.doctype = results.type.id; results.document.save(); DocumentType.update( {_id: results.type}, {'$addToSet': {documents: results.document.id}}, function(err) {} ); });
boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { // todo: parse error check on expected doctypes // todo: quirk state check on doctype ids Token.Doctype d = t.asDoctype(); DocumentType doctype = new DocumentType( tb.settings.normalizeTag(d.getName()), d.getPublicIdentifier(), d.getSystemIdentifier()); doctype.setPubSysKey(d.getPubSysKey()); tb.getDocument().appendChild(doctype); if (d.isForceQuirks()) tb.getDocument().quirksMode(Document.QuirksMode.quirks); tb.transition(BeforeHtml); } else { // todo: check not iframe srcdoc tb.transition(BeforeHtml); return tb.process(t); // re-process token } return true; } },
/** * Create a new doctype element. * @param name the doctype's name * @param publicId the doctype's public ID * @param systemId the doctype's system ID * @param baseUri unused * @deprecated */ public DocumentType(String name, String pubSysKey, String publicId, String systemId, String baseUri) { attr(NAME, name); if (pubSysKey != null) { attr(PUB_SYS_KEY, pubSysKey); } attr(PUBLIC_ID, publicId); attr(SYSTEM_ID, systemId); } public void setPubSysKey(String value) {
DocumentType docType = new DocumentType("html", "", "", ""); doc.appendChild(docType); Element html = doc.createElement("html");
@Override void outerHtmlHead(Appendable accum, int depth, Document.OutputSettings out) throws IOException { if (out.syntax() == Syntax.html && !has(PUBLIC_ID) && !has(SYSTEM_ID)) { // looks like a html5 doctype, go lowercase for aesthetics accum.append("<!doctype"); } else { accum.append("<!DOCTYPE"); } if (has(NAME)) accum.append(" ").append(attr(NAME)); if (has(PUB_SYS_KEY)) accum.append(" ").append(attr(PUB_SYS_KEY)); if (has(PUBLIC_ID)) accum.append(" \"").append(attr(PUBLIC_ID)).append('"'); if (has(SYSTEM_ID)) accum.append(" \"").append(attr(SYSTEM_ID)).append('"'); accum.append('>'); }
private boolean has(final String attribute) { return !StringUtil.isBlank(attr(attribute)); } }
// convert the JSON into an array $data = json_decode($request->getContent(), true); // instantiate the new Document $document= new Document(); // create the empty Document form $form = $this->createForm(new DocumentType(), $document); // bind the array (of Document fields) to the form, to populate it $form->bind($data); // now validate the form if($form->isValid()){ // business as usual }
/** * Create a new doctype element. * @param name the doctype's name * @param publicId the doctype's public ID * @param systemId the doctype's system ID */ public DocumentType(String name, String publicId, String systemId) { Validate.notNull(name); Validate.notNull(publicId); Validate.notNull(systemId); attr(NAME, name); attr(PUBLIC_ID, publicId); if (has(PUBLIC_ID)) { attr(PUB_SYS_KEY, PUBLIC_KEY); } attr(SYSTEM_ID, systemId); }
void insert(Doctype d) { DocumentType doctypeNode = new DocumentType(d.getName(), d.getPublicIdentifier(), d.getSystemIdentifier(), this.baseUri); this.insertNode(doctypeNode); }
static Document getBootstrapPage(BootstrapContext context) { Document document = new Document(""); DocumentType doctype = new DocumentType("html", "", "", document.baseUri()); document.appendChild(doctype);
boolean process(Token t, Asta4DTagSupportHtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { // todo: parse error check on expected doctypes // todo: quirk state check on doctype ids Token.Doctype d = t.asDoctype(); DocumentType doctype = new DocumentType(d.getName(), d.getPublicIdentifier(), d.getSystemIdentifier(), tb.getBaseUri()); tb.getDocument().appendChild(doctype); if (d.isForceQuirks()) tb.getDocument().quirksMode(Document.QuirksMode.quirks); tb.transition(BeforeHtml); } else { // todo: check not iframe srcdoc tb.transition(BeforeHtml); return tb.process(t); // re-process token } return true; } },