Strabon

changeset 568:e77af8806201

Fixes Ticket #12
author Babis Nikolaou <charnik@di.uoa.gr>
date Fri Sep 28 02:48:16 2012 +0300 (2012-09-28)
parents f0e942e210e0
children 3980b4ac9276 0223607ec93f
files resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java
line diff
     1.1 --- a/resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java	Thu Sep 27 20:39:23 2012 +0300
     1.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java	Fri Sep 28 02:48:16 2012 +0300
     1.3 @@ -46,71 +46,85 @@
     1.4  /**
     1.5   * @author Manos Karpathiotakis <mk@di.uoa.gr>
     1.6   * @author Charalampos Nikolaou <charnik@di.uoa.gr>
     1.7 + * @authro Panayiotis Smeros <psmeros@di.uoa.gr>
     1.8   *
     1.9   */
    1.10  public class stSPARQLResultsKMLWriter implements TupleQueryResultWriter
    1.11  {
    1.12  	private static final Logger logger = LoggerFactory.getLogger(org.openrdf.query.resultio.sparqlkml.stSPARQLResultsKMLWriter.class);
    1.13 -	private static final String ROOT_TAG = "kml";
    1.14 -	private static final String NAMESPACE = "http://www.opengis.net/kml/2.2";
    1.15 -	private static final String RESULT_SET_TAG = "Folder";
    1.16 -	private static final String PLACEMARK_TAG = "Placemark";
    1.17 -	private static final String NAME_TAG = "name";
    1.18 -	private static final String DESC_TAG = "description";
    1.19 -	private static final String STYLE_TAG = "Style";
    1.20 -	private static final String STYLEMAP_TAG = "StyleMap";
    1.21 -	private static final String LINESTYLE_TAG = "LineStyle";
    1.22 -	private static final String POLYSTYLE_TAG = "PolyStyle";
    1.23 -	private static final String STYLE_ID = "resultStyle";
    1.24 -	private static final String TABLE_ROW_BEGIN = "<TR>";
    1.25 -	private static final String TABLE_ROW_END = "</TR>";
    1.26 -	private static final String TABLE_DATA_BEGIN = "<TD>";
    1.27 -	private static final String TABLE_DATA_END = "</TD>";
    1.28 -	private static final String NEWLINE = "\n";
    1.29 -	private static final String TABLE_DESC_BEGIN = "<![CDATA[<TABLE border=\"1\">" + NEWLINE;
    1.30 -	private static final String TABLE_DESC_END = "</TABLE>]]>" + NEWLINE;
    1.31 -	private static final String GEOMETRY_NAME = "Geometry";
    1.32 -	private static final String MULTIGEOMETRY = "MultiGeometry";
    1.33 +	private static final String ROOT_TAG 			= "kml";
    1.34 +	private static final String NAMESPACE 			= "http://www.opengis.net/kml/2.2";
    1.35 +	private static final String RESULT_SET_TAG 		= "Folder";
    1.36 +	private static final String PLACEMARK_TAG 		= "Placemark";
    1.37 +	private static final String NAME_TAG 			= "name";
    1.38 +	private static final String DESC_TAG 			= "description";
    1.39 +	private static final String STYLE_TAG 			= "Style";
    1.40 +	private static final String STYLEMAP_TAG 		= "StyleMap";
    1.41 +	private static final String LINESTYLE_TAG 		= "LineStyle";
    1.42 +	private static final String POLYSTYLE_TAG 		= "PolyStyle";
    1.43 +	private static final String STYLE_ID 			= "resultStyle";
    1.44 +	private static final String TABLE_ROW_BEGIN 	= "<TR>";
    1.45 +	private static final String TABLE_ROW_END 		= "</TR>";
    1.46 +	private static final String TABLE_DATA_BEGIN 	= "<TD>";
    1.47 +	private static final String TABLE_DATA_END 		= "</TD>";
    1.48 +	private static final String NEWLINE 			= "\n";
    1.49 +	private static final String TABLE_DESC_BEGIN 	= "<![CDATA[<TABLE border=\"1\">" + NEWLINE;
    1.50 +	private static final String TABLE_DESC_END 		= "</TABLE>]]>" + NEWLINE;
    1.51 +	private static final String GEOMETRY_NAME 		= "Geometry";
    1.52 +	private static final String MULTIGEOMETRY 		= "MultiGeometry";
    1.53 +	
    1.54  	// Styling options
    1.55 -	private static final int numOfStyles=5;
    1.56 +	private static final int numOfStyles 			= 5;
    1.57 +	
    1.58  	private static final String[][] styles = {
    1.59  		// note that colors are encoded as "aabbggrr" strings where
    1.60  		// aa=alpha (00 to ff); bb=blue (00 to ff); gg=green (00 to ff); rr=red
    1.61  		// (00 to ff).
    1.62  		// id, line width, line color, polygon fill, mouse over line width,
    1.63  		// mouse over line color mouse over polygon fill
    1.64 -		{STYLE_ID + "1", "1.5", "7dff0000", "adff0000", "1.5", "7d0000ff", "ad0000ff"}, {STYLE_ID + "2", "1.5", "7d00ff00", "ad00ff00", "1.5", "7d0000ff", "ad0000ff"}, {STYLE_ID + "3", "1.5", "7d550000", "ad550000", "1.5", "7d0000ff", "ad0000ff"}, {STYLE_ID + "4", "1.5", "7d005500", "ad005500", "1.5", "7d0000ff", "ad0000ff"}, {STYLE_ID + "5", "1.5", "7d000055", "ad000055", "1.5", "7d0000ff", "ad0000ff"},};
    1.65 +		{STYLE_ID + "1", "1.5", "7dff0000", "adff0000", "1.5", "7d0000ff", "ad0000ff"}, 
    1.66 +		{STYLE_ID + "2", "1.5", "7d00ff00", "ad00ff00", "1.5", "7d0000ff", "ad0000ff"}, 
    1.67 +		{STYLE_ID + "3", "1.5", "7d550000", "ad550000", "1.5", "7d0000ff", "ad0000ff"}, 
    1.68 +		{STYLE_ID + "4", "1.5", "7d005500", "ad005500", "1.5", "7d0000ff", "ad0000ff"}, 
    1.69 +		{STYLE_ID + "5", "1.5", "7d000055", "ad000055", "1.5", "7d0000ff", "ad0000ff"}};
    1.70  
    1.71  	/**
    1.72  	 * The underlying XML formatter.
    1.73  	 */
    1.74  	private stSPARQLXMLWriter xmlWriter;
    1.75 +	
    1.76  	/**
    1.77  	 * The number of results seen.
    1.78  	 */
    1.79  	private int nresults;
    1.80 +	
    1.81  	/**
    1.82  	 * The number of geometries seen.
    1.83  	 */
    1.84  	private int ngeometries;
    1.85 +	
    1.86  	/**
    1.87  	 * The JTS wrapper
    1.88  	 */
    1.89  	private JTSWrapper jts;
    1.90 +	
    1.91  	/**
    1.92  	 * Stream for manipulating geometries
    1.93  	 */
    1.94  	private ByteArrayOutputStream baos;
    1.95 +	
    1.96  	/**
    1.97  	 * Description string holding the projected variables
    1.98  	 * of the SPARQL query
    1.99  	 */
   1.100  	private StringBuilder descHeader;
   1.101 +	
   1.102  	/**
   1.103  	 * Description string holding the values for the
   1.104  	 * projected variables of the SPARQL query
   1.105  	 */
   1.106  	private StringBuilder descData;
   1.107 +	
   1.108  	/**
   1.109  	 * Indentation used in tags that are constructed manually
   1.110  	 */
   1.111 @@ -122,13 +136,11 @@
   1.112  	 * 
   1.113  	 * @param out
   1.114  	 */
   1.115 -	public stSPARQLResultsKMLWriter(OutputStream out)
   1.116 -	{
   1.117 -		this(new stSPARQLXMLWriter(out));
   1.118 +	public stSPARQLResultsKMLWriter(OutputStream out) {
   1.119 +		this (new stSPARQLXMLWriter(out));
   1.120  	}
   1.121  
   1.122 -	public stSPARQLResultsKMLWriter(stSPARQLXMLWriter writer)
   1.123 -	{
   1.124 +	public stSPARQLResultsKMLWriter(stSPARQLXMLWriter writer) {
   1.125  		xmlWriter = writer;
   1.126  		xmlWriter.setPrettyPrint(true);
   1.127  		depth = 4;
   1.128 @@ -140,17 +152,15 @@
   1.129  		ngeometries = 0;
   1.130  	}
   1.131  
   1.132 -	@Override public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException
   1.133 -	{
   1.134 -		try
   1.135 -		{
   1.136 +	@Override
   1.137 +	public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException {
   1.138 +		try {
   1.139  			xmlWriter.startDocument();
   1.140  			xmlWriter.setAttribute("xmlns", NAMESPACE);
   1.141  			xmlWriter.startTag(ROOT_TAG);
   1.142  			xmlWriter.startTag(RESULT_SET_TAG);
   1.143  			// add default styles
   1.144 -			for(String[] style: styles)
   1.145 -			{
   1.146 +			for (String[] style: styles) {
   1.147  				String id = style[0];
   1.148  				String lineWidth = style[1];
   1.149  				String lineColor = style[2];
   1.150 @@ -191,82 +201,70 @@
   1.151  				xmlWriter.endTag(STYLEMAP_TAG);
   1.152  			}
   1.153  			// end of default style definition
   1.154 -		}
   1.155 -		catch(IOException e)
   1.156 -		{
   1.157 +			
   1.158 +		} catch (IOException e) {
   1.159  			throw new TupleQueryResultHandlerException(e);
   1.160  		}
   1.161  	}
   1.162  
   1.163 -	@Override public void endQueryResult() throws TupleQueryResultHandlerException
   1.164 -	{
   1.165 -		try
   1.166 -		{
   1.167 +	@Override
   1.168 +	public void endQueryResult() throws TupleQueryResultHandlerException {
   1.169 +		try {
   1.170  			xmlWriter.endTag(RESULT_SET_TAG);
   1.171  			xmlWriter.endTag(ROOT_TAG);
   1.172  			xmlWriter.endDocument();
   1.173  			baos.close();
   1.174 -			if(ngeometries < nresults)
   1.175 -			{
   1.176 +			
   1.177 +			if (ngeometries < nresults) {
   1.178  				logger.warn("[Strabon.KMLWriter] No spatial binding found in the result. KML requires that at least one binding maps to a geometry.", nresults);
   1.179  			}
   1.180 -		}
   1.181 -		catch(IOException e)
   1.182 -		{
   1.183 +		} catch (IOException e) {
   1.184  			throw new TupleQueryResultHandlerException(e);
   1.185  		}
   1.186  	}
   1.187  
   1.188 -	@Override public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException
   1.189 -	{
   1.190 -		try
   1.191 -		{
   1.192 +	@Override
   1.193 +	public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException {
   1.194 +		try {
   1.195  			// true if there are bindings that do not correspond to geometries
   1.196  			boolean hasDesc = false;
   1.197 +			
   1.198  			// increase result size
   1.199  			nresults++;
   1.200 +			
   1.201  			// create description table and header
   1.202  			indent(descHeader, depth);
   1.203  			descHeader.append(TABLE_DESC_BEGIN);
   1.204  			indent(descHeader, depth);
   1.205 -			descHeader.append(TABLE_ROW_BEGIN);
   1.206 -			// create description table data row
   1.207 -			descData.append(NEWLINE);
   1.208 -			indent(descData, depth);
   1.209 -			descData.append(TABLE_ROW_BEGIN);
   1.210  			
   1.211  			List<String> polygons = new ArrayList<String>();
   1.212 +			
   1.213  			// parse binding set
   1.214 -			for(Binding binding: bindingSet)
   1.215 -			{
   1.216 +			for (Binding binding: bindingSet) {
   1.217  				Value value = binding.getValue();
   1.218  				// check for geometry value
   1.219 -				if(XMLGSDatatypeUtil.isGeometryValue(value))
   1.220 -				{
   1.221 +				if (XMLGSDatatypeUtil.isGeometryValue(value)) {
   1.222  					ngeometries++;
   1.223 -					if(logger.isDebugEnabled())
   1.224 -					{
   1.225 +					if (logger.isDebugEnabled()) {
   1.226  						logger.debug("[Strabon] Found geometry: {}", value);
   1.227  					}
   1.228  					polygons.add(getPolygon(value));
   1.229 -				}
   1.230 -				else
   1.231 -				{ // URI, BlankNode, or Literal other than spatial literal
   1.232 -					if(logger.isDebugEnabled())
   1.233 -					{
   1.234 +					
   1.235 +				} else { // URI, BlankNode, or Literal other than spatial literal
   1.236 +					if (logger.isDebugEnabled()) {
   1.237  						logger.debug("[Strabon.KMLWriter] Found URI/BlankNode/Literal ({}): {}", value.getClass(), value);
   1.238  					}
   1.239 +					
   1.240  					// mark that we found sth corresponding to the description
   1.241  					hasDesc = true;
   1.242 +					
   1.243  					// write description
   1.244  					writeDesc(binding);
   1.245  				}
   1.246  			}
   1.247  			
   1.248 -			
   1.249 -			//write each polygon in separate placemarks
   1.250 -			for(String polygon : polygons)
   1.251 -			{
   1.252 +			// write each polygon in separate placemarks
   1.253 +			for (String polygon : polygons) {
   1.254  				xmlWriter.startTag(PLACEMARK_TAG);			
   1.255  				xmlWriter.textElement("styleUrl", "#" + styles[polygons.indexOf(polygon)%(numOfStyles-2)][0]);
   1.256  
   1.257 @@ -277,7 +275,6 @@
   1.258  				xmlWriter.endTag(PLACEMARK_TAG);
   1.259  			}
   1.260  			
   1.261 -			
   1.262  			//also write them in the same placemarks
   1.263  			
   1.264  			xmlWriter.startTag(PLACEMARK_TAG);
   1.265 @@ -285,35 +282,32 @@
   1.266  			xmlWriter.textElement("styleUrl", "#" + styles[(numOfStyles-1)][0]);
   1.267  			
   1.268  			xmlWriter.startTag(MULTIGEOMETRY);
   1.269 -			for(String polygon : polygons)
   1.270 -			{
   1.271 +			for(String polygon : polygons) {
   1.272  				xmlWriter.unescapedText(polygon);
   1.273  			}
   1.274  			xmlWriter.endTag(MULTIGEOMETRY);
   1.275  			
   1.276  			// we have found and constructed a description for this result.
   1.277  			// Write it down.
   1.278 -			if(hasDesc)
   1.279 -			{
   1.280 -				// close the header of the description
   1.281 -				descHeader.append(NEWLINE);
   1.282 -				indent(descHeader, depth);
   1.283 -				descHeader.append(TABLE_ROW_END);
   1.284 +			if (hasDesc) {
   1.285  				// end the placeholder for the description data
   1.286 -				descData.append(NEWLINE);
   1.287  				indent(descData, depth);
   1.288 -				descData.append(TABLE_ROW_END);
   1.289 +				
   1.290  				// append to the table header the actual content from
   1.291  				// the bindings
   1.292  				descHeader.append(descData);
   1.293 +				
   1.294  				// close the table for the description
   1.295  				descHeader.append(NEWLINE);
   1.296  				indent(descHeader, depth);
   1.297  				descHeader.append(TABLE_DESC_END);
   1.298 +				
   1.299  				// begin the "description" tag
   1.300  				xmlWriter.startTag(DESC_TAG);
   1.301 +				
   1.302  				// write the actual description
   1.303  				xmlWriter.unescapedText(descHeader.toString());
   1.304 +				
   1.305  				// end the "description" tag
   1.306  				xmlWriter.endTag(DESC_TAG);
   1.307  			}
   1.308 @@ -322,103 +316,92 @@
   1.309  			descData.setLength(0);
   1.310  
   1.311  			xmlWriter.endTag(PLACEMARK_TAG);
   1.312 -		}
   1.313 -		catch(IOException e)
   1.314 -		{
   1.315 +			
   1.316 +		} catch (IOException e) {
   1.317  			throw new TupleQueryResultHandlerException(e);
   1.318  		}
   1.319  	}
   1.320  
   1.321 -	private String getPolygon(Value value)
   1.322 -	{
   1.323 -		String polygon="";
   1.324 +	private String getPolygon(Value value) {
   1.325 +		String polygon = "";
   1.326  		QName geometryType = null;
   1.327 +		
   1.328  		// the underlying geometry in value
   1.329  		Geometry geom = null;
   1.330 +		
   1.331  		// the underlying SRID of the geometry
   1.332  		int srid = -1;
   1.333 +		
   1.334  		// get the KML encoder
   1.335  		Encoder encoder = null;
   1.336 -		try
   1.337 -		{
   1.338 +		
   1.339 +		try {
   1.340  			encoder = new Encoder(new KMLConfiguration());
   1.341  			encoder.setIndenting(true);
   1.342 -			if(value instanceof GeneralDBPolyhedron)
   1.343 -			{
   1.344 +			
   1.345 +			if (value instanceof GeneralDBPolyhedron) {
   1.346  				GeneralDBPolyhedron dbpolyhedron = (GeneralDBPolyhedron) value;
   1.347  				geom = dbpolyhedron.getPolyhedron().getGeometry();
   1.348  				srid = dbpolyhedron.getPolyhedron().getGeometry().getSRID();
   1.349 -			}
   1.350 -			else
   1.351 -			{ // spatial literal
   1.352 +				
   1.353 +			} else { // spatial literal
   1.354  				Literal spatial = (Literal) value;
   1.355  				String geomRep = spatial.stringValue();
   1.356 -				if(XMLGSDatatypeUtil.isWKTLiteral(spatial))
   1.357 -				{ // WKT
   1.358 +				
   1.359 +				if (XMLGSDatatypeUtil.isWKTLiteral(spatial)) { // WKT
   1.360  					geom = jts.WKTread(WKTHelper.getWithoutSRID(geomRep));
   1.361  					srid = WKTHelper.getSRID(geomRep);
   1.362 -				}
   1.363 -				else
   1.364 -				{ // GML
   1.365 +				} else { // GML
   1.366  					geom = jts.GMLread(geomRep);
   1.367  					srid = geom.getSRID();
   1.368  				}
   1.369  			}
   1.370 +
   1.371  			// transform the geometry to {@link GeoConstants#defaultSRID}
   1.372  			geom = jts.transform(geom, srid, GeoConstants.defaultSRID);
   1.373 -			if(geom instanceof Point)
   1.374 -			{
   1.375 +			if (geom instanceof Point) {
   1.376  				geometryType = KML.Point;
   1.377 +				
   1.378 +			} else if (geom instanceof Polygon) {
   1.379 +				geometryType = KML.Polygon;
   1.380 +				
   1.381 +			} else if (geom instanceof LineString) {
   1.382 +				geometryType = KML.LineString;
   1.383 +				
   1.384 +			} else if (geom instanceof MultiPoint) {
   1.385 +				geometryType = KML.MultiGeometry;
   1.386 +				
   1.387 +			} else if (geom instanceof MultiLineString) {
   1.388 +				geometryType = KML.MultiGeometry;
   1.389 +				
   1.390 +			} else if (geom instanceof MultiPolygon) {
   1.391 +				geometryType = KML.MultiGeometry;
   1.392 +				
   1.393 +			} else if (geom instanceof GeometryCollection) {
   1.394 +				geometryType = KML.MultiGeometry;
   1.395 +				
   1.396  			}
   1.397 -			else if(geom instanceof Polygon)
   1.398 -			{
   1.399 -				geometryType = KML.Polygon;
   1.400 -			}
   1.401 -			else if(geom instanceof LineString)
   1.402 -			{
   1.403 -				geometryType = KML.LineString;
   1.404 -			}
   1.405 -			else if(geom instanceof MultiPoint)
   1.406 -			{
   1.407 -				geometryType = KML.MultiGeometry;
   1.408 -			}
   1.409 -			else if(geom instanceof MultiLineString)
   1.410 -			{
   1.411 -				geometryType = KML.MultiGeometry;
   1.412 -			}
   1.413 -			else if(geom instanceof MultiPolygon)
   1.414 -			{
   1.415 -				geometryType = KML.MultiGeometry;
   1.416 -			}
   1.417 -			else if(geom instanceof GeometryCollection)
   1.418 -			{
   1.419 -				geometryType = KML.MultiGeometry;
   1.420 -			}
   1.421 -			if(geometryType == null)
   1.422 -			{
   1.423 +			
   1.424 +			if (geometryType == null) {
   1.425  				logger.warn("[Strabon.KMLWriter] Found unknown geometry type.");
   1.426 -			}
   1.427 -			else
   1.428 -			{
   1.429 +				
   1.430 +			} else {
   1.431  				encoder.encode(geom, geometryType, baos);
   1.432 -				polygon=baos.toString().substring(38).replaceAll(" xmlns:kml=\"http://earth.google.com/kml/2.1\"", "").replaceAll("kml:", "");
   1.433 +				polygon = baos.toString().substring(38).replaceAll(" xmlns:kml=\"http://earth.google.com/kml/2.1\"", "").replaceAll("kml:", "");
   1.434  				
   1.435 -				/*get the polygon from the kml*/
   1.436 -				polygon=polygon.substring(polygon.indexOf("<Polygon>"), polygon.indexOf("</Polygon>")+10);
   1.437 +				// get the polygon from the kml
   1.438 +				polygon = polygon.substring(polygon.indexOf("<Polygon>"), polygon.indexOf("</Polygon>")+10);
   1.439  				baos.reset();
   1.440  			}
   1.441 -		}
   1.442 -		catch(ParseException e)
   1.443 -		{
   1.444 +		} catch (ParseException e) {
   1.445  			logger.error("[Strabon.KMLWriter] Parse error exception of geometry: {}", e.getMessage());
   1.446 -		}
   1.447 -		catch(IOException e)
   1.448 -		{
   1.449 +			
   1.450 +		} catch (IOException e) {
   1.451  			logger.error("[Strabon.KMLWriter] IOException during KML encoding of geometry: {}", e.getMessage());
   1.452 -		}
   1.453 -		catch(JAXBException e)
   1.454 -		{
   1.455 +			
   1.456 +		} catch (JAXBException e) {
   1.457  			logger.error("[Strabon.KMLWriter] Exception during GML parsing: {}", e.getMessage());
   1.458 +			
   1.459  		}
   1.460  		
   1.461  		return polygon;
   1.462 @@ -429,26 +412,29 @@
   1.463  	 * 
   1.464  	 * @param binding
   1.465  	 */
   1.466 -	private void writeDesc(Binding binding)
   1.467 -	{
   1.468 -		descHeader.append(NEWLINE);
   1.469 -		indent(descHeader, depth + 1);
   1.470 -		descHeader.append(TABLE_DATA_BEGIN);
   1.471 -		descHeader.append(binding.getName());
   1.472 -		descHeader.append(TABLE_DATA_END);
   1.473 +	private void writeDesc(Binding binding) {
   1.474  		descData.append(NEWLINE);
   1.475  		indent(descData, depth + 1);
   1.476 +		descData.append(TABLE_ROW_BEGIN);
   1.477 +
   1.478  		descData.append(TABLE_DATA_BEGIN);
   1.479 -		if(binding.getValue() instanceof BNode)
   1.480 -		{
   1.481 +		descData.append(binding.getName());
   1.482 +		descData.append(TABLE_DATA_END);
   1.483 +		
   1.484 +		descData.append(TABLE_DATA_BEGIN);
   1.485 +		
   1.486 +		if (binding.getValue() instanceof BNode) {
   1.487  			descData.append("_:");
   1.488  		}
   1.489 +		
   1.490  		descData.append(binding.getValue().stringValue());
   1.491  		descData.append(TABLE_DATA_END);
   1.492 +		
   1.493 +		descData.append(TABLE_ROW_END);
   1.494  	}
   1.495  
   1.496 -	@Override public TupleQueryResultFormat getTupleQueryResultFormat()
   1.497 -	{
   1.498 +	@Override
   1.499 +	public TupleQueryResultFormat getTupleQueryResultFormat() {
   1.500  		return stSPARQLQueryResultFormat.KML;
   1.501  	}
   1.502  
   1.503 @@ -459,10 +445,8 @@
   1.504  	 * @param sb
   1.505  	 * @param depth
   1.506  	 */
   1.507 -	private void indent(StringBuilder sb, int depth)
   1.508 -	{
   1.509 -		for(int i = 0; i < depth; i++)
   1.510 -		{
   1.511 +	private void indent(StringBuilder sb, int depth) {
   1.512 +		for (int i = 0; i < depth; i++) {
   1.513  			sb.append(xmlWriter.getIndentString());
   1.514  		}
   1.515  	}