Exemple #1
0
  private void openClosedElements(Emitter rtfEmitter) throws TransformerException {
    // Now "reopen" the elements that we closed...
    while (!tempStack.empty()) {
      StartElementInfo elem = (StartElementInfo) tempStack.pop();
      AttributeCollection attr = (AttributeCollection) elem.getAttributes();
      AttributeCollection newAttr = new AttributeCollection(namePool);

      for (int acount = 0; acount < attr.getLength(); acount++) {
        String localName = attr.getLocalName(acount);
        int nameCode = attr.getNameCode(acount);
        String type = attr.getType(acount);
        String value = attr.getValue(acount);
        String uri = attr.getURI(acount);
        String prefix = "";

        if (localName.indexOf(':') > 0) {
          prefix = localName.substring(0, localName.indexOf(':'));
          localName = localName.substring(localName.indexOf(':') + 1);
        }

        if (uri.equals("")
            && ((foStylesheet && localName.equals("id"))
                || (!foStylesheet && (localName.equals("id") || localName.equals("name"))))) {
          // skip this attribute
        } else {
          newAttr.addAttribute(prefix, uri, localName, type, value);
        }
      }

      rtfEmitter.startElement(elem.getNameCode(), newAttr, elem.getNamespaces(), elem.getNSCount());

      elementStack.push(elem);
    }
  }
Exemple #2
0
 private void closeOpenElements(Emitter rtfEmitter) throws TransformerException {
   // Close all the open elements...
   tempStack = new Stack();
   while (!elementStack.empty()) {
     StartElementInfo elem = (StartElementInfo) elementStack.pop();
     rtfEmitter.endElement(elem.getNameCode());
     tempStack.push(elem);
   }
 }