Giter Club home page Giter Club logo

Comments (2)

MikeEdgar avatar MikeEdgar commented on August 13, 2024

Hi @josecaster ,
The predefined schemas in the library are specifically used only for the control structures (UNB>UNG>UNH or UNB>UNH). As you are processing the input data, your application must set the transaction schema when it encounters the UNH segment (reader.setTransactionSchema). The reason for this design is that an application may not know the correct message schema to use until reading up to the UNH segment.

Instead of a schema file with interchange, you will want to create your XML with a transaction element only (plus all of the types you need). There is an example CONTRL schema in the test folder that might help: https://github.com/xlate/staedi/blob/master/src/test/resources/EDIFACT/CONTRL-v4r02.xml. Your transaction schema should not contain the UNH/UNT segments, as they are already handled by the predefined control schema.

Please note that if the DAM segment is nested in GRP5>GRP6, you will continue to receive unexpected segment errors unless you define all of preceding segments. Based on the schema you linked on the Truugo site, your high level schema will be something like this (note that UNH and UNT are not mentioned):

<schema xmlns="http://xlate.io/EDISchema/v3">
  <transaction>
    <sequence>
      <segment type="BGM" minOccurs="1" maxOccurs="1" />
      <segment type="FTX" maxOccurs="9" />
      <segment type="RFF" maxOccurs="9" />
      <loop code="GRP1" minOccurs="0" maxOccurs="1">
        <sequence>
          <!-- omitted -->
        </sequence>
      </loop>
      <loop code="GRP2" minOccurs="1" maxOccurs="9">
        <sequence>
          <!-- omitted -->
        </sequence>
      </loop>
      <loop code="GRP3" minOccurs="0" maxOccurs="999">
        <sequence>
          <!-- omitted -->
        </sequence>
      </loop>
      <loop code="GRP5" minOccurs="1" maxOccurs="999">
        <sequence>
          <segment type="EQD" minOccurs="1" maxOccurs="1" />
          <!-- omitted RFF through EQA -->
          <loop code="GRP6" minOccurs="1" maxOccurs="999">
            <segment type="DAM" minOccurs="1" maxOccurs="1" />
          </loop>
          <!-- omitted GRP7 and NAD -->
        </sequence>
      </loop>
      <segment type="CNT" minOccurs="1" maxOccurs="1" />
    </sequence>
  </transaction>
  <!-- elementType, compositeType, and segmentType for the items in the transaction -->
</schema>

from staedi.

josecaster avatar josecaster commented on August 13, 2024

Thanks Mike,

Once again. my question has been answered.
I get it now.

from staedi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.