Package edu.harvard.hul.ois.ots.schemas.XmlContent

Examples of edu.harvard.hul.ois.ots.schemas.XmlContent.XmlContent


      assertNotNull(output.checkWellFormed());
      assertNotNull(output.checkValid());
      assertNotNull(output.getMetadataElement("md5checksum").getValue());
      */
      String errorText = output.getErrorMessages();
      XmlContent xml = output.getStandardXmlContent();
      if(xml != null) {
        XMLStreamWriter writer = xmlof.createXMLStreamWriter(System.out);
        xml.output(writer);
        writer.close();
      }
      System.out.println(errorText);
      System.out.println("valid = "+output.checkValid());
      System.out.println("well-formed = "+output.checkWellFormed());
View Full Code Here


    serializer.output(result.getFitsXml(), out);

  }
 
  public static void outputStandardSchemaXml(FitsOutput fitsOutput, OutputStream out) throws XMLStreamException, IOException {
    XmlContent xml = fitsOutput.getStandardXmlContent();
   
    //create an xml output factory
      Transformer transformer = null;
     
      //initialize transformer for pretty print xslt
      TransformerFactory tFactory = TransformerFactory.newInstance ();
      String prettyPrintXslt = FITS_XML+"prettyprint.xslt";
      try {
      Templates template = tFactory.newTemplates(new StreamSource(prettyPrintXslt));     
      transformer = template.newTransformer();
      }
      catch(Exception e) {
        transformer = null;
      }
     
    if(xml != null && transformer != null) {

      xml.setRoot(true)
      ByteArrayOutputStream xmlOutStream = new ByteArrayOutputStream();
      OutputStream xsltOutStream = new ByteArrayOutputStream();
     
      try {
        //send standard xml to the output stream
        XMLStreamWriter sw = xmlOutputFactory.createXMLStreamWriter(xmlOutStream);
        xml.output(sw);
       
        //convert output stream to byte array and read back in as inputstream
        Source source = new StreamSource(new ByteArrayInputStream(xmlOutStream.toByteArray()));
        Result rstream = new StreamResult(xsltOutStream);
       
View Full Code Here

    }

    //if we have technical metadata convert it to the standard form
    if(techmd != null && techmd.getChildren().size() > 0) {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      XmlContent xml = getStandardXmlContent();
      if(xml != null) {
        XMLStreamWriter sw = xmlOutputFactory.createXMLStreamWriter(baos);
        xml.output(sw);
        String stdxml = baos.toString("UTF-8");
       
        //convert the std xml back to a JDOM element so we can insert it back into the fitsXml Document
        try {
          StringReader sReader = new StringReader(stdxml);
View Full Code Here

      FitsOutput fitsOut = fits.examine(input);
     
    XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat());
    serializer.output(fitsOut.getFitsXml(), System.out);
   
    XmlContent xml = fitsOut.getStandardXmlContent();
   
    if(xml != null) {
      xml.setRoot(true);
      XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
      XMLStreamWriter writer = xmlof.createXMLStreamWriter(System.out);
     
      xml.output(writer);
    }
     
  }
View Full Code Here

TOP

Related Classes of edu.harvard.hul.ois.ots.schemas.XmlContent.XmlContent

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.