Package net.sf.jpluck.jxl

Examples of net.sf.jpluck.jxl.JXL$JXLEntityResolver


                                                  throws IOException, SAXException {
        if (defaultDocument == null) {
            File file = new File(getDefaultJXLPath());
            if (file.exists()) {
                try {
                    JXL jxl = new JXL(file, false);
                    defaultDocument = jxl.getDocument("default");
                } catch (SAXException e) {
                    throw e;
                } catch (IOException e) {
                    throw e;
                }
            } else {
                JXL jxl = new JXL();
                Element site = jxl.createSiteElement();
                org.w3c.dom.Document dom = site.getOwnerDocument();
                Element name = dom.createElement("name");
                site.appendChild(name);
                name.appendChild(dom.createTextNode("default"));
                site.appendChild(dom.createElement("uri"));               
                defaultDocument = jxl.add(site);
                try {
                    jxl.save(new File(getDefaultJXLPath()));
                } catch (IOException e) {
                    defaultDocument = null;
                    throw e;
                }
            }
View Full Code Here


        DocumentDialog dlg = new DocumentDialog(owner);
        dlg.editingDefault = true;
        dlg.initComponents(false);
        dlg.banner.showSheet("editDefault");
        if (document == null) {
            JXL jxl = new JXL();
            Element site = jxl.createSiteElement();
            org.w3c.dom.Document dom = site.getOwnerDocument();
            Element name = dom.createElement("name");
            name.appendChild(dom.createTextNode("default"));
            site.appendChild(dom.createElement("uri"));
            document = jxl.add(site);
            jxl.save(new File(ClientConfiguration.getDefault().getDefaultJXLPath()));
        } else {
            dlg.initValues(document);
        }
        owner.setCursor(Cursor.getDefaultCursor());
        dlg.setLocationRelativeTo(owner);
View Full Code Here

            }

            for (int i = 0, n = fileList.size(); i < n; i++) {
                try {
                    File file = (File) fileList.get(i);
                    JXL jxl = new JXL(file);
                    Document[] documents = jxl.getDocumentsToConvert();
                    Arrays.sort(documents);
                    documentList.addAll(Arrays.asList(documents));
                } catch (Exception e) {
                }
            }
View Full Code Here

    }

    public void openJXL(File file) {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        try {
            jxl = new JXL(file);
            setTitle();
            tableList.clearSelection();
            tableList.setTableListModel(jxl);
            tableList.sortByColumn(0);
            ClientConfiguration conf = ClientConfiguration.getDefault();
View Full Code Here

                    }
                    for (int i = 1, n = list.size(); i < n; i++) {
                        File file = (File) list.get(i);
                        try {
                            if (file.getName().endsWith(".xml") || file.getName().endsWith(".jxl")) {
                                JXL jxl = new JXL(file);
                                JPluckX.getInstance().newListFrame(jxl).show();
                            }
                        } catch (Exception e) {
                            ExceptionDialog.show(ListFrame.this, e);
                        }
View Full Code Here

            putValue(Action.SMALL_ICON, IconUtil.getIcon("new.gif"));
        }

        public void actionPerformed(ActionEvent ev) {
            if (canClose()) {
                jxl = new JXL();
                tableList.clearSelection();
                tableList.setTableListModel(jxl);
                tableList.sortByColumn(0);
                setTitle();
            }
View Full Code Here

            putValue(Action.SHORT_DESCRIPTION, "");
            putValue(Action.SMALL_ICON, null);
        }

        public void actionPerformed(ActionEvent ev) {
            JPluckX.getInstance().newListFrame(new JXL()).show();
        }
View Full Code Here

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class AtomTest {
  public static void main(String[] args) throws Exception {
    JXL jxl = new JXL(new File(args[0]));
    File file = new File(args[1]);
    byte[] data = new byte[(int)file.length()];
    FileInputStream in = new FileInputStream(file);
    in.read(data);
    in.close();
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    dbf.setValidating(false);

    DocumentBuilder builder = dbf.newDocumentBuilder();
    builder.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId)
          throws SAXException, IOException {
          return XHTMLEntityResolver.getTransitionalDTD();
        }
      });

    org.w3c.dom.Document document = null;
    try {
      document = builder.parse(new InputSource(new ByteArrayInputStream(data)));
    } catch (Exception e) {
      InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(data), "ISO-8859-1");
      document = builder.parse(new InputSource(reader));
    }
    AtomFeed feed = new AtomFeed(document);
    FeedFormatter formatter = new FeedFormatter(feed, (Feed)jxl.getDocuments()[0]);
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.transform(new DOMSource(formatter.getIndexDocument()),
      new StreamResult(new File(file.getParentFile(),"index.html")));
    for (int i = 0, n = feed.getItems().length; i < n; i++) {
      transformer.transform(new DOMSource(formatter.getItemDocuments()[i]),
View Full Code Here

      LogUtil logUtil = new LogUtil(LogUtil.DEFAULT_LOGGER_NAMES);
      logUtil.addHandler(new SystemOutHandler());
      logUtil.setUseParentHandler(false);

      String[] args = cl.getArgs();
      JXL jxl = null;

      Destination destination = ClientConfiguration.getDefault().getDestination();
      if (cl.hasOption("destination")) {
        File dir = new File(cl.getOptionValue("destination"));
        if (!dir.exists()) {
          System.err.println("ERROR: destination directory " + dir.getAbsolutePath() + " \"does not exist\".");
          System.exit(-1);
        }
        dir = dir.getCanonicalFile();
        destination = Destination.createForDirectory(dir);
      }

      File file = null;
      if (cl.hasOption("stdin")) {
        URI uri = new File(System.getProperty("user.dir")).toURI();
        if (cl.hasOption("uri")) {
          uri = uri.resolve(cl.getOptionValue("uri"));
          System.err.println(uri);
        } else {
          uri = uri.resolve("stdin.jxl");
        }

        InputSource inputSource = new InputSource();
        inputSource.setByteStream(System.in);
        inputSource.setSystemId(uri.toString());
        jxl = new JXL(inputSource);
      } else {
        if ((args.length == 0) && !cl.hasOption("stdin")) {
          System.err.println("ERROR: JXL not specified.");
          System.exit(ExitCodes.ERROR_INVALID_NUMBER_OF_ARGUMENTS);
        }
        file = new File(args[0]);
        jxl = new JXL(file);
      }

      String[] names = cl.getOptionValues("name");
      List documentList = new ArrayList();

      if (names != null) {
        for (int i = 0; i < names.length; i++) {
          String name = names[i];
          Document document = jxl.getDocument(name);

          if (document == null) {
            System.err.println("ERROR: Document \"" + name + "\" not found.");
            System.exit(1);
          }

          documentList.add(document);
        }
      } else {
        documentList.addAll(Arrays.asList(jxl.getDocuments()));
        if (documentList.size() == 0) {
          System.out.println("No documents found in JXL.");
          System.exit(0);
        }
      }
View Full Code Here

                OptionsUtil.printHelp("java -jar autoid.jar <jxl filename>",
                                      "Generates and assigns unique IDs to sites and feeds in JXLs", options);
                System.exit(ExitCodes.OK);
            }
            System.out.println("Opening " + args[0]);
            JXL jxl = new JXL(new File(args[0]));
            Document[] documents = jxl.getDocuments();
      System.out.println("Generating IDs.");
            int count = 0;
            for (int i = 0; i < documents.length; i++) {
        Element elem = documents[i].getElement();
        if (!elem.hasAttribute("id")) {
          RandomGUID randomGUID = new RandomGUID();           
          elem.setAttribute("id", randomGUID.toString());
          count++;
        }
      }
      if (count > 0) {
        System.out.println("Generated " + count + " new ID(s).");
      } else {
        System.out.println("No new IDs generated.");
      }
      System.out.println("Saving JXL.");
      jxl.save();
      System.out.println("Done!");
        } catch (ParseException e) {
            System.out.println("ERROR: " + e.getMessage());
            System.exit(ExitCodes.UNSPECIFIED);
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of net.sf.jpluck.jxl.JXL$JXLEntityResolver

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.