Example #1
0
 @Override
 public void parse(final String id) throws SAXException {
   try {
     contentHandler.startDocument();
     serialize(item);
     contentHandler.endDocument();
   } catch (final Exception ex) {
     throw new SAXException(ex);
   }
 }
Example #2
0
 @Override
 protected void pi(final byte[] name, final byte[] value) throws IOException {
   try {
     contentHandler.processingInstruction(string(name), string(value));
   } catch (final SAXException ex) {
     throw new IOException(ex);
   }
 }
Example #3
0
 @Override
 protected void text(final byte[] value, final FTPos ftp) throws IOException {
   try {
     final String s = string(value);
     final char[] c = s.toCharArray();
     contentHandler.characters(c, 0, c.length);
   } catch (final SAXException ex) {
     throw new IOException(ex);
   }
 }
Example #4
0
 @Override
 protected void finishClose() throws IOException {
   try {
     final String uri = string(namespaces.get(elem.prefix()));
     final String lname = string(elem.local());
     final String rname = string(elem.string());
     contentHandler.endElement(uri, lname, rname);
     namespaces = namespaces.getParent();
   } catch (final SAXException ex) {
     throw new IOException(ex);
   }
 }
Example #5
0
  @Override
  protected void finishOpen() throws IOException {
    try {
      final AttributesImpl attrs = new AttributesImpl();
      final int as = attributes.size();
      for (int a = 0; a < as; a++) {
        final byte[] name = attributes.name(a);
        final String uri = string(namespaces.get(prefix(name)));
        final String lname = string(local(name));
        final String rname = string(name);
        final String value = string(attributes.value(a));
        attrs.addAttribute(uri, lname, rname, null, value);
      }

      final String uri = string(namespaces.get(elem.prefix()));
      final String lname = string(elem.local());
      final String rname = string(elem.string());
      contentHandler.startElement(uri, lname, rname, attrs);

    } catch (final SAXException ex) {
      throw new IOException(ex);
    }
  }