/** * NON-DOM * Factory method; creates a DocumentType having this Document * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building * DTD information unspecified.) * * @param qualifiedName * @param publicID * @param systemID * * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where * DTDs are not permitted. (HTML not yet implemented.) */ public DocumentType createDocumentType(String qualifiedName, String publicID, String systemID) throws DOMException { return new DocumentTypeImpl(this, qualifiedName, publicID, systemID); } // createDocumentType(String):DocumentType
/** * NON-DOM: Access the collection of ElementDefinitions. * @see ElementDefinitionImpl */ public NamedNodeMap getElements() { if (needsSyncChildren()) { synchronizeChildren(); } return elements; }
if (needsSyncData()) { synchronizeData(); if ((getPublicId() == null && argDocType.getPublicId() != null) || (getPublicId() != null && argDocType.getPublicId() == null) || (getSystemId() == null && argDocType.getSystemId() != null) || (getSystemId() != null && argDocType.getSystemId() == null) || (getInternalSubset() == null && argDocType.getInternalSubset() != null) || (getInternalSubset() != null && argDocType.getInternalSubset() == null)) { return false; if (getPublicId() != null) { if (!getPublicId().equals(argDocType.getPublicId())) { return false; if (getSystemId() != null) { if (!getSystemId().equals(argDocType.getSystemId())) { return false; if (getInternalSubset() != null) { if (!getInternalSubset().equals(argDocType.getInternalSubset())) { return false;
srcdoctype.getPublicId(), srcdoctype.getSystemId()); newdoctype.setInternalSubset(srcdoctype.getInternalSubset()); NamedNodeMap tmap = newdoctype.getEntities(); if(smap != null) { for(int i = 0; i < smap.getLength(); i++) { tmap = newdoctype.getNotations(); if (smap != null) { for(int i = 0; i < smap.getLength(); i++) {
/** Get the default attributes. */ protected NamedNodeMapImpl getDefaultAttributes() { DocumentTypeImpl doctype = (DocumentTypeImpl) ownerDocument.getDoctype(); if (doctype == null) { return null; } ElementDefinitionImpl eldef = (ElementDefinitionImpl)doctype.getElements() .getNamedItem(getNodeName()); if (eldef == null) { return null; } return (NamedNodeMapImpl) eldef.getAttributes(); } // getDefaultAttributes()
break; NamedNodeMap entities = docType.getEntities(); Node entityNode = entities.getNamedItem(node.getNodeName()); if (entityNode == null) {
/** NON-DOM Get the number associated with this doctype. */ protected int getNodeNumber() { // If the doctype has a document owner, get the node number // relative to the owner doc if (getOwnerDocument()!=null) return super.getNodeNumber(); // The doctype is disconnected and not associated with any document. // Assign the doctype a number relative to the implementation. if (doctypeNumber==0) { CoreDOMImplementationImpl cd = (CoreDOMImplementationImpl)CoreDOMImplementationImpl.getDOMImplementation(); doctypeNumber = cd.assignDocTypeNumber(); } return doctypeNumber; }
NamedNodeMap elements = ((DocumentTypeImpl)fDocumentType).getElements (); ElementDefinitionImpl elementDef = (ElementDefinitionImpl)elements.getNamedItem (elementName); if (elementDef == null) { elementDef = fDocumentImpl.createElementDefinition (elementName); ((DocumentTypeImpl)fDocumentType).getElements ().setNamedItem (elementDef);
/** * Introduced in DOM Level 2. <p> * * Creates an empty DocumentType node. * * @param qualifiedName The qualified name of the document type to be created. * @param publicID The document type public identifier. * @param systemID The document type system identifier. * @since WD-DOM-Level-2-19990923 */ public DocumentType createDocumentType( String qualifiedName, String publicID, String systemID) { // REVISIT: this might allow creation of invalid name for DOCTYPE // xmlns prefix. // also there is no way for a user to turn off error checking. checkQName(qualifiedName); return new DocumentTypeImpl(null, qualifiedName, publicID, systemID); }
/** * Access the collection of Notations defined in the DTD. A * notation declares, by name, the format of an XML unparsed entity * or is used to formally declare a Processing Instruction target. */ public NamedNodeMap getNotations() { if (needsSyncChildren()) { synchronizeChildren(); } return notations; }
public MathML(String qualifiedName, String publicID, String systemID) { this(new CoreDocumentImpl()); CoreDocumentImpl document = (CoreDocumentImpl) document(); document.setXmlEncoding("utf-8"); document.appendChild(new DocumentTypeImpl(document, qualifiedName, publicID, systemID)); }
/** * Access the collection of general Entities, both external and * internal, defined in the DTD. For example, in: * <p> * <pre> * <!doctype example SYSTEM "ex.dtd" [ * <!ENTITY foo "foo"> * <!ENTITY bar "bar"> * <!ENTITY % baz "baz"> * ]> * </pre> * <p> * The Entities map includes foo and bar, but not baz. It is promised that * only Nodes which are Entities will exist in this NamedNodeMap. * <p> * For HTML, this will always be null. * <p> * Note that "built in" entities such as & and < should be * converted to their actual characters before being placed in the DOM's * contained text, and should be converted back when the DOM is rendered * as XML or HTML, and hence DO NOT appear here. */ public NamedNodeMap getEntities() { if (needsSyncChildren()) { synchronizeChildren(); } return entities; }
protected DocumentImpl getDocumentImpl() { DocumentTypeImpl docType = new DocumentTypeImpl(null, "database", null, getSystemId()); DocumentImpl doc = new DocumentImpl(docType); doc.appendChild(doc.createComment(" " + getComment() + " ")); return doc; }
/** * NON-DOM: Subclassed to flip the entities' and notations' readonly switch * as well. * @see NodeImpl#setReadOnly */ public void setReadOnly(boolean readOnly, boolean deep) { if (needsSyncChildren()) { synchronizeChildren(); } super.setReadOnly(readOnly, deep); // set read-only property elements.setReadOnly(readOnly, true); entities.setReadOnly(readOnly, true); notations.setReadOnly(readOnly, true); } // setReadOnly(boolean,boolean)
/** * Return the XML Document object that we will serialize to disk */ protected DocumentImpl getDocument(final TableHelper helper, final String tableName) throws SQLException { // Generate the document type DocumentTypeImpl docType = new DocumentTypeImpl(null, "dataset", null, getSystemId()); // Generate an empty document DocumentImpl doc = new DocumentImpl(docType); // Append a comment doc.appendChild(doc.createComment(" " + getComment() + " ")); // Extract the data from the table Element datasetNode = getDatasetNode(helper, doc, tableName); if (datasetNode == null) { // There was no data (zero rows), we are done return null; } // Add the dataset to the document doc.appendChild(datasetNode); // Return what we found return doc; }