Package org.infoset.xml

Examples of org.infoset.xml.XMLException


   {
      DocumentLoader loader = new SAXDocumentLoader();
      Document doc = loader.load(location);
      Element top = doc.getDocumentElement();
      if (!top.getName().equals(SERVER)) {
         throw new XMLException("Expecting "+SERVER+" but found "+top.getName());
      }
      String value = top.getAttributeValue("autoconf-check");
      if (value!=null) {
         autoconfCheck = Long.parseLong(value) * 1000;
      }
     
      Element keyStoreE = top.getFirstElementNamed(KEYSTORE);
      if (keyStoreE!=null) {
         URI fileRef = keyStoreE.getBaseURI().resolve(keyStoreE.getAttributeValue("file"));
         this.keyStorePath = new File(fileRef.getSchemeSpecificPart());
         this.keyStorePassword = keyStoreE.getAttributeValue("password");
      }
     
      Iterator<Element> appdefElements = top.getElementsByName(APPDEF);
      while (appdefElements.hasNext()) {
         Element appdefE = appdefElements.next();
         String name = appdefE.getAttributeValue("name");
         String className = appdefE.getAttributeValue("class");
        
         if (name!=null && className!=null) {
            List<URL> libraries = new ArrayList<URL>();
            Iterator<Element> libraryElements = appdefE.getElementsByName(LIBRARY);
            while (libraryElements.hasNext()) {
               Element libE = libraryElements.next();
               String href = libE.getAttributeValue("href");
               if (href!=null) {
                  URI u = libE.getBaseURI().resolve(href);
                  libraries.add(u.toURL());
               }
            }
            try {
               Class cdef = null;
               if (libraries.size()==0) {
                  cdef = this.getClass().forName(className);
               } else {
                  URL [] list = new URL[libraries.size()];
                  list = libraries.toArray(list);
                  ClassLoader urlLoader = new URLClassLoader(list,this.getClass().getClassLoader());
                  cdef = urlLoader.loadClass(className);
               }
               AppDef def = new AppDef(name,cdef);
               appDefs.put(name,def);
            } catch (ClassNotFoundException ex) {
               throw new XMLException("Cannot find class: "+ex.getMessage(),ex);
            }
         }
      }
      Iterator<Element> interfaceElements = top.getElementsByName(INTERFACE);
      while (interfaceElements.hasNext()) {
View Full Code Here


   {
      if (xml==null) {
         try {
            parse();
         } catch (IOException ex) {
            throw new XMLException("Cannot load XML due to I/O exception.",ex);
         }
      }
      pull = xml.getName().equals(AdminXML.NM_PULL);
      name = xml.getAttributeValue("name");
      String targetName = xml.getAttributeValue("target");
      target = new SyncTarget(db,targetName);
      String remoteName = xml.getAttributeValue("remote");
      app = new RemoteApp(db,remoteName);
      String lastSyncValue = xml.getAttributeValue("last-sync");
      additive = "true".equals(xml.getAttributeValue("additive"));
      if (lastSyncValue!=null) {
         try {
            lastSync = AtomResource.fromXSDDate(lastSyncValue);
         } catch (java.text.ParseException ex) {
            throw new XMLException("Cannot parse last-sync date value '"+lastSyncValue+"': "+ex.getMessage(),ex);
         }
      } else {
         lastSync = null;
      }
   }
View Full Code Here

            DocumentLoader loader = new SAXDocumentLoader();
            loader.generate(new StringReader(sw.toString()), new RemoveDocumentFilter(dest));

         }
      } catch (Exception ex) {
         throw new XMLException("Exception while getting ancestors.",ex);
      }
      dest.send(constructor.createCharacters("\n"));
      dest.send(constructor.createElementEnd(AtomResource.FEED_NAME));
      dest.send(constructor.createDocumentEnd());
   }
View Full Code Here

   {
      if (xml==null) {
         try {
            parse();
         } catch (IOException ex) {
            throw new XMLException("Cannot load XML due to I/O exception.",ex);
         }
      }
      Element top = getElement();
      name = top.getAttributeValue("name");
      path = top.getAttributeValue("path");
View Full Code Here

TOP

Related Classes of org.infoset.xml.XMLException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.