Web application to process XML files and remove elements using a text. You can specify any text to target and remove specific elements from your XML files.
- 🌐 Modern web interface with drag & drop
- 📤 File upload via form or drag and drop
- ⚡ Real-time XML processing
- 📥 Automatic download of processed file
- ✅ File validation (XML only, max 50MB)
- 🎨 Responsive design and easy to use
- Node.js v14 or higher
- npm v6 or higher
-
Navigate to the project directory:
cd clean-xml -
Install dependencies:
npm install
-
Start the server:
npm start
-
Open in browser:
http://localhost:3000
You can use the script directly from the command line:
node clean-xml.js <input-file> <text> [output-file]Examples:
# Automatic output filename (sample.xml -> sample.output.xml)
node clean-xml.js sample.xml "condition[property=\"City\"]"
# Custom output filename
node clean-xml.js sample.xml "condition[property=\"City\"]" custom-output.xml
# Remove all condition elements
node clean-xml.js sample.xml "condition"Or using npm script:
npm run cli sample.xml "condition[property=\"City\"]"Arguments:
input-file: Path to the input XML file (required)text: Text for elements to remove (required)- Examples:
condition[property="City"],condition[type="test"],condition
- Examples:
output-file: Path for the processed output XML file (optional)- If omitted, output will be automatically generated as
[input-name].output.xml - Example:
sample.xml→sample.output.xml
- If omitted, output will be automatically generated as
- Open the application in your browser (default:
http://localhost:3000) - Enter the text for elements you want to remove (e.g.,
condition[property="City"]) - Upload your XML file in one of these ways:
- Click on the upload area and select a file
- Drag and drop the XML file into the upload area
- Verify that the file has been selected correctly
- Click "Process File"
- The processed file will automatically download with the
.output.xmlsuffix
You can also use the endpoint directly:
curl -X POST http://localhost:3000/process \
-F "xmlFile=@your_file.xml" \
-F "text=condition[property=\"City\"]" \
-o output_file.xmlYou can configure the server port using the PORT environment variable:
PORT=8080 npm start- Maximum file size: 50MB
- Accepted file types:
.xml,application/xml,text/xml
The utility processes XML files and removes all elements matching the specified text. You can use any valid text to target specific elements.
Example 1 - Remove by property:
Before:
<profile>
<condition property="City" value="Madrid" />
<condition property="Age" value="25" />
<condition property="City" value="Barcelona" />
</profile>Text: condition[property="City"]
After:
<profile>
<condition property="Age" value="25" />
</profile>Example 2 - Remove all conditions:
Text: condition
This will remove all <condition> elements regardless of their attributes.
- Express.js - Web framework for Node.js
- Multer - Middleware for handling multipart/form-data files
- JSDOM - DOM implementation for Node.js
- HTML5/CSS3/JavaScript - Modern frontend
clean-xml/
├── README.md # This file
├── package.json # Configuration and dependencies
├── server.js # Express server and processing logic
├── clean-xml.js # CLI script for command-line usage
├── public/ # Static files
│ └── index.html # User interface
└── node_modules/ # Dependencies (generated)
- Verify that port 3000 is not in use
- Make sure all dependencies are installed (
npm install)
- Verify that the file is a valid XML
- Check that the file size does not exceed 50MB
- Check the server console for more error details
- Verify your browser's automatic download settings
- Some browsers may require permission to download files
npm start- Start the web server in production modenpm run dev- Start the web server (alias for start)npm run cli- Run the CLI script (requires arguments: input-file text [output-file])
- Files are processed in memory and not stored on the server
- Strict file type validation
- File size limit to prevent abuse
MIT
Node.js utilities project
Version: 1.0.0
Last updated: January 2026