use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class TestCatalogRetrivalAndModelCreation method doCMTest.
private void doCMTest(String EXPECTED_PUBLICID) throws MalformedURLException, IOException {
ICatalog xmlCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
String resolved = xmlCatalog.resolvePublic(EXPECTED_PUBLICID, null);
ContentModelManager contentModelManager = ContentModelManager.getInstance();
CMDocument contentModel = contentModelManager.createCMDocument(resolved, null);
assertNotNull("expected to create content model for " + EXPECTED_PUBLICID, contentModel);
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class TestCatalogRetrivalAndModelCreation method doTest.
private void doTest(String EXPECTED_PUBLICID) throws MalformedURLException, IOException {
ICatalog xmlCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
String resolved = xmlCatalog.resolvePublic(EXPECTED_PUBLICID, null);
assertNotNull("expected to find " + EXPECTED_PUBLICID, resolved);
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class TestCatalogRetrivalAndModelCreation method testCatalog11DelegatePublic.
public void testCatalog11DelegatePublic() throws MalformedURLException, IOException {
ICatalog xmlCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
IDelegateCatalog publicDelegate = (IDelegateCatalog) xmlCatalog.createCatalogElement(IDelegateCatalog.DELEGATE_TYPE_PUBLIC);
// Ironically, we don't use WTP's Resolver when loading the catalog XML.
// Adding <!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.example.org/dtd/catalog.dtd">
// to the catalog below will make the loading fail...
File delegateCat = makeTempFile("delegatePublic", "<catalog xmlns=\"urn:oasis:names:tc:entity:xmlns:xml:catalog\"\r\n" + " prefer=\"public\">\r\n" + " <public publicId=\"-//Example//an example V1.0.0//EN\"\r\n" + " uri=\"file:///example.dtd\"/>\r\n" + "</catalog>");
publicDelegate.setStartString("-//Example//");
publicDelegate.setCatalogLocation(delegateCat.toURI().toString());
xmlCatalog.addCatalogElement(publicDelegate);
try {
String resolved = xmlCatalog.resolvePublic("-//Example//an example V1.0.0//EN", "example.dtd");
assertEquals("file:///example.dtd", resolved);
} finally {
xmlCatalog.removeCatalogElement(publicDelegate);
}
delegateCat.delete();
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class TestCatalogRetrivalAndModelCreation method testCatalog11SystemSuffix.
public void testCatalog11SystemSuffix() throws MalformedURLException, IOException {
ICatalog xmlCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
ISuffixEntry systemSuffix = (ISuffixEntry) xmlCatalog.createCatalogElement(ISuffixEntry.SUFFIX_TYPE_SYSTEM);
systemSuffix.setSuffix("XMLSchema.xsd");
systemSuffix.setURI(LOCAL_SCHEMA_FILE);
xmlCatalog.addCatalogElement(systemSuffix);
try {
String resolved = xmlCatalog.resolveSystem("http://www.w3.org/2001/XMLSchema.xsd");
assertEquals(LOCAL_SCHEMA_FILE, resolved);
} finally {
xmlCatalog.removeCatalogElement(systemSuffix);
}
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class TestCatalogRetrivalAndModelCreation method testCatalog11RewriteSystem.
public void testCatalog11RewriteSystem() throws MalformedURLException, IOException {
ICatalog xmlCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
IRewriteEntry systemSuffix = (IRewriteEntry) xmlCatalog.createCatalogElement(IRewriteEntry.REWRITE_TYPE_SYSTEM);
systemSuffix.setStartString("http://www.example.org/dtds/");
systemSuffix.setRewritePrefix(LOCAL_SCHEMA_DIR);
xmlCatalog.addCatalogElement(systemSuffix);
try {
String resolved = xmlCatalog.resolveSystem("http://www.example.org/dtds/example.dtd");
assertEquals(LOCAL_SCHEMA_DIR_REWRITTEN, resolved);
} finally {
xmlCatalog.removeCatalogElement(systemSuffix);
}
}
Aggregations