{"id":20880300,"url":"https://github.com/lexml/lexml-jsonix-springboot-starter","last_synced_at":"2025-07-24T23:14:33.226Z","repository":{"id":68977918,"uuid":"440966452","full_name":"lexml/lexml-jsonix-springboot-starter","owner":"lexml","description":"Biblioteca java springboot para conversão de arquivo lexml em json","archived":false,"fork":false,"pushed_at":"2024-06-21T20:23:11.000Z","size":106,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-01-19T10:05:39.706Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lexml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-22T19:41:10.000Z","updated_at":"2024-06-21T14:02:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"748d031e-3c76-4644-8ca4-fa0eb7a6cb55","html_url":"https://github.com/lexml/lexml-jsonix-springboot-starter","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexml%2Flexml-jsonix-springboot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexml%2Flexml-jsonix-springboot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexml%2Flexml-jsonix-springboot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexml%2Flexml-jsonix-springboot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lexml","download_url":"https://codeload.github.com/lexml/lexml-jsonix-springboot-starter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243258496,"owners_count":20262297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T07:19:50.877Z","updated_at":"2025-03-12T16:49:51.502Z","avatar_url":"https://github.com/lexml.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lexml-jsonix-spring-boot-starter\n\nBiblioteca Java que retorna o texto de uma proposição em formato jsonix. \nPara realizar a conversão, esta biblioteca utiliza o conversor jsonix-lexml. Maiores informações sobre o conversor jsonix-lexml podem ser encontradas em [https://github.com/lexml/jsonix-lexml](https://github.com/lexml/jsonix-lexml#jsonix-lexml).\n\n## Como usar\n- Adicionar a dependência no pom.xml\n```xml\n    \u003cdependency\u003e\n        \u003cgroupId\u003ea-definir\u003c/groupId\u003e\n        \u003cartifactId\u003elexml-jsonix-spring-boot-starter\u003c/artifactId\u003e\n        \u003cversion\u003e0.0.1\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n\n- Configurar a propriedade `jsonix.cli` no arquivo `application.properties` da sua aplicação Java, informando a localização do executável do conversor lexml-jsonix. Exemplo:\n\n```yaml\n    lexml-jsonix.cli=c:\\\\temp\\\\jsonix-lexml-win.exe\n```\n\n  Releases dos executáveis para os três ambientes suportados (Linux, MacOS X e Windows) podem ser encontrados em https://github.com/lexml/jsonix-lexml/releases/.\n\n### Para converter de xml para json e vice-versa\n\n- Instanciar um bean que implementa a interface `ConversorLexmlJsonix`. Essa interface define os métodos para conversão de um texto em formato Lexml para json e vice-versa. A classe `ConversorLexmlJsonixImpl` implementa essa interface e utiliza o executável mencionado no item anterior para realizar a conversão. Exemplo de uso:\n\n```java\n    package com.lexmljsonixteste.jsonix;\n\n    import org.springframework.beans.factory.annotation.Autowired;\n    import org.springframework.http.MediaType;\n    import org.springframework.web.bind.annotation.RequestBody;\n    import org.springframework.web.bind.annotation.RequestMapping;\n    import org.springframework.web.bind.annotation.RestController;\n\n    import br.leg.camara.lexmljsonixspringbootstarter.conversor.ConversorLexmlJsonix;\n\n    @RestController\n    @RequestMapping(\"lexml-jsonix\")\n    public class ConversorController {\n        \n        @Autowired\n        private ConversorLexmlJsonix conversorLexmlJsonix;\n        \n        @RequestMapping(value = \"xml-to-json\", produces = MediaType.APPLICATION_JSON_VALUE)\n        public String xmlToJson(@RequestBody String xml) {\n            return conversorLexmlJsonix.xmlToJson(xml);\n        }\t\n        \n        @RequestMapping(value = \"json-to-xml\", produces = MediaType.APPLICATION_XML_VALUE)\n        public String jsonToXml(@RequestBody String json) {\n            return conversorLexmlJsonix.jsonToXml(json);\n        }\t\n        \n    }\n```\n\n### Para pesquisar proposições e obter texto em formato Lexml\n\n- A classe `LexmlJsonixServiceImpl` implementa a interface `LexmlJsonixService` e disponibiliza métodos para listar proposições, bem como método para obter o texto de uma proposição em formato Lexml. Exemplo de uso:\n\n```java\n    package com.lexmljsonixteste.lex;\n\n    import java.util.List;\n\n    import org.springframework.beans.factory.annotation.Autowired;\n    import org.springframework.http.MediaType;\n    import org.springframework.web.bind.annotation.CrossOrigin;\n    import org.springframework.web.bind.annotation.GetMapping;\n    import org.springframework.web.bind.annotation.RequestMapping;\n    import org.springframework.web.bind.annotation.RequestParam;\n    import org.springframework.web.bind.annotation.RestController;\n\n    import br.leg.camara.lexmljsonixspringbootstarter.service.LexmlJsonixService;\n    import br.leg.camara.lexmljsonixspringbootstarter.service.Proposicao;\n\n    @RestController\n    @CrossOrigin(origins = \"*\")\n    public class ProposicoesController {\n        \n        @Autowired\n        private LexmlJsonixService lexmlJsonixService;\n            \n        @GetMapping(\"proposicoes\")\n        public List\u003cProposicao\u003e getProposicoes(@RequestParam String sigla, @RequestParam Integer ano, String numero) {\n            return lexmlJsonixService.getProposicoes(sigla, ano, numero);\n        }\n\n        @GetMapping(\"proposicao\")\n        public Proposicao getProposicao(@RequestParam String sigla, @RequestParam Integer ano, @RequestParam String numero) {\n            return lexmlJsonixService.getProposicao(sigla, ano, numero);\n        }\n        \n        @RequestMapping(value = \"proposicao/texto-lexml/xml\", produces = MediaType.APPLICATION_XML_VALUE)\n        public String getTextoProposicaoAsXml(@RequestParam String sigla, @RequestParam Integer ano, @RequestParam String numero) {\n            return lexmlJsonixService.getTextoProposicaoAsXml(sigla, ano, numero);\n        }\t\n\n        @RequestMapping(value = \"proposicao/texto-lexml/xml/sdleg\", produces = MediaType.APPLICATION_XML_VALUE)\n        public String getTextoProposicaoAsXml(@RequestParam String idSdlegDocumentoItemDigital) {\n            return lexmlJsonixService.getTextoProposicaoAsXml(idSdlegDocumentoItemDigital);\n        }\t\n                \n        @RequestMapping(value = \"proposicao/texto-lexml/json\", produces = MediaType.APPLICATION_JSON_VALUE)\n        public String getTextoProposicaoAsJson(@RequestParam String sigla, @RequestParam Integer ano, @RequestParam String numero) {\n            return lexmlJsonixService.getTextoProposicaoAsJson(sigla, ano, numero);\n        }\t\n\n        @RequestMapping(value = \"proposicao/texto-lexml/json/sdleg\", produces = MediaType.APPLICATION_JSON_VALUE)\n        public String getTextoProposicaoAsJson(@RequestParam String idSdlegDocumentoItemDigital) {\n            return lexmlJsonixService.getTextoProposicaoAsJson(idSdlegDocumentoItemDigital);\n        }\t\n                \n    }\n```\n\n- A classe `LexmlJsonixServiceImpl` utiliza um serviço disponibilizado pelo Senado Federal para realizar a pesquisa de proposições e para obter o texto em formato Lexml da proposição.\n  - A url para pesquisar proposições é: https://legis.senado.gov.br/legis/resources/lex/proposicoes\n  - A url para obter o arquivo zip que contém o texto em formato lexml da proposição é: https://legis.senado.gov.br/sdleg-getter/documento/download\n\n- Essas urls podem ser alteradas a partir do arquivo `application.properties` da sua aplicação, conforme o exemplo abaixo:\n\n```yaml\n    lexml-jsonix.url-proposicoes=http://nova-url-do-servico-de-pesquisa-de-proposicoes\n    lexml-jsonix.url-sdleg=http://nova-url-do-servico-que-retorna-texto-lexml\n```\n\n**Observação:** As urls acima podem ser alteradas, mas o formato do retorno deve permanecer o mesmo para que a classe `LexmlJsonixServiceImpl` funcione corretamente. Caso você possua outros serviços que retornem dados equivalentes, você poderá criar uma nova classe que implementa a interface `LexmlJsonixService` e construir o código para tratar os dados retornados nos novos serviços.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexml%2Flexml-jsonix-springboot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flexml%2Flexml-jsonix-springboot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexml%2Flexml-jsonix-springboot-starter/lists"}