예제 #1
0
 /**
  * Returns the selected schema version for the given URI.
  *
  * @param doc document object model of the XML source file
  * @param namespaceUri namespace URI to examine
  * @return selected schema version for the given URI
  */
 public static Version getSchemaVersion(IDOMDocument doc, String namespaceUri) {
   String versLocation = getSelectedSchemaLocation(doc, namespaceUri);
   Matcher matcher = VERSION_PATTERN.matcher(versLocation);
   if (matcher.matches()) {
     return new Version(matcher.group(1));
   } else {
     List<INamespaceDefinition> defs = NamespaceUtils.getNamespaceDefinitions();
     for (INamespaceDefinition def : defs) {
       Version version = Version.emptyVersion;
       if (namespaceUri.equals(def.getNamespaceURI())) {
         Version tempVersion = Version.emptyVersion;
         for (String location : def.getSchemaLocations()) {
           matcher = VERSION_PATTERN.matcher(location);
           if (matcher.matches()) {
             tempVersion = new Version(matcher.group(1));
           }
           if (tempVersion.compareTo(version) >= 0) {
             version = tempVersion;
           }
         }
         return version;
       }
     }
     return Version.emptyVersion;
   }
 }
예제 #2
0
 /** {@inheritDoc} */
 @Override
 protected Image createImage() {
   return NamespaceUtils.getImage(definition);
 }
예제 #3
0
 /** {@inheritDoc} */
 @Override
 protected Image createImage() {
   return NamespaceUtils.getImage(ns, icon);
 }