git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114773 13f79535-47bb-0310-9956-ffa450edef68
64 lines
1.8 KiB
Java
64 lines
1.8 KiB
Java
/* ====================================================================
|
|
* Copyright 2001-2004 The Apache Software Foundation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
* ====================================================================
|
|
*/
|
|
|
|
import org.dom4j.*;
|
|
import org.dom4j.io.*;
|
|
import java.io.*;
|
|
import java.util.*;
|
|
|
|
public class Fix2
|
|
{
|
|
public static void main( String[] args )
|
|
throws Exception
|
|
{
|
|
SAXReader r = new SAXReader();
|
|
|
|
Document d = r.read( new FileReader( args[0] ) );
|
|
|
|
Element root = d.getRootElement();
|
|
|
|
Element id = root.element( "id" );
|
|
|
|
if ( id != null )
|
|
{
|
|
System.out.println( id.getName() );
|
|
|
|
id.setName( "artifactId" );
|
|
}
|
|
|
|
File f = new File( args[0] );
|
|
|
|
f.delete();
|
|
|
|
OutputStream os = new FileOutputStream( args[0] );
|
|
|
|
OutputFormat format = new OutputFormat();
|
|
|
|
format.setIndentSize( 2 );
|
|
|
|
format.setNewlines( true );
|
|
|
|
format.setTrimText( true );
|
|
|
|
XMLWriter writer = new XMLWriter( format );
|
|
|
|
writer.setOutputStream( os );
|
|
|
|
writer.write( d );
|
|
}
|
|
}
|