Package fr.imag.adele.metadataparser

Examples of fr.imag.adele.metadataparser.XmlCommonHandler


                                    +getUserAgentForBundle(m_context.getBundle(0))
                                    );
            is = conn.getInputStream();

            // Create the parser Kxml
            XmlCommonHandler handler = new XmlCommonHandler();
            handler.addType("bundles", ArrayList.class);
            handler.addType("repository", HashMap.class);
            handler.addType("extern-repositories", ArrayList.class);
            handler.addType("bundle", MultivalueMap.class);
            handler.addType("import-package", HashMap.class);
            handler.addType("export-package", HashMap.class);
            handler.setDefaultType(String.class);

            br = new BufferedReader(new InputStreamReader(is));
            KXmlSAXParser parser;
            parser = new KXmlSAXParser(br);
            try
            {
                parser.parseXML(handler);
            }
            catch (Exception ex)
            {
              System.err.println("Failed to parse '"+url+"': "+ex.getMessage());
              ex.printStackTrace();
              return;
            }

            List root = (List) handler.getRoot();
            for (int bundleIdx = 0; bundleIdx < root.size(); bundleIdx++)
            {
                Object obj = root.get(bundleIdx);

                // The elements of the root will either be a HashMap for
View Full Code Here

TOP

Related Classes of fr.imag.adele.metadataparser.XmlCommonHandler

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.