Skip to content

Commit

Permalink
Merge pull request #3 from webability-go/late-night
Browse files Browse the repository at this point in the history
v0.0.2
  • Loading branch information
metalwolf committed Apr 3, 2020
2 parents 03f6dcb + 28227d5 commit a3ba76e
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions wajaf.go
Expand Up @@ -2,24 +2,64 @@
// Use of this source code is governed by a MIT licence.
// license that can be found in the LICENSE file.

// Package wajaf is a javascript to go synchronized framework
// Package wajaf is a go <=> javascript synchronized framework
//
package wajaf

import (
"encoding/xml"
"fmt"
)

// VERSION is the used version nombre of the XCore library.
const VERSION = "0.0.0"
const VERSION = "0.0.2"

// LOG is the flag to activate logging on the library.
// if LOG is set to TRUE, LOG indicates to the XCore libraries to log a trace of functions called, with most important parameters.
// LOG can be set to true or false dynamically to trace only parts of code on demand.
var LOG = false

type App struct {
ID string `xml:"id,attr"`
// Entry string `xml:",chardata"`
Containers []Container `xml:"container"`
Elements []Element `xml:"element"`
Events []Event `xml:"event"`
}

type Container struct {
ID string `xml:"id,attr"`
Type string `xml:"type,attr"`
Zones []Zone `xml:"zone"`
Events []Event `xml:"event"`
}

type Zone struct {
ID string `xml:"id,attr"`
Type string `xml:"type,attr"`
Containers []Container `xml:"container"`
Elements []Element `xml:"element"`
Events []Event `xml:"event"`
}

type Element struct {
ID string `xml:"id,attr"`
Type string `xml:"type,attr"`
}

type Event struct {
Type string `xml:"type,attr"`
}

func NewFromXMLString(data string) *App {

return &App{}
app := &App{}
// Unmarshal
xml.Unmarshal([]byte(data), app)

fmt.Printf("%#v\n", app)

return app
}

func (a *App) GetJSON() string {
Expand Down

0 comments on commit a3ba76e

Please sign in to comment.