Package uk.ac.cam.ch.wwmm.ptclib.scixml

Examples of uk.ac.cam.ch.wwmm.ptclib.scixml.PubXMLToSciXML


 
  public Document makePubXMLPaper() throws Exception {
    if(!hasPubXMLDoc) return null;
    File pubXMLSourceFile = new File(fileDir, "pubxml-source.xml");
    Document pubXMLDoc = new Builder().build(pubXMLSourceFile);
    PubXMLToSciXML ptsx = new PubXMLToSciXML(pubXMLDoc);
   
    Document sciXMLDoc = (Document)ptsx.getSciXML().copy();
    PaperToScrapBook.importAnnotations(this, sciXMLDoc);
    Document safDoc = InlineToSAF.extractSAFs(sciXMLDoc, ptsx.getSciXML(), name);
   
    ptsx.transformSAFs(safDoc);
    Document newPubXMLDoc = SAFToInline.safToInline(safDoc, ptsx.getSourceXML(), false);

    return newPubXMLDoc;
  }
View Full Code Here


   * @param noExperimental Whether to exclude the experimental section and captions.
   * @param noCaptions Whether to exclude the captions.
   * @throws Exception
   */
  public static void makeScrapBook(Document doc, String name, boolean noExperimental, boolean noCaptions) throws Exception {
    PubXMLToSciXML ptsx = null;
   
    if(doc.getDocType() != null && doc.getDocType().getSystemID().equals("http://www.rsc.org/dtds/rscart37.dtd")) {
      ptsx = new PubXMLToSciXML(doc);
      doc = ptsx.getSciXML();
    }
   
    doc = (Document)doc.copy();
   
    Nodes n = null;
View Full Code Here

  {
    Document document = null;
    try
    {
      document = new Builder().build(file);
      PubXMLToSciXML rtsx = new PubXMLToSciXML(document);
      document = rtsx.getSciXML();
    }
    catch(Exception ex)
    {
      System.err.println("Exception preprocessing file "+file.getName());
      Logger.getLogger(PubXMLPreprocessor.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

  private static Document processFile(String filename, String mode) throws Exception {   
    // First make sure the properties file is loaded...
    Oscar3Props.getInstance();
    Document doc;

    PubXMLToSciXML ptsx = null;
   
    if(mode.equals("Process") || mode.equals("SAF") || mode.equals("Data")) {
      System.out.println("Loading file...");
      doc = ToSciXML.fileToSciXML(new File(filename));
    } else if(mode.equals("RoundTrip")) {
      ptsx = new PubXMLToSciXML(new Builder().build(new File(filename)));
      doc = ptsx.getSciXML();
    } else {
      throw new Error("Mode not recognised");
    }
   
    OscarFlow oscarFlow = new OscarFlow(doc);

    if(mode.equals("Process")) {
      oscarFlow.processLite();
      return oscarFlow.getInlineXML();
    } else if(mode.equals("SAF")) {
      oscarFlow.processToSAF();
      return oscarFlow.getSafXML();
    } else if(mode.equals("Data")) {
      oscarFlow.parseData();
      return oscarFlow.getDataXML();
    } else if(mode.equals("RoundTrip")) {
      oscarFlow.processLite();
      ptsx.setSciXMLDoc(oscarFlow.getInlineXML());
      return ptsx.getAnnotatedPubXML();
    }
    return null;
  }
View Full Code Here

      Document doc = new Builder().build(new FileReader(file));
      if(PubXMLToSciXML.isRSCDoc(doc))
      {     
        File paperDir = new File(destDir, file.getName().substring(0, file.getName().length()-4));
        paperDir.mkdir();
        PubXMLToSciXML ptsx = new PubXMLToSciXML(doc);
        doc = ptsx.getSciXML();
        File paperFile = new File(paperDir, "pubxml-source.xml");
        copyFile(file, paperFile);
        File xmlFile = new File(paperDir, "source.xml");
        new Serializer(new FileOutputStream(xmlFile)).write(ptsx.getSciXML());
        File convFile = new File(paperDir, "conv.xml");
        new Serializer(new FileOutputStream(convFile)).write(ptsx.xpcToDoc());
      }//if
    }//if
    return isPubXML;
  }//identifyAndProcessPubXml
View Full Code Here

TOP

Related Classes of uk.ac.cam.ch.wwmm.ptclib.scixml.PubXMLToSciXML

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.