原来的代码:

            // 创建DocumentBuilder对象
DocumentBuilder b = a.newDocumentBuilder();
// 通过DocumentBuilder对象的parse方法返回一个Document对象
Document document = b.parse(stream);
// 通过Document对象的getElementsByTagName()返根节点的一个list集合
NodeList booklist = document.getElementsByTagName("Table");

将流stream对接到xml解析的代码之后爆出错误:

解决方法:

            // 创建DocumentBuilder对象
DocumentBuilder b = a.newDocumentBuilder();
// 通过DocumentBuilder对象的parse方法返回一个Document对象
Document document = b.parse(new ByteArrayInputStream(stream.getBytes()));
// 通过Document对象的getElementsByTagName()返根节点的一个list集合
NodeList booklist = document.getElementsByTagName("Table");

即可成功。

解析流中的Xml文件时,报错:java.net.MalformedURLException: no protocol的更多相关文章

  1. 项目配置 xml文件时 报错提示(The reference to entity "useSSL" must end with the ';' delimiter.)

    这次在配置xml文件时,出现错误提示( The reference to entity “useSSL” must end with the ‘;’ delimiter.) 报错行为 <prop ...

  2. jdk1.8换成11,启动项目报错java.net.MalformedURLException: unknown protocol: jrt

    jdk11 Information:Internal caches are corrupted or have outdated format, forcing project rebuild: Mo ...

  3. 在caffe中执行脚本文件时 报错:-bash: ./train.sh: Permission denied

    报错原因:没有权限 解决方法:chmod 777 train.sh获得权限

  4. android使用Pull解析来自服务器的xml文件时出现错误以及解决方案

    直接上代码,代码中有详细注释: 1 public class CheckUpdateManager { 2 private static final String TAG = "CheckU ...

  5. 如何快速解决myeclipse中导入jquery文件的报错。

    如何快速解决myeclipse中导入jquery文件的报错. 解决: 选中错误的文件, 点击右键, 选中myeclipse,点击Exclude From Validation.

  6. 解析某些特殊格式XML文件时,获取不到根节点问题

    还是在语音识别这块.在读取本地的SRGS的XML后,无法获取到根节点<grammar>. 下面是SRGS.XML文件(只给出了根节点) <?xml version="1.0 ...

  7. MySQL的sql_mode解析与设置,sql文件导入报错解决

    在往MySQL数据库中插入一组数据时,出错了!数据库无情了给我报了个错误:ERROR 1365(22012):Division by 0:意思是说:你不可以往数据库中插入一个 除数为0的运算的结果.于 ...

  8. 解决asp.net mvc中*.resx资源文件访问报错

    个人笔记 问题重现 在asp.net mvc中,使用资源文件会出现一个问题,例如: 紧接着我进入视图界面,输入下面代码: <a href="javascript:void(0);&qu ...

  9. 关于Maven项目pom.xml文件不报错却有红叉的问题

    原因:spring-boot,升级到2.1.5版本,而maven-jar-plugin.version插件默认版本不兼容所以报错,但不影响运行 解决:在<properties></p ...

随机推荐

  1. 一个简单的 openssl 示例

    ////生成一个私钥////$key=openssl_pkey_new();openssl_pkey_export($key,$out);//等于下面写入的内容////将私钥写入一个文件////ope ...

  2. html css input定位 文本框阴影 灰色不可编辑

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. 《DSP using MATLAB》Problem 5.22

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...

  4. String中concat方法小记

    介绍String中的concat方法使用: 日常开发中,经常对字符串进行处理,之前碰到多个字符串拼接,要么使用stringBuilder,要么使用StringBuffer,再或者是直接多个String ...

  5. LeetCode - Daily Temperatures

    Given a list of daily temperatures, produce a list that, for each day in the input, tells you how ma ...

  6. Python知识点整理,基础1 - 基本语法

  7. goland 文件头注释

    打开GoLand的setting选项 依次选择Editor,CodeStyle ,File and Code Templates ,Go File 根据自己需要添加即可 /* @Time : ${DA ...

  8. 我的vim(持续更新)

    保存并退出:wq 退出但不保存修改:q! 不退出vi使用shell(bash)命令:!bash (如果想回到vi,bash下输入exit回车) 设置行号 :set nu 取消行号:set nonu 设 ...

  9. NPOI之Excel——设置单元格背景色

    NPOI Excel 单元格颜色对照表,在引用了 NPOI.dll 后可通过 ICellStyle 接口的 FillForegroundColor 属性实现 Excel 单元格的背景色设置,FillP ...

  10. 设计一个 硬件 实现的 Dictionary(字典)

    Dictionary 就是 字典, 是一种可以根据 Key 来 快速 查找 Value 的 数据结构 . 比如 我们在 C# 里用到的 Dictionary<T>, 在 程序设计 里, 字 ...