예제 #1
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);
   }
 }
예제 #2
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);
    }
  }
예제 #3
0
  @Override
  protected void attribute(final byte[] name, final byte[] value, final boolean standalone) {
    byte[] prefix = null;
    if (startsWith(name, XMLNS)) {
      if (name.length == 5) {
        prefix = EMPTY;
      } else if (name[5] == ':') {
        prefix = substring(name, 6);
      }
    }

    if (prefix != null) {
      namespaces.put(prefix, value);
    } else {
      attributes.add(name, value);
    }
  }