Package javax.xml.stream

Examples of javax.xml.stream.XMLOutputFactory


    */
   public HTTPResponse Proppath(String resource, Map<String, List<String>> propsSet, List<String> propsRemove)
      throws IOException, ModuleException
   {

      XMLOutputFactory factory = XMLOutputFactory.newInstance();
      HttpOutputStream out = new HttpOutputStream();
      NVPair contentTypePair = new NVPair("Content-Type", "text/xml");
      HTTPResponse response = setupRequest("PROPPATCH", resource, new NVPair[]{contentTypePair}, null, out);

      try
      {
         XMLStreamWriter sw = factory.createXMLStreamWriter(out, "UTF-8");
         sw.writeStartDocument("UTF-8", "1.0");
         sw.writeStartElement("D", "propertyupdate", "DAV:");
         sw.writeNamespace("D", "DAV:");
         if (propsSet != null && propsSet.size() > 0)
         {
View Full Code Here


      NVPair timeoutPair = new NVPair("Timeout", timeout == -1 ? "Infinity" : "Second-" + timeout);
      HTTPResponse response =
         setupRequest("LOCK", resource, new NVPair[]{contentTypePair, timeoutPair, depthPair}, null, out);
      try
      {
         XMLOutputFactory factory = XMLOutputFactory.newInstance();
         XMLStreamWriter sw = factory.createXMLStreamWriter(out, "UTF-8");
         sw.writeStartDocument("UTF-8", "1.0");
         sw.writeStartElement("D", "lockinfo", "DAV:");
         sw.writeNamespace("D", "DAV:");
         sw.writeStartElement("D", "lockscope", "DAV:");
         if (isExclusive)
View Full Code Here

         @Override
         public void run()
         {
            try
            {
               XMLOutputFactory factory = XMLOutputFactory.newInstance();
               XMLStreamWriter writer = factory.createXMLStreamWriter(po, Constants.DEFAULT_ENCODING);

               writer.writeStartDocument(Constants.DEFAULT_ENCODING, "1.0");
               writer.writeStartElement(XML_NODE);
               writer.writeAttribute(PREFIX_XMLNS, PREFIX_LINK);
               writer.writeAttribute(XLINK_XMLNS, XLINK_LINK);
View Full Code Here

   
    DocumentMD docmd = (DocumentMD)fitsOut.getStandardXmlContent();
   
    if(docmd != null) {
    docmd.setRoot(true);
      XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
      XMLStreamWriter writer = xmlof.createXMLStreamWriter(System.out);
     
      docmd.output(writer);
    }
     
  }
View Full Code Here

    serializer.output(fitsOut.getFitsXml(), System.out);
   
    TextMD textmd = (TextMD)fitsOut.getStandardXmlContent();
    textmd.setRoot(true);
   
    XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
    XMLStreamWriter writer = xmlof.createXMLStreamWriter(System.out);
   
    textmd.output(writer);
     
  }
View Full Code Here

  }*/
 
  public void testFitsOutput2() throws FitsException, XMLStreamException  {
    Fits fits = new Fits();
   
    XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
   
   
    File problemsDir = new File("testfiles/problems");
    if(!problemsDir.exists()) {
      System.out.println("No files in the problem directory!");
      return;
    }
    for(File f : problemsDir.listFiles()) {
      if(f.getName().equals("CVS")) {
        continue;
      }
      FitsOutput output = fits.examine(f);   
      /*
      assertNotNull(output.getFileInfoElements());
      assertNotNull(output.getFileStatusElements());
      assertNotNull(output.getTechMetadataElements());
      assertNotNull(output.getTechMetadataType());
      assertNotNull(output.getErrorMessages());
      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());
View Full Code Here

   
    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

    serializer.output(fitsOut.getFitsXml(), System.out);
   
    Mix mix = (Mix)fitsOut.getStandardXmlContent();
    mix.setRoot(true);
       
    XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
    XMLStreamWriter writer = xmlof.createXMLStreamWriter(System.out);
   
    mix.output(writer);

  }
View Full Code Here

    private static void returnXMLInputFactory(XMLInputFactory factory) {
        NS_AWARE_INPUT_FACTORY_POOL.offer(factory);
    }
   
    private static XMLOutputFactory getXMLOutputFactory() {
        XMLOutputFactory f = OUTPUT_FACTORY_POOL.poll();
        if (f == null) {
            f = XMLOutputFactory.newInstance();
        }
        return f;
    }
View Full Code Here

    }

   

    public static XMLStreamWriter createXMLStreamWriter(Writer out) {
        XMLOutputFactory factory = getXMLOutputFactory();
        try {
            return factory.createXMLStreamWriter(out);
        } catch (XMLStreamException e) {
            throw new RuntimeException("Cant' create XMLStreamWriter", e);
        } finally {
            returnXMLOutputFactory(factory);
        }
View Full Code Here

TOP

Related Classes of javax.xml.stream.XMLOutputFactory

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.