示例#1
0
  public void endElement(String namespaceUri, String localName, String qname) throws SAXException {
    --level;
    // System.out.println(getClass().getName()+".endElement enter " + qname);
    try {
      StackContext stackEntry = stack.peek();
      SaxEventBufferBuilder bufferBuilder = stackEntry.bufferBuilder;
      if (bufferBuilder != null) {
        bufferBuilder.endElement(namespaceUri, localName, qname);
        if (level == 0) {
          bufferBuilder.endDocument();
          SaxEventBuffer buffer = bufferBuilder.getBuffer();
          SaxSource saxSource =
              new SaxEventBufferSource(buffer, "", context.getTransformerFactory());

          DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
          builderFactory.setValidating(false);
          builderFactory.setNamespaceAware(true);
          DocumentBuilder builder = builderFactory.newDocumentBuilder();

          XMLReader reader = saxSource.createXmlReader();
          // InputSource inputSource = new InputSource(reader);
          // Document doc = builder.parse(inputSource);

        }
      }
      stack.pop();
    } catch (ServingXmlException e) {
      throw new SAXException(e.getMessage(), e);
    } catch (Exception e) {
      throw new SAXException(e.getMessage(), e);
    }

    super.endElement(namespaceUri, localName, qname);
    // System.out.println(getClass().getName()+".endElement " + qname + " leave");
  }
示例#2
0
 public void endDocument() throws SAXException {
   // System.out.println(getClass().getName()+".endDocument enter" );
   if (stack != null && !stack.empty()) {
     stack.pop();
   }
   super.endDocument();
 }