コード例 #1
0
 @Override
 public void attribute(Name name, String value) throws IOException {
   write(' ');
   if (name.nsUriIndex == -1) {
     localNames[name.localNameIndex].write(this);
   } else writeName(name);
   write(EQUALS);
   doText(value, true);
   write('\"');
 }
コード例 #2
0
 public void attribute(int prefix, String localName, String value) throws IOException {
   write(' ');
   if (prefix == -1) {
     textBuffer.set(localName);
     textBuffer.write(this);
   } else writeName(prefix, localName);
   write(EQUALS);
   doText(value, true);
   write('\"');
 }
コード例 #3
0
  /** Writes a single namespace declaration for the specified prefix. */
  protected final void writeNsDecl(int prefixIndex) throws IOException {
    String p = nsContext.getPrefix(prefixIndex);

    if (p.length() == 0) {
      if (nsContext.getCurrent().isRootElement()
          && nsContext.getNamespaceURI(prefixIndex).length() == 0)
        return; // no point in declaring xmlns="" on the root element
      write(XMLNS_EQUALS);
    } else {
      Encoded e = prefixes[prefixIndex];
      write(XMLNS_COLON);
      write(e.buf, 0, e.len - 1); // skip the trailing ':'
      write(EQUALS);
    }
    doText(nsContext.getNamespaceURI(prefixIndex), true);
    write('\"');
  }
コード例 #4
0
 public void text(String value, boolean needSP) throws IOException {
   closeStartTag();
   if (needSP) write(' ');
   doText(value, false);
 }