//////////////////////////////////////////////////////////////////////
//
//  Create a basic XML document and shows the use of some supported
//  file-related functions (all starting with a '@' character) and
//  the use of application arguments ($0, $1, etc.)
//
//  SetXML Description Language.
//   2008-2013, Nol Danjou. All rights reserved.
//
//  Usage:
//    setxml fileinfo.xml fileinfo.txt readme.htm /batch /create
//
//////////////////////////////////////////////////////////////////////

add root FileInfoList;

	// Add a comment under the root node

	add comment "Sample FileInfo list";


	// Add a FileInfo node for setxml.exe
	
	add element FileInfo;

		// This FileInfo node is the current node from now on

		add attribute "filename" @FileName( $0 );

		add child text "Path"			@FullPath		( $0 );
		add child text "Directory"		@Directory		( $0 );

		add child text "FileSize_KB"	@Size		( $0, "KB", 1 );
		add child text "FileSize_MB"	@Size		( $0, "MB", );

		add child text "Hash"		@Hash	( $0, ); // SHA-1
		
		add child text "PublishDateDay"	@LastWriteTime	( $0, "dd", );
		add child text "PublishDateMon"	@LastWriteTime	( $0, "MM", );
		add child text "PublishDateYr"	@LastWriteTime	( $0, "yyyy", );

		add child text "PublishTimeHr"	@LastWriteTime	( $0,, "hh" );
		add child text "PublishTimeMin"	@LastWriteTime	( $0,, "mm" );
		add child text "PublishTimeSec"	@LastWriteTime	( $0,, "ss" );

		add child text "LastWriteTime"	@LastWriteTime	( $0, "dd/MM/yyyy", "hh:mm:ss" );
		add child text "LastAccessTime"	@LastAccessTime	( $0, "dd/MM/yyyy", "hh:mm:ss" );
		add child text "CreationTime"	@CreationTime	( $0, "dd/MM/yyyy", "hh:mm:ss" );
		
		add child text "CustomVersion"	@Version		( $0, "Version #.## (build #.#)" );

		add child text "Copyright"		@VersionInfo	( $0, "LegalCopyright" );
	
		select parent; // Make root the new current node


	// Add a FileInfo node for file specified in 3rd parameter

	add element FileInfo;

		// This new FileInfo node is the current node from now on

		add attribute "filename" @FileName($3);

		add child text "Path"			@FullPath		( $3 );
		add child text "Directory"		@Directory		( $3 );

		add child text "FileSize_Bytes"	@Size		( $3, "KB", );
		add child text "FileSize_KB"	@Size		( $3, "KB", 0 );
		add child text "FileSize_MB"	@Size		( $3, "MB", );
		add child text "Hash"		@Hash	( $3, ); // SHA-1
		add child text "LastWriteTime"	@LastWriteTime	( $3, "dd/MM/yyyy" , );
		add child text "LastAccessTime"	@LastAccessTime	( $3, "dd/MM/yyyy" , );
		add child text "CreationTime"	@CreationTime	( $3, "dd/MM/yyyy" , );

		select parent; // Make root the new current node


	// Remove FileInfo node for $3 (Comment is child #0)

	//remove child #2;
