private void writeDocumentType(DocumentType docType, Writer writer, int depth) throws IOException { String publicId = docType.getPublicId(); String internalSubset = docType.getInternalSubset(); for (int i = 0; i < depth; ++i) { writer.append(' '); } writer.append("<!DOCTYPE ").append(docType.getName()); if (publicId != null) { writer.append(" PUBLIC '").append(publicId).append("' "); } else { writer.write(" SYSTEM "); } writer.append("'").append(docType.getSystemId()).append("'"); if (internalSubset != null) { writer.append(" [").append(internalSubset).append("]"); } writer.append('>').append(lineSeparator); }
String internalSubset = doctype.getInternalSubset(); if (internalSubset == null) { internalSubset = "";
buf.append('"').append(dt.getSystemId()).append('"'); if (dt.getInternalSubset() != null) { buf.append(" [").append(dt.getInternalSubset()).append(']');
String publicId = node.getPublicId(); String systemId = node.getSystemId(); String internalSubset = node.getInternalSubset();
String internalSubset = dt.getInternalSubset (); if (internalSubset != null) writer.write (" [\n" + internalSubset + "]");
String publicId = node.getPublicId(); String systemId = node.getSystemId(); String internalSubset = node.getInternalSubset();
buf.append(" \"").append(dt.getSystemId()).append('"'); if (dt.getInternalSubset() != null) { buf.append(" [").append(dt.getInternalSubset()).append(']');
String internalSubset = pDoctype.getInternalSubset(); if (!StringUtil.isEmpty(internalSubset)) { pOut.print(" [ ");
/** * This will build a JDOM Element from an existing DOM Element * * @param doctype <code> org.w3c.dom.Element</code> object * @return <code>Element</code> - JDOM Element object * @since JDOM2 */ public org.jdom2.DocType build(org.w3c.dom.DocumentType doctype) { String publicID = doctype.getPublicId(); String systemID = doctype.getSystemId(); String internalDTD = doctype.getInternalSubset(); DocType docType = factory.docType(doctype.getName()); docType.setPublicID(publicID); docType.setSystemID(systemID); docType.setInternalSubset(internalDTD); return docType; }
public String getInternalSubset() { return _delegate.getInternalSubset(); }
public String getText() { switch (event) { case DTD: return ((DocumentType)node).getInternalSubset(); case ENTITY_REFERENCE: // DOM only gives access to the parsed replacement value, but StAX returns // the unparsed replacement value return null; default: return internalGetText(); } }
public String normalize(String content) throws Exception { if (content == null || content.trim().length() == 0) { return null; } else { return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( new InputSource(new StringReader("<!DOCTYPE root [" + content + "]><root/>"))).getDoctype().getInternalSubset(); } } };
public Object normalize(Object value) throws Exception { String content = (String)value; if (content == null || content.trim().length() == 0) { return null; } else { return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( new InputSource(new StringReader("<!DOCTYPE root [" + content + "]><root/>"))).getDoctype().getInternalSubset(); } } };
public String getText() { switch (event) { case DTD: return ((DocumentType)node).getInternalSubset(); case ENTITY_REFERENCE: // DOM only gives access to the parsed replacement value, but StAX returns // the unparsed replacement value return null; default: return internalGetText(); } }
public String getText() { switch (event) { case DTD: return ((DocumentType)node).getInternalSubset(); case ENTITY_REFERENCE: // DOM only gives access to the parsed replacement value, but StAX returns // the unparsed replacement value return null; default: return internalGetText(); } }
private void writeDocumentType(DocumentType docType, Writer writer, int depth) throws IOException { String publicId = docType.getPublicId(); String internalSubset = docType.getInternalSubset(); for (int i = 0; i < depth; ++i) { writer.append(' '); } writer.append("<!DOCTYPE ").append(docType.getName()); if (publicId != null) { writer.append(" PUBLIC '").append(publicId).append("' "); } else { writer.write(" SYSTEM "); } writer.append("'").append(docType.getSystemId()).append("'"); if (internalSubset != null) { writer.append(" [").append(internalSubset).append("]"); } writer.append('>').append(lineSeparator); }
private void writeDocumentType(DocumentType docType, Writer writer, int depth) throws IOException { String publicId = docType.getPublicId(); String internalSubset = docType.getInternalSubset(); for (int i = 0; i < depth; ++i) { writer.append(' '); } writer.append("<!DOCTYPE ").append(docType.getName()); if (publicId != null) { writer.append(" PUBLIC '").append(publicId).append("' "); } else { writer.write(" SYSTEM "); } writer.append("'").append(docType.getSystemId()).append("'"); if (internalSubset != null) { writer.append(" [").append(internalSubset).append("]"); } writer.append('>').append(lineSeparator); }
protected void runTest() throws Throwable { Document document = dbf.newDocumentBuilder().parse(TestWithParser1.class.getResource("test1.xml").toString()); DocumentType doctype = document.getDoctype(); assertEquals("root", doctype.getName()); assertNull(doctype.getPublicId()); assertNull(doctype.getSystemId()); assertEquals("<!ELEMENT root (#PCDATA)>", doctype.getInternalSubset().trim()); } }
protected void runTest() throws Throwable { Document document = dbf.newDocumentBuilder().parse(TestWithParser2.class.getResource("test2.xml").toString()); DocumentType doctype = document.getDoctype(); assertEquals("root", doctype.getName()); assertEquals("dummy", doctype.getPublicId()); assertEquals("test.dtd", doctype.getSystemId()); assertNull(doctype.getInternalSubset()); } }
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentType docType; String internal; doc = (Document) load("staff2", false); docType = doc.getDoctype(); internal = docType.getInternalSubset(); assertNull("internalSubsetNull", internal); } /**