Skip to content

PHP & MySQL based web application show or search for XML files in directory tree. It also show content of XML file.

Notifications You must be signed in to change notification settings

krasimirkostadinov/XML-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XML Directory Parser

This is test task, i made by custom reqruimenents.

Task requirements:

  1. Script should parse folders and sub-folders to look for XML files.
  2. Show folders structure and files with WEB UI for user.
  3. Parse/get content of all XML files and option to insert them to database.
  4. Review all current database data.
  5. Search animal with parameter "name". Search should be valid for atleast 3 languages: Bulgarian, Korean, Japaneese.

My solution:

In folder "animals" i created XML files with data objects, reffered to animals. Object structure:

<animal>
  <category></category>
  <name></name>
  <description></description>
  <eat></eat>
</animal>

I build custom PHP API, using Bootstrap 3.0, jQuery, Ajax and PHP-PDO for secure database connection. Escape dangerous tags and possible XSS attack.

I have four tabs on homepage, showing:

  1. Show Database – show all current rows from database
  2. Show XML file paths – show full paths to all XML files inside scanned directory in multiple level deep. - Button to import XML data into database - If XML element exist in database, script will update current row’s data and update value for date_created timestamp.
  3. Show XML file contents – show all structured data from XML files.
  4. Show directory tree – show all files and subfolders inside $dir_path. - Created test files (test.txt) to ensure script escapes not XML files.
  • On the top of the page you can search for animals in database by animal’s name.

  • Filtered XSS validation.

Installation:

  1. Download project ZIP file or clone it via GIT with command:

HTTPS

git clone https://github.com/krasimirkostadinov/XML-Parser.git

SSH

git clone git@github.com:krasimirkostadinov/XML-Parser.git
  1. Create MySQL database at your setup.
  2. Import "animals.sql" file from projec root folder. This is initial database with just a few records.
  3. Configure virtualhost and set execute permission to project root folder (if Linux based).
  4. Please setup your project settings in ./config.php file. !important config settings: - HOST_PATH - host path (also URL) to your local project. It is used also for loading resource files. - DB_USER - user for database connection - DB_PASS - user's password for database connection - $dir_path - folder to parse (default /animals)

Project preview:

  1. Screen with user interface, showing directory structure alt tag

  2. XML file's location alt tag

  3. XML file's contenct with each object data alt tag

  4. Primary search result set alt tag

About

PHP & MySQL based web application show or search for XML files in directory tree. It also show content of XML file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published