Coder Social home page Coder Social logo

toxmldemo's Introduction

toxmldemo

Small demo project which is written in GO and using NEX (improved LEX written in GO) and YACC approach to parse and convert to XML hierarchial data with the following format:

AmpQueryRepChoice {

   tradeRep {                                   

      tradeId {                                 
         tradeNo = 20160711-000000060000
         speedIndex = -1 
         \{\}
         fake1 = 123
         fake2 =
      }
      p1 = 098
      p2 = SDF
      p3 =
      p4 = RTY 
GHT
FRE
      statics {                                 
         chainId = 1                            
         buyOrderId {                           
            orderDate = 20160711                
            orderNo = 936                       
         }
         gol1 = qwdef
         gol2 = fsdsfsfsfsffs
         sellOrderId {                          
            so1 = 11111                         
            2222
            so2 =                               
         }
         gol3 = asdrethheaw
      }
   }
}

As you can see value of the properties can have many "words" which can be located on the different lines. There is no special delimiter to mark end of the property's value.

To use converter:

./toxmldemo <testdata/test.txt | xmllint --format -

Formatted XML, generated from the data above:

<?xml version="1.0"?>
<AmpQueryRepChoice>
  <tradeRep>
    <tradeId>
      <tradeNo>20160711-000000060000</tradeNo>
      <speedIndex>-1 \{\}</speedIndex>
      <fake1>123</fake1>
      <fake2/>
    </tradeId>
    <p1>098</p1>
    <p2>SDF</p2>
    <p3/>
    <p4>RTY GHT FRE</p4>
    <statics>
      <chainId>1</chainId>
      <buyOrderId>
        <orderDate>20160711</orderDate>
        <orderNo>936</orderNo>
      </buyOrderId>
      <gol1>qwdef</gol1>
      <gol2>fsdsfsfsfsffs</gol2>
      <sellOrderId>
        <so1>11111 2222</so1>
        <so2/>
      </sellOrderId>
      <gol3>asdrethheaw</gol3>
    </statics>
  </tradeRep>
</AmpQueryRepChoice>

toxmldemo's People

Contributors

alex-shekhter avatar

Watchers

James Cloos avatar  avatar

toxmldemo's Issues

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.