【发布时间】:2011-09-20 19:06:57
【问题描述】:
我有一个 XML 文件,其中包含多张图片的数据,例如 GPS 坐标、日期/时间,以及一些需要拆分为多个 XML 文件的图像数据。
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<Placemark>
<name> //picture 1 info <name>
<Point>
<coordinates> //gps 1 cords <coordinates>
<Point>
<Placemark>
<Placemark>
<name> //picture 2 info <name>
<Point>
<coordinates> //gps 2 cords <coordinates>
<Point>
<Placemark>
<Document>
我希望它看起来像这样:
File 1:
<Placemark>
<Name> //picture 1 info <name>
<Point>
<coordinates> //gps 1 cords <coordinates>
<Point>
<Placemark>
File 2:
<Placemark>
<Name> //picture 2 info <name>
<Point>
<coordinates> //gps 2 cords <coordinates>
<Point>
<Placemark>
.....我读了这个问题: Split XML in Multiple XML files
并在导入所有内容后尝试为我的文件稍微修改代码。想知道是否有人对如何修改我的代码以进行上述问题中的吐痰有任何好主意。
【问题讨论】:
-
确保正确关闭标签,即
<Point></Point> -
您已将此标记为 Android... 您正在使用什么语言/系统进行编码?或者你只是在Java中做它?还是 C#?
-
@Tyler Ferraro 我正在用 Java 编写它,但我将在未来将其实现到 Android 应用程序中
-
了解 XML 的基础知识。您没有使用结束标签。网上有数以百万计的 XML 教程,所以没有任何理由在问题中展示这种损坏的 XML。
标签: java android xml xml-parsing