我有一个BeanIO Xml配置文件,我想在BeanReader调用之前从XML获取名为“ bbb”的记录的属性映射。我不需要领域。如何从StreamFactory中获取它?
我的文本文件的格式为“ fixedlength”。
我的XML配置文件:
<beanio xmlns="http://www.beanio.org/2012/03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.beanio.org/2012/03 http://www.beanio.org/2012/03/mapping.xsd">
<stream name="aaa" format="fixedlength">
<record name="ignored" order="1" occurs="1" />
<record name="bbb" order="2" class="map" minOccurs="0" maxOccurs="unbounded">
<property name="tableName" value="bbb" />
<property name="cleanAndInsert" value="false" type="boolean" />
<field name="fieldA" position="1" length="6" />
<field name="fieldB" position="7" length="1"/>
</record>
</stream>
</beanio>
Java代码:
StreamFactory readingFactory = StreamFactory.newInstance(); readingFactory.load(xmlConfigurationFile);
BeanReader beanReader = readingFactory.createReader(“ aaa”,importFileName);
对象记录= beanReader.read();
感谢您的帮助