use of org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog in project webtools.sourceediting by eclipse.
the class BugFixesTest method testInvalidSchemaWithNamespaceInCatalog.
/**
* Test /BugFixes/XSDRegisteredWithCatalog/InvalidSchemaWithNamespaceInCatalog.xsd
*/
public void testInvalidSchemaWithNamespaceInCatalog() {
String testname = "InvalidSchemaWithNamespaceInCatalog";
String testfile = PLUGIN_ABSOLUTE_PATH + SAMPLES_DIR + BUGFIXES_DIR + "XSDRegisteredWithCatalog/" + testname + ".xsd";
String loglocation = PLUGIN_ABSOLUTE_PATH + GENERATED_RESULTS_DIR + BUGFIXES_DIR + "XSDRegisteredWithCatalog/" + testname + ".xsd-log";
String idealloglocation = PLUGIN_ABSOLUTE_PATH + IDEAL_RESULTS_DIR + BUGFIXES_DIR + "XSDRegisteredWithCatalog/" + testname + ".xsd-log";
createSimpleProject("Project", new String[] { testfile });
ICatalog catalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
INextCatalog[] nextCatalogs = catalog.getNextCatalogs();
for (int i = 0; i < nextCatalogs.length; i++) {
INextCatalog nextCatalog = nextCatalogs[i];
if (XMLCorePlugin.USER_CATALOG_ID.equals(nextCatalog.getId())) {
ICatalog userCatalog = nextCatalog.getReferencedCatalog();
if (userCatalog != null) {
ICatalogEntry catalogEntry = (ICatalogEntry) userCatalog.createCatalogElement(ICatalogEntry.ENTRY_TYPE_PUBLIC);
catalogEntry.setKey("http://www.eclipse.org/webtools/Catalogue");
catalogEntry.setURI("platform:/resource/Project/InvalidSchemaInXMLCatalog.xsd");
userCatalog.addCatalogElement(catalogEntry);
runTest("platform:/resource/Project/InvalidSchemaWithNamespaceInCatalog.xsd", loglocation, idealloglocation);
catalog.removeCatalogElement(catalogEntry);
}
}
}
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog in project webtools.sourceediting by eclipse.
the class BugFixesTest method testInvalidSchemaInXMLCatalog.
/**
* Test /BugFixes/InvalidSchemaInXMLCatalog/InvalidSchemaInXMLCatalog.xsd
*/
public void testInvalidSchemaInXMLCatalog() {
String testname = "InvalidSchemaInXMLCatalog";
String testfile = PLUGIN_ABSOLUTE_PATH + SAMPLES_DIR + BUGFIXES_DIR + "InvalidSchemaInXMLCatalog/" + testname + ".xsd";
String loglocation = PLUGIN_ABSOLUTE_PATH + GENERATED_RESULTS_DIR + BUGFIXES_DIR + "InvalidSchemaInXMLCatalog/" + testname + ".xsd-log";
String idealloglocation = PLUGIN_ABSOLUTE_PATH + IDEAL_RESULTS_DIR + BUGFIXES_DIR + "InvalidSchemaInXMLCatalog/" + testname + ".xsd-log";
createSimpleProject("Project", new String[] { testfile });
ICatalog catalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
INextCatalog[] nextCatalogs = catalog.getNextCatalogs();
for (int i = 0; i < nextCatalogs.length; i++) {
INextCatalog nextCatalog = nextCatalogs[i];
if (XMLCorePlugin.USER_CATALOG_ID.equals(nextCatalog.getId())) {
ICatalog userCatalog = nextCatalog.getReferencedCatalog();
if (userCatalog != null) {
ICatalogEntry catalogEntry = (ICatalogEntry) userCatalog.createCatalogElement(ICatalogEntry.ENTRY_TYPE_PUBLIC);
catalogEntry.setKey("testKey");
catalogEntry.setURI("http://testuri");
userCatalog.addCatalogElement(catalogEntry);
runTest("platform:/resource/Project/InvalidSchemaInXMLCatalog.xsd", /*FILE_PROTOCOL + file.getLocation().toString()*/
loglocation, idealloglocation);
catalog.removeCatalogElement(catalogEntry);
}
}
}
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog in project webtools.sourceediting by eclipse.
the class ProjectDescription method getCatalogRecords.
private Collection getCatalogRecords() {
if (fCatalogRecords == null) {
List records = new ArrayList();
ICatalog defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
if (defaultCatalog != null) {
// Process default catalog
ICatalogEntry[] entries = defaultCatalog.getCatalogEntries();
for (int entry = 0; entry < entries.length; entry++) {
ITaglibRecord record = createCatalogRecord(entries[entry]);
records.add(record);
}
// Process declared OASIS nextCatalogs catalog
INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs();
for (int nextCatalog = 0; nextCatalog < nextCatalogs.length; nextCatalog++) {
ICatalog catalog = nextCatalogs[nextCatalog].getReferencedCatalog();
ICatalogEntry[] entries2 = catalog.getCatalogEntries();
for (int entry = 0; entry < entries2.length; entry++) {
String uri = entries2[entry].getURI();
if (uri != null) {
uri = uri.toLowerCase(Locale.US);
if (uri.endsWith((".jar")) || uri.endsWith((".tld"))) {
ITaglibRecord record = createCatalogRecord(entries2[entry]);
if (record != null) {
records.add(record);
}
}
}
}
}
}
fCatalogRecords = records;
}
return fCatalogRecords;
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog in project webtools.sourceediting by eclipse.
the class Catalog method resolveSubordinateCatalogs.
protected String resolveSubordinateCatalogs(int entryType, String publicId, String systemId) throws MalformedURLException, IOException {
String result = null;
INextCatalog[] nextCatalogs = getNextCatalogs();
for (int i = 0; i < nextCatalogs.length; i++) {
INextCatalog nextCatalog = nextCatalogs[i];
ICatalog catalog = nextCatalog.getReferencedCatalog();
if (catalog != null) {
switch(entryType) {
case ICatalogEntry.ENTRY_TYPE_PUBLIC:
result = catalog.resolvePublic(publicId, systemId);
break;
case ICatalogEntry.ENTRY_TYPE_SYSTEM:
result = catalog.resolveSystem(systemId);
break;
case ICatalogEntry.ENTRY_TYPE_URI:
result = catalog.resolveURI(systemId);
break;
default:
break;
}
if (result != null) {
return result;
}
}
}
return null;
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog in project webtools.sourceediting by eclipse.
the class CategoryProvider method retrieveCatalog.
private void retrieveCatalog() {
if (systemCatalog != null)
return;
ICatalog defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs();
for (int i = 0; i < nextCatalogs.length; i++) {
INextCatalog catalog = nextCatalogs[i];
ICatalog referencedCatalog = catalog.getReferencedCatalog();
if (referencedCatalog != null) {
if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) {
systemCatalog = referencedCatalog;
}
}
}
}
Aggregations