當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。