use of org.eclipse.wst.dtd.core.internal.emf.util.DTDUtil in project webtools.sourceediting by eclipse.
the class DTDImpl method buildDTDModel.
public static DTDFile buildDTDModel(String uri) {
DTDUtil dtdUtil = new DTDUtil();
dtdUtil.setexpandEntityReferences(true);
dtdUtil.parse(new ResourceSetImpl(), uri);
return dtdUtil.getDTDFile();
}
use of org.eclipse.wst.dtd.core.internal.emf.util.DTDUtil 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);
}
Aggregations