node-xml2js
node-xml2js copied to clipboard
Creating a xml
Hi, I am a newbie with this package. I neeed a help, please .
- How can I create a xml similar to the next?
- I need to validate the xml against a xsd ("http://www.ans.gov.br/padroes/tiss/schemas/tissV3_02_02.xsd").
How can I do that?
Is there some package or function to do it? If not, is there some third package to take care it?
<?xml version="1.0" encoding="ISO-8859-1"?>
<ans:mensagemTISS xmlns:ans="http://www.ans.gov.br/padroes/tiss/schemas" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ans.gov.br/padroes/tiss/schemas http://www.ans.gov.br/padroes/tiss/schemas/tissV3_02_02.xsd">
<ans:cabecalho>
<ans:identificacaoTransacao>
<ans:tipoTransacao>ENVIO_LOTE_GUIAS</ans:tipoTransacao>
<ans:sequencialTransacao>8378</ans:sequencialTransacao>
</ans:identificacaoTransacao>
<ans:versaoPadrao>3.02.02</ans:versaoPadrao>
</ans:cabecalho>
<ans:epilogo>
<ans:hash>6af733693b2cbaca574d6d0478f7586b</ans:hash>
</ans:epilogo>
</ans:mensagemTISS>
To validate against an xsd I found this library to do the job: https://github.com/marudor/libxmljs2