本文整理汇总了Java中org.w3c.dom.DocumentType.getInternalSubset方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentType.getInternalSubset方法的具体用法?Java DocumentType.getInternalSubset怎么用?Java DocumentType.getInternalSubset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.DocumentType
的用法示例。
在下文中一共展示了DocumentType.getInternalSubset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
/**
* Write.
*
* @param node
* the node
* @throws ShellException
* the shell exception
*/
protected void write(DocumentType node) throws ShellException {
printWriter.print("<!DOCTYPE "); //$NON-NLS-1$
printWriter.print(node.getName());
String publicId = node.getPublicId();
String systemId = node.getSystemId();
if (publicId != null) {
printWriter.print(" PUBLIC \""); //$NON-NLS-1$
printWriter.print(publicId);
printWriter.print("\" \""); //$NON-NLS-1$
printWriter.print(systemId);
printWriter.print('\"');
} else if (systemId != null) {
printWriter.print(" SYSTEM \""); //$NON-NLS-1$
printWriter.print(systemId);
printWriter.print('"');
}
String internalSubset = node.getInternalSubset();
if (internalSubset != null) {
printWriter.println(" ["); //$NON-NLS-1$
printWriter.print(internalSubset);
printWriter.print(']');
}
printWriter.println('>');
}
示例2: write
import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
protected void write(DocumentType node) throws ShellException {
printWriter.print("<!DOCTYPE "); //$NON-NLS-1$
printWriter.print(node.getName());
String publicId = node.getPublicId();
String systemId = node.getSystemId();
if (publicId != null) {
printWriter.print(" PUBLIC \""); //$NON-NLS-1$
printWriter.print(publicId);
printWriter.print("\" \""); //$NON-NLS-1$
printWriter.print(systemId);
printWriter.print('\"');
} else if (systemId != null) {
printWriter.print(" SYSTEM \""); //$NON-NLS-1$
printWriter.print(systemId);
printWriter.print('"');
}
String internalSubset = node.getInternalSubset();
if (internalSubset != null) {
printWriter.println(" ["); //$NON-NLS-1$
printWriter.print(internalSubset);
printWriter.print(']');
}
printWriter.println('>');
}
示例3: writeDocumentType
import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
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);
}
示例4: write
import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
protected void write(DocumentType node) throws ShellException {
printWriter.print("<!DOCTYPE "); //$NON-NLS-1$
printWriter.print(node.getName());
String publicId = node.getPublicId();
String systemId = node.getSystemId();
if (publicId != null) {
printWriter.print(" PUBLIC \""); //$NON-NLS-1$
printWriter.print(publicId);
printWriter.print("\" \""); //$NON-NLS-1$
printWriter.print(systemId);
printWriter.print('\"');
} else if (systemId != null) {
printWriter.print(" SYSTEM \""); //$NON-NLS-1$
printWriter.print(systemId);
printWriter.print('"');
}
String internalSubset = node.getInternalSubset();
if (internalSubset != null) {
printWriter.println(" ["); //$NON-NLS-1$
printWriter.print(internalSubset);
printWriter.print(']');
}
printWriter.println('>');
}
示例5: write
import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* @since TFP 1.0
*/
public void write (final Document document)
{
DocumentType doctype = document.getDoctype ();
output.print ("<?xml version=\"1.0\" encoding=\"" + getEncoding () + "\"?>");
if (doctype != null) {
output.print ("<!DOCTYPE " + doctype.getName ());
if (doctype.getPublicId () != null) {
output.print (" PUBLIC \"" + doctype.getPublicId () + "\"");
output.print (" \"" + doctype.getSystemId () +"\"");
}
else if (doctype.getSystemId () != null)
output.print (" SYSTEM \"" + doctype.getSystemId () + "\"");
if (doctype.getInternalSubset () != null) {
output.print (" [");
output.print (doctype.getInternalSubset ());
}
output.print (">");
}
write (document.getDocumentElement ());
}
示例6: write
import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* @since TFP 1.0
*/
public void write (Document document)
{
DocumentType doctype = document.getDoctype ();
output.println ("<?xml version=\"1.0\" encoding=\"" + getEncoding () + "\"?>");
if (doctype != null) {
output.print ("<!DOCTYPE " + doctype.getName ());
if (doctype.getPublicId () != null) {
output.print (" PUBLIC \"" + doctype.getPublicId () + "\"");
output.print (" \"" + doctype.getSystemId () +"\"");
}
else if (doctype.getSystemId () != null)
output.print (" SYSTEM \"" + doctype.getSystemId () + "\"");
if (doctype.getInternalSubset () != null) {
output.println (" [");
output.println (doctype.getInternalSubset ());
output.print ("]");
}
output.println (">");
}
write (document.getDocumentElement ());
}
示例7: doctypeDecl
import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
public void doctypeDecl(DocumentType node) throws XNIException {
/** Create new DocumentType node for the target. */
if (fDocumentImpl != null) {
DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
final String internalSubset = node.getInternalSubset();
/** Copy internal subset. */
if (internalSubset != null) {
((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
}
/** Copy entities. */
NamedNodeMap oldMap = node.getEntities();
NamedNodeMap newMap = docType.getEntities();
int length = oldMap.getLength();
for (int i = 0; i < length; ++i) {
Entity oldEntity = (Entity) oldMap.item(i);
EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
newEntity.setPublicId(oldEntity.getPublicId());
newEntity.setSystemId(oldEntity.getSystemId());
newEntity.setNotationName(oldEntity.getNotationName());
newMap.setNamedItem(newEntity);
}
/** Copy notations. */
oldMap = node.getNotations();
newMap = docType.getNotations();
length = oldMap.getLength();
for (int i = 0; i < length; ++i) {
Notation oldNotation = (Notation) oldMap.item(i);
NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
newNotation.setPublicId(oldNotation.getPublicId());
newNotation.setSystemId(oldNotation.getSystemId());
newMap.setNamedItem(newNotation);
}
append(docType);
}
}
示例8: serializeDocType
import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
/**
* Serializes a Document Type Node.
*
* @param node The Docuemnt Type Node to serialize
* @param bStart Invoked at the start or end of node. Default true.
*/
protected void serializeDocType(DocumentType node, boolean bStart)
throws SAXException {
// The DocType and internalSubset can not be modified in DOM and is
// considered to be well-formed as the outcome of successful parsing.
String docTypeName = node.getNodeName();
String publicId = node.getPublicId();
String systemId = node.getSystemId();
String internalSubset = node.getInternalSubset();
//DocumentType nodes are never passed to the filter
if (internalSubset != null && !"".equals(internalSubset)) {
if (bStart) {
try {
// The Serializer does not provide a way to write out the
// DOCTYPE internal subset via an event call, so we write it
// out here.
Writer writer = fSerializer.getWriter();
StringBuffer dtd = new StringBuffer();
dtd.append("<!DOCTYPE ");
dtd.append(docTypeName);
if (null != publicId) {
dtd.append(" PUBLIC \"");
dtd.append(publicId);
dtd.append('\"');
}
if (null != systemId) {
if (null == publicId) {
dtd.append(" SYSTEM \"");
} else {
dtd.append(" \"");
}
dtd.append(systemId);
dtd.append('\"');
}
dtd.append(" [ ");
dtd.append(fNewLine);
dtd.append(internalSubset);
dtd.append("]>");
dtd.append(fNewLine);
writer.write(dtd.toString());
writer.flush();
} catch (IOException e) {
throw new SAXException(Utils.messages.createMessage(
MsgKey.ER_WRITING_INTERNAL_SUBSET, null), e);
}
} // else if !bStart do nothing
} else {
if (bStart) {
if (fLexicalHandler != null) {
fLexicalHandler.startDTD(docTypeName, publicId, systemId);
}
} else {
if (fLexicalHandler != null) {
fLexicalHandler.endDTD();
}
}
}
}