Code example for XmlSerializer

Methods: attribute, endDocument, endTag, setPrefix, startDocument, startTag, text

0
      } 
   } 
 
   private void serializeTrack( Uri trackUri, String trackName, XmlSerializer serializer ) throws IOException
   { 
      serializer.startDocument( "UTF-8", true );
      serializer.setPrefix( "xsi", NS_SCHEMA );
      serializer.setPrefix( "kml", NS_KML_22 );
      serializer.startTag( "", "kml" );
      serializer.attribute( NS_SCHEMA, "schemaLocation", NS_KML_22 + " http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd" );
      serializer.attribute( null, "xmlns", NS_KML_22 );
 
      serializer.text( "\n" );
      serializer.startTag( "", "Document" );
      serializer.text( "\n" );
      serializer.startTag( "", "name" );
      serializer.text( trackName );
      serializer.endTag( "", "name" );
 
      /* from <name/> upto <Folder/> */ 
      serializeTrackHeader( serializer, trackUri );
 
      serializer.text( "\n" );
      serializer.endTag( "", "Document" );
 
      serializer.endTag( "", "kml" );
      serializer.endDocument();
   } 
 
   private String serializeTrackHeader( XmlSerializer serializer, Uri trackUri ) throws IOException
   { 
      ContentResolver resolver = mContext.getContentResolver();