当前位置: 首页>>代码示例>>Java>>正文


Java DocumentType.getInternalSubset方法代码示例

本文整理汇总了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('>');
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:34,代码来源:DomWriter.java

示例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('>');
}
 
开发者ID:ajtdnyy,项目名称:PackagePlugin,代码行数:26,代码来源:DomWriter.java

示例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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:DOMSerializer.java

示例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('>');
}
 
开发者ID:funny5258,项目名称:autocode,代码行数:26,代码来源:DomWriter.java

示例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 ());
}
 
开发者ID:handcoded,项目名称:fpml-toolkit-java,代码行数:29,代码来源:CompactWriter.java

示例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 ());
}
 
开发者ID:handcoded,项目名称:fpml-toolkit-java,代码行数:30,代码来源:NestedWriter.java

示例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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:DOMResultBuilder.java

示例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();
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:75,代码来源:DOM3TreeWalker.java


注:本文中的org.w3c.dom.DocumentType.getInternalSubset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。