Package org.xml.sax

Examples of org.xml.sax.ContentHandler.endDocument()


      if (pos < docCharArray.length) {
        handler.characters(docCharArray, pos, docCharArray.length - pos);
      }
      handler.endElement("", "Document", "Document");
      handler.endDocument();

      // return XML string
      return new String(byteArrayOutputStream.toByteArray(),"UTF-8");
    } catch (SAXException e) {
      throw new UIMARuntimeException(e);
View Full Code Here


      if (trueDescriptor instanceof AnalysisEngineDescription) {
        AnalysisEngineDescription aed = (AnalysisEngineDescription) trueDescriptor;
        aed.toXML(contentHandler, true, true);
      } else
        trueDescriptor.toXML(contentHandler, true);
      contentHandler.endDocument();
      writer.close();
      parsedText = writer.toString();

    } catch (SAXException e) {
      throw new InternalErrorCDE(Messages.getString("MultiPageEditor.22"), e); //$NON-NLS-1$
View Full Code Here

    XMLSerializer sax2xml = new XMLSerializer(baos, false);
    ContentHandler ch = sax2xml.getContentHandler();   
    ch.startDocument();
    ch.startElement("","foo","foo", new AttributesImpl());
    ch.endElement("", "foo", "foo");
    ch.endDocument();
    String xmlStr = new String(baos.toByteArray(), "UTF-8");
    assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo/>", xmlStr);   
  }
 
  public void testXml11() throws Exception {
View Full Code Here

    sax2xml.setOutputProperty(OutputKeys.VERSION, "1.1");
    ContentHandler ch = sax2xml.getContentHandler();   
    ch.startDocument();
    ch.startElement("","foo","foo", new AttributesImpl());
    ch.endElement("", "foo", "foo");
    ch.endDocument();
    String xmlStr = new String(baos.toByteArray(), "UTF-8");
    assertEquals("<?xml version=\"1.1\" encoding=\"UTF-8\"?><foo/>", xmlStr);
  }
 
  public void testXml10Error() throws Exception {
View Full Code Here

        if (buffer == null) {
            throw new IllegalStateException("Cannot issue complete lifecycle when the handler was never actually invoked - no buffer avialable!");
        }
        ContentHandler contentHandler = buffer.getContentHandler();
        XMLStreamHelper.writeEndElement(WS_ADDRESSING_QNAME, contentHandler);
        contentHandler.endDocument();

        XmlObject object = buffer.getObject();
        if (object instanceof EndpointReferenceType) {
            EndpointReferenceType endpointReference = (EndpointReferenceType) object;
            System.out.println("Parsed endpoint reference: " + endpointReference);
View Full Code Here

    OutputStream out = new FileOutputStream(destination);
    XMLSerializer sax = new XMLSerializer(out);
    ContentHandler ch = sax.getContentHandler();
    ch.startDocument();
    desc.toXML(ch);
    ch.endDocument();
  }

  public static URL checkImportExistence(String candidate, String extension, ClassLoader classloader)
          throws IOException {
    String p = candidate.replaceAll("[.]", "/");
View Full Code Here

            // Parse script into Jelly parser
            ContentHandler handler = getJellyParser();
            XMLOutput newOutput = new XMLOutput(handler);
            handler.startDocument();
            invokeBody(newOutput);
            handler.endDocument();
            // Run script to generate output
            Script script = getJellyParser().getScript();
            script.run(context, output);
        } catch (JellyTagException e) {
            if (e.getCause() instanceof SAXException) {
View Full Code Here

            final HTMLDiffer differ = new HTMLDiffer(output);
            differ.diff(rightComparator, leftComparator);

            postProcess.endElement("", "diff", "diff");
            postProcess.endElement("", "diffreport", "diffreport");
            postProcess.endDocument();

        } catch (Throwable e) {
            logger.error(e.getMessage(), e);
        }
View Full Code Here

      if (trueDescriptor instanceof AnalysisEngineDescription) {
        AnalysisEngineDescription aed = (AnalysisEngineDescription) trueDescriptor;
        aed.toXML(contentHandler, true, true);
      } else
        trueDescriptor.toXML(contentHandler, true);
      contentHandler.endDocument();
      writer.close();
      parsedText = writer.toString();

    } catch (SAXException e) {
      throw new InternalErrorCDE(Messages.getString("MultiPageEditor.22"), e); //$NON-NLS-1$
View Full Code Here

                editorLineLengthHintAttributes);
        xmlSerHandler.endElement("", EDITOR_ELEMENT, EDITOR_ELEMENT);
      }

      xmlSerHandler.endElement("", CONFIG_ELEMENT, CONFIG_ELEMENT);
      xmlSerHandler.endDocument();
    } catch (SAXException e) {
      String message = e.getMessage() != null ? e.getMessage() : "";

      IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
      throw new CoreException(s);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.