0

我有一个非常简单的基于行的文档,其中每一行都包含一条记录。我想要一个 DFDL 将其解析为包含固定行数的块(例如,每个块有 3 条记录)。

原始文件:

record1
record2
record3
record4
record5
record6
record7

DFDL 解析后:

1) [record1, record2, record3]
2) [record4, record5, record6]
3) [record7]

我目前能够使用以下 DFDL 一次获取所有记录,但是当文档变大时会产生严重的问题,这就是我想逐页获取这些记录的原因。是否有可能做到这一点?有谁知道如何做到这一点?

<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:recSepFieldsFmt="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:import namespace="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat" schemaLocation="../IBMdefined/RecordSeparatedFieldFormat.xsd"/>
    <xsd:annotation>
        <xsd:appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format byteOrder="{$dfdl:byteOrder}" encoding="{$dfdl:encoding}" escapeSchemeRef="recSepFieldsFmt:RecordEscapeScheme" occursCountKind="fixed" ref="recSepFieldsFmt:RecordSeparatedFieldsFormat"/>
        </xsd:appinfo>
    </xsd:annotation>

    <xsd:element dfdl:encoding="{$dfdl:encoding}" ibmSchExtn:docRoot="true" name="MM1">
        <xsd:complexType>
            <xsd:sequence dfdl:separator="%CR;%LF;%WSP*;" dfdl:terminator="">
                                                                                                                                                                                                                                                                    <xsd:element dfdl:alignment="1" dfdl:escapeSchemeRef="" dfdl:lengthKind="delimited" dfdl:occursCountKind="implicit" maxOccurs="unbounded" name="body" type="xsd:string">
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

</xsd:schema>

谢谢

4

1 回答 1

0

<xsd:element ibmSchExtn:docRoot="true" name="MM1">
    <xsd:complexType>
        <xsd:sequence dfdl:separator="" dfdl:terminator="">
            <xsd:element dfdl:occursCountKind="implicit" maxOccurs="unbounded" name="Chunk">
             <xsd:complexType>
                 <xsd:sequence dfdl:separator="%CR;%LF;%WSP*;" dfdl:terminator="">
                    <xsd:element dfdl:lengthKind="delimited" dfdl:occursCountKind="implicit" maxOccurs="3" name="Body" type="xsd:string">
                    </xsd:element>
                 </xsd:sequence>
              </xsd:complexType>
           </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>

于 2015-10-09T15:26:16.433 回答