Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将XML解析为Java元数据格式_Java_Xml_Metadata_Spfile - Fatal编程技术网

将XML解析为Java元数据格式

将XML解析为Java元数据格式,java,xml,metadata,spfile,Java,Xml,Metadata,Spfile,我在java中看到了一些xml解析,但我真的不知道如何将其应用到我的代码中 这是我的xml文件: <?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:georss="http://www.georss.org/georss" xm

我在java中看到了一些xml解析,但我真的不知道如何将其应用到我的代码中

这是我的xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xml:base="https://adomain.com">
   <id>https://sharepoint.mydomain/aFile)</id>
   <category term="SP.File" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />

   <title />
   <updated>2015-05-18T07:13:18Z</updated>
   <author>
      Bla Bla<name />
   </author>
   <content type="application/xml">
      <m:properties>
         <d:CheckInComment />
         <d:CheckOutType m:type="Edm.Int32">2</d:CheckOutType>
         <d:ContentTag>{63FD2CFA-D223-405B-86B3-D59B34ECEBBE},3,1</d:ContentTag>
         <d:CustomizedPageStatus m:type="Edm.Int32">0</d:CustomizedPageStatus>
         <d:ETag>"{63FD2CFA-D223-405B-86B3-D59B34ECEBBE},3"</d:ETag>
         <d:Exists m:type="Edm.Boolean">true</d:Exists>
         <d:Length m:type="Edm.Int64">638367</d:Length>
         <d:Level m:type="Edm.Byte">2</d:Level>
         <d:MajorVersion m:type="Edm.Int32">0</d:MajorVersion>
         <d:MinorVersion m:type="Edm.Int32">1</d:MinorVersion>
         <d:Name>aName.pdf</d:Name>
         <d:ServerRelativeUrl>/mydomain.com/afile</d:ServerRelativeUrl>
         <d:TimeCreated m:type="Edm.DateTime">2014-09-03T15:30:22Z</d:TimeCreated>
         <d:TimeLastModified m:type="Edm.DateTime">2014-09-03T15:30:25Z</d:TimeLastModified>
         <d:Title />
         <d:UIVersion m:type="Edm.Int32">1</d:UIVersion>
         <d:UIVersionLabel>0.1</d:UIVersionLabel>
      </m:properties>
   </content>
</entry>

解析XML文件最简单的方法是DOM解析器。您可以找到文档和一些教程以及


另外,stackoverflow中的一个相关问题。

您可以使用Jaxb,现在它可以非常有效地用于解析目的,将XML转换为JAVA,称为解组。

您可以添加您尝试过或感到困惑的XML解析代码吗?谢谢,我没有看到那篇文章和教程。。。我试过这个
Author BlaBla
Title Bla
Type application/xml
TimeLastModified xx/xx/xxxx