Code example for XmlSerializer

Methods: attributeendTagstartTagtext

0
      String content)
      throws IOException { 
    if (content == null) {
      return; 
    } 
    serializer.startTag(null /* ns */, "content");
    serializer.attribute(null /* ns */, "type", "text");
    serializer.text(content);
    serializer.endTag(null /* ns */, "content");
  } 
 
  private static void serializeAuthor(XmlSerializer serializer,
      String author,
      String email)
      throws IOException { 
    if (StringUtils.isEmpty(author) || StringUtils.isEmpty(email)) {
      return; 
    } 
    serializer.startTag(null /* ns */, "author");
    serializer.startTag(null /* ns */, "name");