コード例 #1
0
  public void startElement(String uri, String localname, String qName, Attributes attributes)
      throws SAXException {

    level++;
    final boolean topLevelElement = level == 1;

    if (!gotElements) {
      // Override default as we just go an element

      assert topLevelElement;

      delimiterNamespaceURI = uri;
      delimiterPrefix = XMLUtils.prefixFromQName(qName);
      delimiterLocalName = XMLUtils.localNameFromQName(qName);

      gotElements = true;
    }

    flushCharacters(false, topLevelElement);
    generateFirstDelimitersIfNeeded();

    // Add or update classes on element if needed
    super.startElement(
        uri, localname, qName, topLevelElement ? getAttributesWithClass(attributes) : attributes);
  }
コード例 #2
0
  private void checkDelimiters(String uri, String qName, boolean topLevel) throws SAXException {

    if (topLevel && delimiterNamespaceURI == null) {
      delimiterNamespaceURI = uri;
      delimiterPrefix = XMLUtils.prefixFromQName(qName);
      delimiterLocalName = XMLUtils.localNameFromQName(qName);
    }

    if (mustGenerateFirstDelimiters) {
      // Generate first delimiter
      beginDelimiterListener.generateFirstDelimiter(this);
      mustGenerateFirstDelimiters = false;
    }
  }
コード例 #3
0
  public OutputInterceptor(
      XMLReceiver output,
      String spanQName,
      Listener beginDelimiterListener,
      boolean isAroundTableOrListElement) {
    super(output);
    this.spanQName = spanQName;
    this.beginDelimiterListener = beginDelimiterListener;
    this.isAroundTableOrListElement = isAroundTableOrListElement;

    // Default to <xhtml:span>
    delimiterNamespaceURI = XMLConstants.XHTML_NAMESPACE_URI;
    delimiterPrefix = XMLUtils.prefixFromQName(spanQName);
    delimiterLocalName = XMLUtils.localNameFromQName(spanQName);
  }