Coder Social home page Coder Social logo

slipke / eurlex-model-go Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 12 KB

This projects implements the EUR-Lex XML data model in Golang. For more information see README.md

License: MIT License

Makefile 0.26% Go 99.74%
eurlex eur-lex datamodel data webservice

eurlex-model-go's Introduction

eurlex-model-go

Overview

eurlex-model-go implements the XML data model used by EUR-Lex in Golang. It is required by eurlex-ws-go, which implements the Webservice (Search), and Cellar.

Install

go get -u github.com/slipke/eurlex-model-go

Usage

Retrieve the XML from either the Webservice or Cellar, or alternatively directly from the website (i.e. celex:32008R1272 and click on "Download notice"). Afterwards, the resulting XML file can be parsed by using the exemplary code:

import (
	"encoding/xml"
	"io/ioutil"

	log "github.com/sirupsen/logrus"
	model "github.com/slipke/eurlex-model-go"
)


func main() {
	xmlBytes, err := ioutil.ReadFile("cellar_6bf54b59-7673-461b-b8e1-f24c545cbd3c.xml")
	if err != nil {
		log.Fatalf("Failed to load file %s: %s", file, err)
	}

	var n *model.Notice

	err = xml.Unmarshal(xmlBytes, &n)
	if err != nil {
		log.Fatalf("Failed to parse xml: %s", err)
	}

	// Print notice
	log.Info(n)
}

Resources

eurlex-model-go's People

Contributors

slipke avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

trevor87

eurlex-model-go's Issues

Add Dossier at Top Level

As in:

<RESOURCE_LEGAL_PRODUCED_BY_DOSSIER type="link">
   <EMBEDDED_NOTICE>
      <DOSSIER>
         <PROCEDURE_CODE_INTERINSTITUTIONAL_YEAR_PROCEDURE type="data">
            <VALUE>2007</VALUE>
         </PROCEDURE_CODE_INTERINSTITUTIONAL_YEAR_PROCEDURE>
         <PROCEDURE_CODE_INTERINSTITUTIONAL_REFERENCE_PROCEDURE type="data">
            <VALUE>2007/0121/COD</VALUE>
         </PROCEDURE_CODE_INTERINSTITUTIONAL_REFERENCE_PROCEDURE>
         <PROCEDURE_CODE_INTERINSTITUTIONAL_NUMBER_PROCEDURE type="data">
            <VALUE>0121</VALUE>
         </PROCEDURE_CODE_INTERINSTITUTIONAL_NUMBER_PROCEDURE>
         <PROCEDURE_CODE_INTERINSTITUTIONAL_HAS_TYPE_CONCEPT_TYPE_PROCEDURE_CODE_INTERINSTITUTIONAL type="concept">
            <URI>
               <VALUE>http://publications.europa.eu/resource/authority/procedure/COD</VALUE>
               <IDENTIFIER>COD</IDENTIFIER>
               <TYPE>procedure</TYPE>
            </URI>
            <OP-CODE>COD</OP-CODE>
            <IDENTIFIER>COD</IDENTIFIER>
            <PREFLABEL>Mitentscheidungsverfahren (COD)</PREFLABEL>
         </PROCEDURE_CODE_INTERINSTITUTIONAL_HAS_TYPE_CONCEPT_TYPE_PROCEDURE_CODE_INTERINSTITUTIONAL>
         <TYPE>cdm:dossier</TYPE>
         <TYPE>cdm:procedure_code_interinstitutional</TYPE>
         <TYPE>cdm:period</TYPE>
         <TYPE>cdm:entity_temporal</TYPE>
      </DOSSIER>
      <EVENT/>
      <EVENT/>
      <EVENT/>
      <EVENT/>
      <EVENT/>
      <EVENT/>
      <EVENT/>
      <EVENT/>
      <EVENT/>
      <EVENT/>
      <EVENT/>
   </EMBEDDED_NOTICE>
   <URI>
      <VALUE>http://publications.europa.eu/resource/cellar/d14799c7-d2f0-11e1-905c-01aa75ed71a1</VALUE>
      <IDENTIFIER>d14799c7-d2f0-11e1-905c-01aa75ed71a1</IDENTIFIER>
      <TYPE>cellar</TYPE>
   </URI>
   <SAMEAS>
      <URI>
         <VALUE>http://publications.europa.eu/resource/pegase/195900</VALUE>
         <IDENTIFIER>195900</IDENTIFIER>
         <TYPE>pegase</TYPE>
      </URI>
   </SAMEAS>
   <SAMEAS>
      <URI>
         <VALUE>http://publications.europa.eu/resource/procedure/2007_121</VALUE>
         <IDENTIFIER>2007_121</IDENTIFIER>
         <TYPE>procedure</TYPE>
      </URI>
   </SAMEAS>
</RESOURCE_LEGAL_PRODUCED_BY_DOSSIER>

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.