Package org.xml.sax

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


      }

      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) {
View Full Code Here


    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    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);   
  }
 
View Full Code Here

    XMLSerializer sax2xml = new XMLSerializer(baos, false);
    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);
  }
 
View Full Code Here

      throws SAXException {
    ContentHandler handler = pData.getContentHandler();
    String qName = getElementQName(pData, pNamespaceURI, pLocalName);
    handler.startElement(pNamespaceURI, pLocalName, qName, zeroAttributes);
    handler.characters(pValue.toCharArray(), 0, pValue.length());
    handler.endElement(pNamespaceURI, pLocalName, qName);
  }

  public void marshal(JMXmlSerializer.Data pData, QName pName, Object pElement)
      throws SAXException {
    NamespaceSupport nss = pData.getNamespaceSupport();
View Full Code Here

    String name = pName.getLocalPart();
    String qName = getElementQName(pData, uri, name);
    handler.startElement(uri, name, qName,
                         getAttributes(pData, pElement));
    marshalChilds(pData, pElement);
    handler.endElement(uri, name, qName);
    for (;;) {
      String prefix = nss.setContext(context);
      if (prefix == null) {
        break;
      }
View Full Code Here

    String uri = pQName.getNamespaceURI();
    String localName = pQName.getLocalPart();
    String qName = getElementQName(pData, uri, localName);
    handler.startElement(uri, localName, qName, zeroAttributes);
    handler.characters(pValue.toCharArray(), 0, pValue.length());
    handler.endElement(uri, localName, qName);
  }

  protected void marshalAtomicChild(JMXmlSerializer.Data pData,
                                      String pNamespaceURI,
                                      String pLocalName,
View Full Code Here

            final HtmlSaxDiffOutput output = new HtmlSaxDiffOutput(postProcess,prefix);

            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

            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

      for (String corpusFolder : dotCorpus.getCorpusFolderNameList()) {
        AttributesImpl corpusFolderAttributes = new AttributesImpl();
        corpusFolderAttributes.addAttribute("", "", CORPUS_FOLDER_ATTRIBUTE, "", corpusFolder);

        xmlSerHandler.startElement("", CORPUS_ELEMENT, CORPUS_ELEMENT, corpusFolderAttributes);
        xmlSerHandler.endElement("", CORPUS_ELEMENT, CORPUS_ELEMENT);
      }

      for (AnnotationStyle style : dotCorpus.getAnnotationStyles()) {
        AttributesImpl styleAttributes = new AttributesImpl();
        styleAttributes.addAttribute("", "", STYLE_TYPE_ATTRIBUTE, "", style.getAnnotation());
View Full Code Here

        styleAttributes.addAttribute("", "", STYLE_COLOR_ATTRIBUTE, "", colorInt.toString());
        styleAttributes.addAttribute("", "", STYLE_LAYER_ATTRIBUTE, "", Integer.toString(style
                .getLayer()));

        xmlSerHandler.startElement("", STYLE_ELEMENT, STYLE_ELEMENT, styleAttributes);
        xmlSerHandler.endElement("", STYLE_ELEMENT, STYLE_ELEMENT);
      }

      for (String type : dotCorpus.getShownTypes()) {
       
        AttributesImpl shownAttributes = new AttributesImpl();
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.