use of org.eclipse.wst.xml.core.internal.catalog.provisional.ISuffixEntry in project webtools.sourceediting by eclipse.
the class TestCatalogRetrivalAndModelCreation method testCatalog11UriSuffix.
public void testCatalog11UriSuffix() throws MalformedURLException, IOException {
ICatalog xmlCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
ISuffixEntry uriSuffix = (ISuffixEntry) xmlCatalog.createCatalogElement(ISuffixEntry.SUFFIX_TYPE_URI);
uriSuffix.setSuffix("XMLSchema.xsd");
uriSuffix.setURI(LOCAL_SCHEMA_FILE);
xmlCatalog.addCatalogElement(uriSuffix);
try {
String resolved = xmlCatalog.resolveURI("http://www.w3.org/2001/XMLSchema.xsd");
assertEquals(LOCAL_SCHEMA_FILE, resolved);
} finally {
xmlCatalog.removeCatalogElement(uriSuffix);
}
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ISuffixEntry in project webtools.sourceediting by eclipse.
the class CatalogWriter method processSuffixEntries.
private void processSuffixEntries(ICatalog catalog, Element parent) {
ISuffixEntry[] suffixEntries = catalog.getSuffixEntries();
for (int i = 0; i < suffixEntries.length; i++) {
ISuffixEntry entry = suffixEntries[i];
String suffixString = entry.getSuffix();
String uri = entry.getURI();
Element childElement = null;
switch(entry.getEntryType()) {
case ISuffixEntry.SUFFIX_TYPE_SYSTEM:
childElement = parent.getOwnerDocument().createElement(OASISCatalogConstants.TAG_SYSTEM_SUFFIX);
if (childElement != null) {
childElement.setAttribute(OASISCatalogConstants.ATTR_SYSTEM_ID_SUFFFIX, suffixString);
childElement.setAttribute(OASISCatalogConstants.ATTR_URI, uri);
}
break;
case ISuffixEntry.SUFFIX_TYPE_URI:
childElement = parent.getOwnerDocument().createElement(OASISCatalogConstants.TAG_URI_SUFFIX);
if (childElement != null) {
childElement.setAttribute(OASISCatalogConstants.ATTR_URI_SUFFIX, suffixString);
childElement.setAttribute(OASISCatalogConstants.ATTR_URI, uri);
}
break;
default:
break;
}
if (childElement != null) {
setAttributes(entry, childElement);
parent.appendChild(childElement);
}
}
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ISuffixEntry 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);
}
}
Aggregations