0

XML を解析しようとしていますが、エラーが発生します。

public static String xmlVersion(String source) {

try {
    DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
    Document document = documentBuilder.parse(source);
    return document.getDocumentElement().getAttribute("versao");
} catch (SAXException | IOException | ParserConfigurationException e) {
    e.printStackTrace();
}
return null;

}

そしてスタックトレース

java.net.MalformedURLException: no protocol: <?xml version="1.0" encoding="UTF-8"?><nfeProc versao="2.00" xmlns="http://www.portalfiscal.inf.br/nfe"><NFe xmlns="http://www.portalfiscal.inf.br/nfe"><infNFe versao="2.00" Id="NFe31130605633253000205550010000002571000169370"><ide><cUF>31</cUF><cNF>00016937</cNF><natOp>Devolucao de compra para comercializacao em operacao com mer</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>257</nNF><dEmi>2013-06-14</dEmi><dSaiEnt>2013-06-14</dSaiEnt><tpNF>1</tpNF><cMunFG>3147907</cMunFG><tpImp>1</tpImp><tpEmis>1</tpEmis><cDV>0</cDV><tpAmb>1</tpAmb><finNFe>1</finNFe><procEmi>0</procEmi><verProc>2.0.1.2</verProc></ide><emit><CNPJ>05633253000205</CNPJ><xNome>SUPERMERCADO EXPOSICAO LTDA</xNome><xFant>SUPERMERCADO EXPOSICAO 2</xFant><enderEmit><xLgr>RUA JOAO TEIXEIRA MENDES</xLgr><nro>541</nro><xBairro>N.S.APARECIDA</xBairro><cMun>3147907</cMun><xMun>PASSOS</xMun><UF>MG</UF><CEP>37902419</CEP><cPais>1058</cPais><xPais>BRASIL</xPais><fone>3535215796</fone></enderEmit><IE>4792308680128</IE><CRT>3</CRT></emit><dest><CNPJ>16849231000619</CNPJ><xNome>ITAMBE ALIMENTOS S A</xNome><enderDest><xLgr>RODOVIA BR 262 ANEXO I KM403</xLgr><nro>S/N</nro><xBairro>PATAFUFO</xBairro><cMun>3147105</cMun><xMun>Para de Minas</xMun><UF>MG</UF><CEP>35661390</CEP><cPais>1058</cPais><xPais>BRASIL</xPais></enderDest><IE>0020322880432</IE></dest><det nItem="1"><prod><cProd>13169</cProd><cEAN>7896051111832</cEAN><xProd>BEBIDA LACTEA ITAMBE FAMILIA VITAMINA C/ FRUTAS 1L</xProd><NCM>04039000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>1.0000</qCom><vUnCom>3.1900000000</vUnCom><vProd>3.19</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>1.0000</qTrib><vUnTrib>3.1900000000</vUnTrib><vOutro>0.07</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>1.24</vBC><pICMS>18.00</pICMS><vICMS>0.22</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISNT><CST>06</CST></PISNT></PIS><COFINS><COFINSNT><CST>06</CST></COFINSNT></COFINS></imposto></det><det nItem="2"><prod><cProd>23003</cProd><cEAN>7896051121831</cEAN><xProd>COALHADA ITAMBE DESNATADA 130GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>3.0000</qCom><vUnCom>0.8300000000</vUnCom><vProd>2.49</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>3.0000</qTrib><vUnTrib>0.8300000000</vUnTrib><vOutro>0.05</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>33.33</pRedBC><vBC>1.66</vBC><pICMS>18.00</pICMS><vICMS>0.30</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="3"><prod><cProd>23004</cProd><cEAN>7896051125037</cEAN><xProd>IOGURTE FRUTAMBE BAUNILHA AMEIXA 130GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>7.0000</qCom><vUnCom>0.9800000000</vUnCom><vProd>6.86</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>7.0000</qTrib><vUnTrib>0.9800000000</vUnTrib><vOutro>0.15</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>2.67</vBC><pICMS>18.00</pICMS><vICMS>0.48</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="4"><prod><cProd>23005</cProd><cEAN>7896051125259</cEAN><xProd>IOGURTE FRUTAMBE BAUNILHA MARACUJA 130GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>9.0000</qCom><vUnCom>0.9500000000</vUnCom><vProd>8.55</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>9.0000</qTrib><vUnTrib>0.9500000000</vUnTrib><vOutro>0.18</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>3.33</vBC><pICMS>18.00</pICMS><vICMS>0.60</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="5"><prod><cProd>23010</cProd><cEAN>7896051127093</cEAN><xProd>IOGURTE ITAMBE GOODY FRUTI 600GR</xProd><NCM>04039000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>5.0000</qCom><vUnCom>1.7500000000</vUnCom><vProd>8.75</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>5.0000</qTrib><vUnTrib>1.7500000000</vUnTrib><vOutro>0.19</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>3.40</vBC><pICMS>18.00</pICMS><vICMS>0.61</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="6"><prod><cProd>23011</cProd><cEAN>7896051121268</cEAN><xProd>IOGURTE ITAMBE NATURAL C/MEL 180GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>7.0000</qCom><vUnCom>0.8900000000</vUnCom><vProd>6.23</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>7.0000</qTrib><vUnTrib>0.8900000000</vUnTrib><vOutro>0.13</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>2.42</vBC><pICMS>18.00</pICMS><vICMS>0.44</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="7"><prod><cProd>23012</cProd><cEAN>7896051121282</cEAN><xProd>IOGURTE ITAMBE NATURAL DESNATADO 180GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>2.0000</qCom><vUnCom>0.8900000000</vUnCom><vProd>1.78</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>2.0000</qTrib><vUnTrib>0.8900000000</vUnTrib><vOutro>0.04</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>0.69</vBC><pICMS>18.00</pICMS><vICMS>0.12</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="8"><prod><cProd>23014</cProd><cEAN>7896051121251</cEAN><xProd>IOGURTE ITAMBE NATURAL INTEGRAL 180GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>7.0000</qCom><vUnCom>0.8900000000</vUnCom><vProd>6.23</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>7.0000</qTrib><vUnTrib>0.8900000000</vUnTrib><vOutro>0.13</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>2.42</vBC><pICMS>18.00</pICMS><vICMS>0.44</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="9"><prod><cProd>23014</cProd><cEAN>7896051121251</cEAN><xProd>IOGURTE ITAMBE NATURAL INTEGRAL 180GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>8.0000</qCom><vUnCom>1.2500000000</vUnCom><vProd>10.00</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>8.0000</qTrib><vUnTrib>1.2500000000</vUnTrib><vOutro>0.21</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>3.89</vBC><pICMS>18.00</pICMS><vICMS>0.70</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="10"><prod><cProd>23017</cProd><cEAN>7896051142249</cEAN><xProd>IOGURTE ITAMBEZINHO FRUTAS 360GR</xProd><NCM>40610900</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>5.0000</qCom><vUnCom>2.0900000000</vUnCom><vProd>10.45</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>5.0000</qTrib><vUnTrib>2.0900000000</vUnTrib><vOutro>0.22</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>4.06</vBC><pICMS>18.00</pICMS><vICMS>0.73</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISNT><CST>06</CST></PISNT></PIS><COFINS><COFINSNT><CST>06</CST></COFINSNT></COFINS></imposto></det><det nItem="11"><prod><cProd>23018</cProd><cEAN>7896051142218</cEAN><xProd>IOGURTE ITAMBEZINHO MORANGO 360GR</xProd><NCM>04061090</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>2.0000</qCom><vUnCom>1.9600000000</vUnCom><vProd>3.92</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>2.0000</qTrib><vUnTrib>1.9600000000</vUnTrib><vOutro>0.08</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>1.52</vBC><pICMS>18.00</pICMS><vICMS>0.27</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISNT><CST>06</CST></PISNT></PIS><COFINS><COFINSNT><CST>06</CST></COFINSNT></COFINS></imposto></det><det nItem="12"><prod><cProd>23020</cProd><cEAN>7896051123842</cEAN><xProd>IOGURTE VITAMBE COCO 180GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>15.0000</qCom><vUnCom>0.8500000000</vUnCom><vProd>12.75</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>15.0000</qTrib><vUnTrib>0.8500000000</vUnTrib><vOutro>0.27</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>4.96</vBC><pICMS>18.00</pICMS><vICMS>0.89</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISNT><CST>06</CST></PISNT></PIS><COFINS><COFINSNT><CST>06</CST></COFINSNT></COFINS></imposto></det><det nItem="13"><prod><cProd>23021</cProd><cEAN>7896051123859</cEAN><xProd>IOGURTE VITAMBE FRUTAS VERMELHAS 180GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>1.0000</qCom><vUnCom>0.8500000000</vUnCom><vProd>0.85</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>1.0000</qTrib><vUnTrib>0.8500000000</vUnTrib><vOutro>0.02</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>0.33</vBC><pICMS>18.00</pICMS><vICMS>0.06</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISNT><CST>06</CST></PISNT></PIS><COFINS><COFINSNT><CST>06</CST></COFINSNT></COFINS></imposto></det><det nItem="14"><prod><cProd>23023</cProd><cEAN>7896051123828</cEAN><xProd>IOGURTE VITAMBE MARACUJA 180GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>2.0000</qCom><vUnCom>0.8500000000</vUnCom><vProd>1.70</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>2.0000</qTrib><vUnTrib>0.8500000000</vUnTrib><vOutro>0.04</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>0.66</vBC><pICMS>18.00</pICMS><vICMS>0.12</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISNT><CST>06</CST></PISNT></PIS><COFINS><COFINSNT><CST>06</CST></COFINSNT></COFINS></imposto></det><det nItem="15"><prod><cProd>23024</cProd><cEAN>7896051123811</cEAN><xProd>IOGUTE VITAMBE MORANGO 180GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>11.0000</qCom><vUnCom>0.8500000000</vUnCom><vProd>9.35</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>11.0000</qTrib><vUnTrib>0.8500000000</vUnTrib><vOutro>0.20</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>3.64</vBC><pICMS>18.00</pICMS><vICMS>0.66</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISNT><CST>06</CST></PISNT></PIS><COFINS><COFINSNT><CST>06</CST></COFINSNT></COFINS></imposto></det><det nItem="16"><prod><cProd>23027</cProd><cEAN>7896051126010</cEAN><xProd>LEITE FERMENTADO ITAMBE 80GR</xProd><NCM>40390000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>4.0000</qCom><vUnCom>0.4100000000</vUnCom><vProd>1.64</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>4.0000</qTrib><vUnTrib>0.4100000000</vUnTrib><vOutro>0.04</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>0.64</vBC><pICMS>18.00</pICMS><vICMS>0.12</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISNT><CST>06</CST></PISNT></PIS><COFINS><COFINSNT><CST>06</CST></COFINSNT></COFINS></imposto></det><det nItem="17"><prod><cProd>23068</cProd><cEAN>7896051121817</cEAN><xProd>COALHADA ITAMBE NATURAL 130GR</xProd><NCM>40310000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>1.0000</qCom><vUnCom>0.8300000000</vUnCom><vProd>0.83</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>1.0000</qTrib><vUnTrib>0.8300000000</vUnTrib><vOutro>0.02</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>33.33</pRedBC><vBC>0.55</vBC><pICMS>18.00</pICMS><vICMS>0.10</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="18"><prod><cProd>23384</cProd><cEAN>7896051125525</cEAN><xProd>IOGURTE ITAMBE FIT MORANGO MACA AMEIXA 100GR</xProd><NCM>04031000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>1.0000</qCom><vUnCom>0.4000000000</vUnCom><vProd>0.40</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>1.0000</qTrib><vUnTrib>0.4000000000</vUnTrib><vOutro>0.01</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>0.16</vBC><pICMS>18.00</pICMS><vICMS>0.03</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISAliq><CST>01</CST><vBC>0.00</vBC><pPIS>0.00</pPIS><vPIS>0.00</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>0.00</vBC><pCOFINS>0.00</pCOFINS><vCOFINS>0.00</vCOFINS></COFINSAliq></COFINS></imposto></det><det nItem="19"><prod><cProd>24367</cProd><cEAN>7896051161011</cEAN><xProd>IOGURTE ITAMBEZINHO MORANGO 180GR</xProd><NCM>04031000</NCM><CFOP>5411</CFOP><uCom>UN</uCom><qCom>18.0000</qCom><vUnCom>0.8500000000</vUnCom><vProd>15.30</vProd><cEANTrib/><uTrib>UN</uTrib><qTrib>18.0000</qTrib><vUnTrib>0.8500000000</vUnTrib><vOutro>0.34</vOutro><indTot>1</indTot></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>61.11</pRedBC><vBC>5.95</vBC><pICMS>18.00</pICMS><vICMS>1.07</vICMS><modBCST>0</modBCST><vBCST>0.00</vBCST><pICMSST>0.00</pICMSST><vICMSST>0.00</vICMSST></ICMS70></ICMS><PIS><PISNT><CST>06</CST></PISNT></PIS><COFINS><COFINSNT><CST>06</CST></COFINSNT></COFINS></imposto></det><total><ICMSTot><vBC>44.19</vBC><vICMS>7.96</vICMS><vBCST>0.00</vBCST><vST>0.00</vST><vProd>111.27</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0.00</vII><vIPI>0.00</vIPI><vPIS>0.00</vPIS><vCOFINS>0.00</vCOFINS><vOutro>2.39</vOutro><vNF>113.66</vNF></ICMSTot></total><transp><modFrete>9</modFrete></transp><infAdic><infCpl>BC ICMS ST 57,45 2-3-4-5-6-7-8-9-17-18- 1-10-11-12-13-14-15-16-19-</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference URI="#NFe31130605633253000205550010000002571000169370"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>9WsoFBTh8atNnEZJn45m83jRBpM=</DigestValue></Reference></SignedInfo><SignatureValue>UKpRdw1Sv+lMvkKdplOckAqlnWcjIh1R7Ymc44sIfFL8VkuKnDhBr5gj5VV4Q1ItHNjY7hjU7GadHW25iCAyfYnRQULUq4zDuYcc4xwfZ/iU1PMeeeH3QfkE9oDODm+jS6kldX9wPGnzOP3eRukk57RMcrfnyjofGHigGaZyWumZkMMYATG8ZBVmtLsBLtFhH66nBtaCBcBFGoZ9bDNOSmFaVeM/Gi5sJaBivImRXcXB0KrA2JSakqUxmNT/UwGasolrpclRp6UPvmqu44g/c2t91Fu2CqzN8nU+dKYBpO5UEY+PSBSVmA9YkBLMvFY49Fa8+95MgTKFicqs60bNoQ==</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIILTCCBhWgAwIBAgIQJ9/fNxNJaVAK40MVZ+dGRTANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE2MDQGA1UECxMtU2VjcmV0YXJpYSBkYSBSZWNlaXRhIEZlZGVyYWwgZG8gQnJhc2lsIC0gUkZCMRkwFwYDVQQDExBBQyBTSU5DT1IgUkZCIEc0MB4XDTEyMDYyMjAwMDAwMFoXDTE1MDYyMTIzNTk1OVowgesxCzAJBgNVBAYTAkJSMRMwEQYDVQQKFApJQ1AtQnJhc2lsMQswCQYDVQQIEwJNRzEPMA0GA1UEBxQGUEFTU09TMTYwNAYDVQQLFC1TZWNyZXRhcmlhIGRhIFJlY2VpdGEgRmVkZXJhbCBkbyBCcmFzaWwgLSBSRkIxFjAUBgNVBAsUDVJG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UsSC2OZprJLi1jjWcAlhCztlspo9bTok2vmC9mHhYf3nV9EC6DNUsH2dVZ58+z48pN+NzrX/MyRa1fINmV6WdF15+GPPEEhycRbwYejmUtkz6sEUhUEZR6fS/C0GXROoM0aVDiV9ImZVVaHrz/6majn6ygGjIF3pYthVLClLjvo3gx/uxy0vtT9vXNZOyHTrlnu0e6skumHxVd+KmyVrsP+1c</X509Certificate></X509Data></KeyInfo></Signature></NFe><protNFe versao="2.00"><infProt><tpAmb>1</tpAmb><verAplic>13_0_89</verAplic><chNFe>31130605633253000205550010000002571000169370</chNFe><dhRecbto>2013-06-14T09:01:24</dhRecbto><nProt>131131126789086</nProt><digVal>9WsoFBTh8atNnEZJn45m83jRBpM=</digVal><cStat>100</cStat><xMotivo>Autorizado o uso da NF-e</xMotivo></infProt></protNFe></nfeProc>
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at com.nfehost.util.XmlUtil.xmlVersion(XmlUtil.java:34)
    at com.nfehost.service.processadora.Processadora.main(Processadora.java:13)

文字列を渡したいのですが、ファイルを渡すとエラーが発生します。

xml ファイルから文字列ソースを解析するにはどうすればよいですか?

私のxmlには名前空間があります

4

1 に答える 1

2

使用しているメソッドDocumentBuilder#parse(String)は、XML コンテンツ自体ではなく、XML コンテンツを保持する XML ソース (ファイルまたは HTTP URI など) の URI を想定しています。

本当に XML コンテンツを として渡したい場合は、ラップされた aを to にString渡すことを検討してください。InputSourceStringReaderDocumentBuilder#parse(InputSource)

documentBuilder.parse(new InputSource(new StringReader(source)));
于 2013-11-09T16:27:05.117 に答える