KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > commons > xml > ExoXMLSerializer


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.commons.xml;
6
7 import org.xmlpull.mxp1_serializer.MXSerializer;
8
9 /**
10  * Jul 8, 2004
11  * @author: Tuan Nguyen
12  * @email: tuan08@users.sourceforge.net
13  * @version: $Id: ExoXMLSerializer.java,v 1.1 2004/07/08 19:24:47 tuan08 Exp $
14  */

15 public class ExoXMLSerializer extends MXSerializer{
16     final static public String JavaDoc INDENTATION =
17     "http://xmlpull.org/v1/doc/properties.html#serializer-indentation" ;
18   final static public String JavaDoc LINE_SEPARATOR =
19     "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator" ;
20   
21   public void element(String JavaDoc ns, String JavaDoc tag, String JavaDoc text) throws Exception JavaDoc {
22     if(text == null) return ;
23     startTag(ns, tag); text(text); endTag(ns, tag) ;
24   }
25   
26   static public ExoXMLSerializer getInstance() {
27     ExoXMLSerializer ser = new ExoXMLSerializer() ;
28     ser.setProperty(ExoXMLSerializer.INDENTATION, " ") ;
29     ser.setProperty(ExoXMLSerializer.LINE_SEPARATOR, "\n") ;
30     return ser ;
31   }
32 }
Popular Tags