위치 기반 FLAT 파일 (http://i.stack.imgur.com/EryDU.jpg)을 유효한 XML로 변환하려고합니다. 이 파일에는 머리말, 상세 선, 예고편이 들어 있습니다.FLAT 파일에 나타남, XSD를 사용하여 구문 분석 할 수 없음
Detail Line에는 데이터 문자 whilespace가 있고 Character 및 ALSO는 NULL과 같은 다른 특수 문자가 있습니다.
한 위치 길이를 채우는 NULL 문자. 1 개의 위치 길이를 채우는 공간.
우리가이 플랫 파일을 구문 분석 XSD를 다음 사용했다
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
xmlns:tns="http://xmlns.oracle.com/pcbpel/nxsdABO"
targetNamespace="http://xmlns.oracle.com/pcbpel/nxsdABO"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
nxsd:version="NXSD"
nxsd:stream="chars"
nxsd:encoding="ISO-8859-1"
>
<xsd:element name="ROOT">
<xsd:complexType>
<xsd:sequence minOccurs="1">
<xsd:element name="Header" nxsd:startsWith="H" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="InterfaceID" type="xsd:string" nxsd:style="fixedLength" nxsd:length="3" />
<xsd:element name="FileSeqNo" type="xsd:int" nxsd:style="fixedLength" nxsd:length="5" />
<xsd:element name="TimeStamp" type="xsd:int" nxsd:style="fixedLength" nxsd:length="14" />
<xsd:element name="FromSystem" type="xsd:string" nxsd:style="fixedLength" nxsd:length="10" />
<xsd:element name="ToSystem" type="xsd:string" nxsd:style="fixedLength" nxsd:length="10" minOccurs="0"/>
<xsd:element name="FromSAPSys" type="xsd:string" nxsd:style="fixedLength" nxsd:length="8" minOccurs="0"/>
<xsd:element name="FromSAPclt" type="xsd:string" nxsd:style="fixedLength" nxsd:length="3" minOccurs="0"/>
<xsd:element name="ToSAPSys" type="xsd:string" nxsd:style="fixedLength" nxsd:length="8" minOccurs="0"/>
<xsd:element name="ToSAPclt" type="xsd:string" nxsd:style="fixedLength" nxsd:length="4" minOccurs="0"/>
<xsd:element name="UserID" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DataLine2" nxsd:startsWith="D012" maxOccurs="unbounded" minOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="TransactionType" type="xsd:string" nxsd:style="fixedLength" nxsd:length="2" minOccurs="0"/>
<xsd:element name="Name" type="xsd:string" nxsd:style="fixedLength" nxsd:length="30" />
<xsd:element name="PostingKey" type="xsd:string" nxsd:style="fixedLength" nxsd:length="11" />
<xsd:element name="AdderssKey" type="xsd:string" nxsd:style="fixedLength" nxsd:length="26" />
<xsd:element name="TransactionKey" type="xsd:byte" nxsd:style="terminated" nxsd:terminatedBy="${eol}" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Trailer" nxsd:startsWith="T" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="FRecords" type="xsd:string" nxsd:style="fixedLength" nxsd:length="9" minOccurs="0"/>
<xsd:element name="DRecords" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
SOA 스위트 11g 파일 어댑터가 FLAT 파일을 구문 분석 할 수 없습니다, 그것은 빈 XML 문서를 반환하는 파일이있을 때 NULL 문자
그러나 우리는 그 NULL을 whi로 대체 할 때 문제가 없다.NULL을 구문 분석하기 위해 XSD에 아무것도 없습니다.
NULL을 처리하는 다른 방법이 있습니까? 거기
XML 파일로 변환 할 때 NUL 문자를 이스케이프 (escape) 할 수있는 방법이 있습니까? 또는 사용자 정의 Java 프로그램을 사용하여 NUL을 대체 할 수있는 방법을 알려주십시오. – user1589385
필터링을 수행하는 사용자 정의 InputStream 구현을 작성할 수 있습니다. –