本文介绍了我想从java中读取以下xml中的数据来帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 <? xml version = 1.0 ? > < ; BigDataComparator xmlns:xsi = http://www.w3.org/2001/XMLSchema-instance xmlns:xsd = http://www.w3.org/2001/XMLSchema FileType = TestCase > < TestCase name = MyFirstTestCase description = 这是第一个测试用例 > < SourceFeed 类型 = HDFS平面文件 > < FileName > HDFS://172.20.15.17:8020 /家庭/ LNT / HADO op / hadoop / ComparatorInput / sourceFile.txt < / FileName > < 分隔符 > | < / Delimiter > < StringQualifier > < / StringQualifier > < CommentCharacter > #< / CommentCharacter > < / SourceFeed > < TargetFeed type = HDFS平面文件 > < FileName > hdfs://172.20.15.17:8020 / home / lnt / Hadoop / hadoop / ComparatorInput / targetFile.txt < / FileName > < 分隔符 > | < /分隔符 > < StringQualifier > < / StringQualifier > < CommentCharacter > #< / CommentCharacter > < / TargetFeed > < TableMapping name = > < / TableMapping > < GeneralOptions ignorecase = true trimdata = false / > < / TestCase > < / BigDataComparator > 解决方案 试试这个:使用Java教程解析XML [ ^ ] <?xml version="1.0"?><BigDataComparator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" FileType="TestCase"> <TestCase name="MyFirstTestCase" description="This is very first test case"> <SourceFeed type="HDFS Flat File"> <FileName>hdfs://172.20.15.17:8020/home/lnt/Hadoop/hadoop/ComparatorInput/sourceFile.txt</FileName> <Delimiter>|</Delimiter> <StringQualifier>"</StringQualifier> <CommentCharacter>#</CommentCharacter> </SourceFeed> <TargetFeed type="HDFS Flat File"> <FileName>hdfs://172.20.15.17:8020/home/lnt/Hadoop/hadoop/ComparatorInput/targetFile.txt</FileName> <Delimiter>|</Delimiter> <StringQualifier>"</StringQualifier> <CommentCharacter>#</CommentCharacter> </TargetFeed> <TableMapping name=""> </TableMapping> <GeneralOptions ignorecase="true" trimdata="false" /> </TestCase></BigDataComparator> 解决方案 Try this: Parsing XML using Java Tutorial[^] 这篇关于我想从java中读取以下xml中的数据来帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-13 10:00