• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wmixvideo / nfe / #6287

20 Jun 2016 11:31AM UTC coverage: 79.109% (+2.5%) from 76.628%
#6287

push

travis-ci

fincatto
Gerador de chave gerando codigo randomico, quando nao informado.

3 of 3 new or added lines in 1 file covered. (100.0%)

352 existing lines in 69 files now uncovered.

4741 of 5993 relevant lines covered (79.11%)

50.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/main/java/com/fincatto/nfe310/validadores/xsd/XMLValidador.java
1
package com.fincatto.nfe310.validadores.xsd;
2

3
import org.xml.sax.SAXException;
4

5
import javax.xml.transform.stream.StreamSource;
6
import javax.xml.validation.Schema;
7
import javax.xml.validation.SchemaFactory;
8
import java.io.IOException;
9
import java.io.StringReader;
10
import java.net.URISyntaxException;
11
import java.net.URL;
12

UNCOV
13
public final class XMLValidador {
×
14

15
    private static boolean valida(final String xml, final String xsd) throws IOException, SAXException, URISyntaxException {
16
        final URL xsdPath = XMLValidador.class.getClassLoader().getResource(String.format("schemas/%s", xsd));
2✔
17
        final SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
2✔
18
        final Schema schema = schemaFactory.newSchema(new StreamSource(xsdPath.toURI().toString()));
2✔
19
        schema.newValidator().validate(new StreamSource(new StringReader(xml)));
2✔
20
        return true;
2✔
21
    }
22

23
    public static boolean validaLote(final String arquivoXML) throws Exception {
24
        return XMLValidador.valida(arquivoXML, "enviNFe_v3.10.xsd");
1✔
25
    }
26

27
    public static boolean validaNota(final String arquivoXML) throws Exception {
28
        return XMLValidador.valida(arquivoXML, "nfe_v3.10.xsd");
1✔
29
    }
30
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc