@Test public void testDOMAsDTD() { String content = "<!ELEMENT"; DOMDocument xml = DOMParser.getInstance().parse(content, "test.xml", null); assertFalse(xml.isDTD()); DOMNode element = xml.getChild(0); assertTrue(element.isElement()); DOMDocument unknown = DOMParser.getInstance().parse(content, "test.unknown", null); assertFalse(unknown.isDTD()); DOMNode unknownElement = unknown.getChild(0); assertTrue(unknownElement.isElement()); DOMDocument dtd = DOMParser.getInstance().parse(content, "test.dtd", null); assertTrue(dtd.isDTD()); DOMNode dtdDocType = dtd.getChild(0); assertTrue(dtdDocType.isDoctype()); DOMNode dtdElementDecl = dtdDocType.getChild(0); assertTrue(dtdElementDecl.isDTDElementDecl()); DOMDocument ent = DOMParser.getInstance().parse(content, "test.ent", null); assertTrue(ent.isDTD()); DOMNode entDocType = ent.getChild(0); assertTrue(entDocType.isDoctype()); DOMNode entElementDecl = entDocType.getChild(0); assertTrue(entElementDecl.isDTDElementDecl()); DOMDocument mod = DOMParser.getInstance().parse(content, "test.mod", null); assertTrue(mod.isDTD()); DOMNode modDocType = mod.getChild(0); assertTrue(modDocType.isDoctype()); DOMNode modElemmodDecl = modDocType.getChild(0); assertTrue(modElemmodDecl.isDTDElementDecl()); }
public boolean isDTD() { String uri = this.getDocumentURI(); if (DOMUtils.isDTD(uri)) { return true; } return false; }
DOMDocument extends DOMNode implements Document { public boolean isDTD() { String uri = this.getDocumentURI(); if (DOMUtils.isDTD(uri)) { return true; } return false; } }
DOMDocument extends DOMNode implements Document { public boolean isDTD() { String uri = this.getDocumentURI(); if (DOMUtils.isDTD(uri)) { return true; } return false; } DOMDocument(TextDocument textDocument, URIResolverExtensionManager resolverExtensionManager); }
DOMDocument extends DOMNode implements Document { public boolean isDTD() { String uri = this.getDocumentURI(); if (DOMUtils.isDTD(uri)) { return true; } return false; } DOMDocument(TextDocument textDocument, URIResolverExtensionManager resolverExtensionManager); void setCancelChecker(CancelChecker cancelChecker); CancelChecker getCancelChecker(); List<DOMNode> getRoots(); Position positionAt(int offset); int offsetAt(Position position); String lineText(int lineNumber); String lineDelimiter(int lineNumber); LineIndentInfo getLineIndentInfo(int lineNumber); Range getElementNameRangeAt(int textOffset); @Override String getNamespaceURI(); String getText(); TextDocument getTextDocument(); boolean hasGrammar(); SchemaLocation getSchemaLocation(); boolean hasSchemaLocation(); NoNamespaceSchemaLocation getNoNamespaceSchemaLocation(); boolean hasNoNamespaceSchemaLocation(); boolean hasNamespaces(); String getSchemaInstancePrefix(); boolean hasSchemaInstancePrefix(); boolean hasProlog(); DOMNode getProlog(); boolean isBeforeProlog(int offset); boolean hasDTD(); boolean hasXMLModel(); List<XMLModel> getXMLModels(); boolean hasExternalGrammar(); Map<String, String> getExternalGrammarLocation(); String getExternalGrammarFromNamespaceURI(); DOMElement createElement(int start, int end); DOMCDATASection createCDataSection(int start, int end); DOMProcessingInstruction createProcessingInstruction(int start, int end); DOMComment createComment(int start, int end); DOMText createText(int start, int end); DOMDocumentType createDocumentType(int start, int end); @Override short getNodeType(); @Override String getNodeName(); @Override DOMElement getDocumentElement(); @Override DOMDocumentType getDoctype(); @Override DOMDocument getOwnerDocument(); @Override String getDocumentURI(); @Override void setDocumentURI(String documentURI); @Override DOMNode adoptNode(org.w3c.dom.Node source); @Override DOMAttr createAttribute(String name); @Override DOMAttr createAttributeNS(String namespaceURI, String qualifiedName); @Override CDATASection createCDATASection(String data); @Override DOMComment createComment(String data); @Override DocumentFragment createDocumentFragment(); @Override DOMElement createElement(String tagName); @Override DOMElement createElementNS(String namespaceURI, String qualifiedName); @Override EntityReference createEntityReference(String name); @Override DOMProcessingInstruction createProcessingInstruction(String target, String data); @Override DOMText createTextNode(String data); @Override DOMConfiguration getDomConfig(); @Override DOMElement getElementById(String elementId); @Override NodeList getElementsByTagName(String tagname); @Override NodeList getElementsByTagNameNS(String namespaceURI, String localName); @Override DOMImplementation getImplementation(); @Override String getInputEncoding(); @Override boolean getStrictErrorChecking(); @Override String getXmlEncoding(); @Override boolean getXmlStandalone(); @Override String getXmlVersion(); @Override DOMNode importNode(org.w3c.dom.Node importedNode, boolean deep); @Override void normalizeDocument(); @Override DOMNode renameNode(org.w3c.dom.Node n, String namespaceURI, String qualifiedName); @Override void setStrictErrorChecking(boolean strictErrorChecking); @Override void setXmlStandalone(boolean xmlStandalone); @Override void setXmlVersion(String xmlVersion); void resetGrammar(); URIResolverExtensionManager getResolverExtensionManager(); boolean isDTD(); boolean isWithinInternalDTD(int offset); Range getTrimmedRange(Range range); Range getTrimmedRange(int start, int end); Collection<DOMNode> findDTDAttrList(String elementName); String getSchemaPrefix(); }
DOMDocument extends DOMNode implements Document { public boolean isDTD() { String uri = this.getDocumentURI(); if (DOMUtils.isDTD(uri)) { return true; } return false; } DOMDocument(TextDocument textDocument, URIResolverExtensionManager resolverExtensionManager); void setCancelChecker(CancelChecker cancelChecker); CancelChecker getCancelChecker(); List<DOMNode> getRoots(); Position positionAt(int offset); int offsetAt(Position position); String lineText(int lineNumber); String lineDelimiter(int lineNumber); LineIndentInfo getLineIndentInfo(int lineNumber); Range getElementNameRangeAt(int textOffset); @Override String getNamespaceURI(); String getText(); TextDocument getTextDocument(); boolean hasGrammar(); SchemaLocation getSchemaLocation(); boolean hasSchemaLocation(); NoNamespaceSchemaLocation getNoNamespaceSchemaLocation(); boolean hasNoNamespaceSchemaLocation(); boolean hasNamespaces(); String getSchemaInstancePrefix(); boolean hasSchemaInstancePrefix(); boolean hasProlog(); DOMNode getProlog(); boolean isBeforeProlog(int offset); boolean hasDTD(); boolean hasXMLModel(); List<XMLModel> getXMLModels(); boolean hasExternalGrammar(); Map<String, String> getExternalGrammarLocation(); String getExternalGrammarFromNamespaceURI(); DOMElement createElement(int start, int end); DOMCDATASection createCDataSection(int start, int end); DOMProcessingInstruction createProcessingInstruction(int start, int end); DOMComment createComment(int start, int end); DOMText createText(int start, int end); DOMDocumentType createDocumentType(int start, int end); @Override short getNodeType(); @Override String getNodeName(); @Override DOMElement getDocumentElement(); @Override DOMDocumentType getDoctype(); @Override DOMDocument getOwnerDocument(); @Override String getDocumentURI(); @Override void setDocumentURI(String documentURI); @Override DOMNode adoptNode(org.w3c.dom.Node source); @Override DOMAttr createAttribute(String name); @Override DOMAttr createAttributeNS(String namespaceURI, String qualifiedName); @Override CDATASection createCDATASection(String data); @Override DOMComment createComment(String data); @Override DocumentFragment createDocumentFragment(); @Override DOMElement createElement(String tagName); @Override DOMElement createElementNS(String namespaceURI, String qualifiedName); @Override EntityReference createEntityReference(String name); @Override DOMProcessingInstruction createProcessingInstruction(String target, String data); @Override DOMText createTextNode(String data); @Override DOMConfiguration getDomConfig(); @Override DOMElement getElementById(String elementId); @Override NodeList getElementsByTagName(String tagname); @Override NodeList getElementsByTagNameNS(String namespaceURI, String localName); @Override DOMImplementation getImplementation(); @Override String getInputEncoding(); @Override boolean getStrictErrorChecking(); @Override String getXmlEncoding(); @Override boolean getXmlStandalone(); @Override String getXmlVersion(); @Override DOMNode importNode(org.w3c.dom.Node importedNode, boolean deep); @Override void normalizeDocument(); @Override DOMNode renameNode(org.w3c.dom.Node n, String namespaceURI, String qualifiedName); @Override void setStrictErrorChecking(boolean strictErrorChecking); @Override void setXmlStandalone(boolean xmlStandalone); @Override void setXmlVersion(String xmlVersion); void resetGrammar(); URIResolverExtensionManager getResolverExtensionManager(); boolean isDTD(); boolean isWithinInternalDTD(int offset); Range getTrimmedRange(Range range); Range getTrimmedRange(int start, int end); Collection<DOMNode> findDTDAttrList(String elementName); String getSchemaPrefix();  }