GithubHelp home page GithubHelp logo

xml-file-parser's Introduction

XML Data Parser

A simple XML parser that converts an xml file to json

Get Started

  • First run bundle
  • To run the app ruby main.rb
  • To run the tests rspec --format documentation

Libraires used

Input

<InvioPostale unique_id="9932" office="Poste Piazza Mazzini Roma">
  <Topic>Raccomandate auguri di natale</Topic>
  <data>
      <invio id="1">
        <FirstName>Giovanni</FirstName>
        <LastName>Panasiti</LastName>
        <ContactNo>1234567890</ContactNo>
        <AttachmentName>cartolina_auguri_123.pdf</AttachmentName>
        <Address>
             <City>ROMA RM</City>
             <Street>Via di monte del gallo 51</Street>
             <Zip>00165</Zip>
             <Country>Italy</Country>
        </Address>
      </invio>
      <invio id="2">
        <FirstName>Niccolò</FirstName>
        <LastName>Cirone</LastName>
        <ContactNo>434334344334</ContactNo>
        <AttachmentName>cartolina_vacanze.pdf</AttachmentName>
        <Address>
             <City>ROMA RM</City>
             <Street>Via di monte del gallo 101</Street>
             <Zip>00165</Zip>
             <Country>Italy</Country>
        </Address>
      </invio>
      <invio id="3">
        <FirstName>Giuseppe</FirstName>
        <LastName>Dell'Ombra</LastName>
        <ContactNo>32323222</ContactNo>
        <AttachmentName>cartolina_supermercato.pdf</AttachmentName>
        <Address>
             <City>ROMA RM</City>
             <Street>Via tiburtina 101</Street>
             <Zip>00185</Zip>
             <Country>Italy</Country>
        </Address>
      </invio>
  </data>
</InvioPostale>

Output

{
   "unique_id":"9932",
   "office":"Poste Piazza Mazzini Roma",
   "Topic":"Raccomandate auguri di natale",
   "data":[
      {
         "id":"1",
         "FirstName":"Giovanni",
         "LastName":"Panasiti",
         "ContactNo":"1234567890",
         "AttachmentName":"cartolina_auguri_123.pdf",
         "Address":{
            "City":"ROMA RM",
            "Street":"Via di monte del gallo 51",
            "Zip":"00165",
            "Country":"Italy"
         }
      },
      {
         "id":"2",
         "FirstName":"Niccolò",
         "LastName":"Cirone",
         "ContactNo":"434334344334",
         "AttachmentName":"cartolina_vacanze.pdf",
         "Address":{
            "City":"ROMA RM",
            "Street":"Via di monte del gallo 101",
            "Zip":"00165",
            "Country":"Italy"
         }
      },
      {
         "id":"3",
         "FirstName":"Giuseppe",
         "LastName":"Dell'Ombra",
         "ContactNo":"32323222",
         "AttachmentName":"cartolina_supermercato.pdf",
         "Address":{
            "City":"ROMA RM",
            "Street":"Via tiburtina 101",
            "Zip":"00185",
            "Country":"Italy"
         }
      }
   ]
}

xml-file-parser's People

Contributors

azdrenymeri avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.