Search in sources :

Example 16 with DTDElement

use of org.eclipse.wst.dtd.core.internal.emf.DTDElement in project webtools.sourceediting by eclipse.

the class DTDParserTest method testMultipleCommentParsing.

public void testMultipleCommentParsing() throws IOException {
    DTDUtil util = new DTDUtil();
    String sampleDTDpath = "/resources/dtdParserTest/sample.dtd";
    URL bundleURL = DTDCoreTestsPlugin.getDefault().getBundle().getEntry(sampleDTDpath);
    assertNotNull(sampleDTDpath + " not found in bundle", bundleURL);
    // Do not rely on Common URI Resolver to find the contents
    URL fileURL = FileLocator.toFileURL(bundleURL);
    util.parse(fileURL.toExternalForm());
    DTDFile dtdFile = util.getDTDFile();
    assertEquals(UNEXPECTED_FILE_CONTENTS, 1, dtdFile.getDTDContent().size());
    Object object = dtdFile.getDTDContent().get(0);
    assertTrue(UNEXPECTED_FILE_CONTENTS, object instanceof DTDElement);
    DTDElement dtdElement = (DTDElement) object;
    String comment = dtdElement.getComment();
    assertEquals("Comment value was not as expected", " line one \n line two ", comment);
}
Also used : DTDUtil(org.eclipse.wst.dtd.core.internal.emf.util.DTDUtil) DTDElement(org.eclipse.wst.dtd.core.internal.emf.DTDElement) URL(java.net.URL) DTDFile(org.eclipse.wst.dtd.core.internal.emf.DTDFile)

Aggregations

DTDElement (org.eclipse.wst.dtd.core.internal.emf.DTDElement)16 Iterator (java.util.Iterator)5 Collection (java.util.Collection)4 DTDElementReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent)4 DTDEntity (org.eclipse.wst.dtd.core.internal.emf.DTDEntity)3 DTDGroupContent (org.eclipse.wst.dtd.core.internal.emf.DTDGroupContent)3 Enumeration (java.util.Enumeration)2 Hashtable (java.util.Hashtable)2 Vector (java.util.Vector)2 DTDEmptyContent (org.eclipse.wst.dtd.core.internal.emf.DTDEmptyContent)2 DTDEntityReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDEntityReferenceContent)2 DTDFactory (org.eclipse.wst.dtd.core.internal.emf.DTDFactory)2 DTDGroupKind (org.eclipse.wst.dtd.core.internal.emf.DTDGroupKind)2 DTDObject (org.eclipse.wst.dtd.core.internal.emf.DTDObject)2 DTDOccurrenceType (org.eclipse.wst.dtd.core.internal.emf.DTDOccurrenceType)2 DTDPCDataContent (org.eclipse.wst.dtd.core.internal.emf.DTDPCDataContent)2 CMBasicNode (org.eclipse.wst.dtd.core.internal.saxparser.CMBasicNode)2 CMGroupNode (org.eclipse.wst.dtd.core.internal.saxparser.CMGroupNode)2 CMNode (org.eclipse.wst.dtd.core.internal.saxparser.CMNode)2 CMReferenceNode (org.eclipse.wst.dtd.core.internal.saxparser.CMReferenceNode)2