<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>xmlreformat.cpp Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.3-20001105 on Sat Dec 21 14:02:00 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>xmlreformat.cpp</h1><div class="fragment"><pre>00001 <font class="preprocessor">#include "cpl_minixml.h"</font> 00002 00003 <font class="keywordtype">int</font> main( <font class="keywordtype">int</font> argc, <font class="keywordtype">char</font> **argv )<font class="keyword"></font> 00004 <font class="keyword"></font> 00005 <font class="keyword"></font>{ 00006 CPLXMLNode *poTree; 00007 <font class="keywordtype">char</font> szXML[1000000]; 00008 FILE *fp; 00009 <font class="keywordtype">int</font> nLen; 00010 00011 <font class="keywordflow">if</font>( argc == 1 ) 00012 fp = stdin; 00013 <font class="keywordflow">else</font> <font class="keywordflow">if</font>( argv[1][0] == <font class="charliteral">'-'</font> ) 00014 { 00015 printf( <font class="stringliteral">"Usage: xmlreformat [filename]\n"</font> ); 00016 exit( 0 ); 00017 } 00018 <font class="keywordflow">else</font> 00019 { 00020 fp = fopen( argv[1], <font class="stringliteral">"rt"</font> ); 00021 <font class="keywordflow">if</font>( fp == NULL ) 00022 { 00023 printf( <font class="stringliteral">"Failed to open file %s.\n"</font>, argv[1] ); 00024 exit( 1 ); 00025 } 00026 } 00027 00028 nLen = fread( szXML, 1, <font class="keyword">sizeof</font>(szXML), fp ); 00029 00030 <font class="keywordflow">if</font>( fp != stdin ) 00031 fclose( fp ); 00032 00033 szXML[nLen] = <font class="charliteral">'\0'</font>; 00034 00035 poTree = CPLParseXMLString( szXML ); 00036 <font class="keywordflow">if</font>( poTree != NULL ) 00037 printf( <font class="stringliteral">"%s"</font>, CPLSerializeXMLTree( poTree ) ); 00038 } </div></pre><hr><address><small>Generated at Sat Dec 21 14:02:00 2002 for GDAL by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.3-20001105 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2000</small></address> </body> </html>