Giter Club home page Giter Club logo

smooks-edi-cartridge's Introduction

Smooks EDI Cartridge

Maven Central Sonatype Nexus (Snapshots) Build Status

The EDI cartridge inherits from the DFDL cartridge to provide a reader for parsing EDI documents, and a visitor for serialising the event stream into EDI. Many of the options that are available from the DFDL cartridge are supported in the EDI cartridge as well (e.g., validation mode).

In the following pass-through configuration, Smooks parses an EDI document and then serialises, or unparses in DFDL nomenclature, the generated event stream to produce an EDI document identical to the parsed document.

smooks-config.xml
<?xml version="1.0"?>
<smooks-resource-list xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
                      xmlns:core="https://www.smooks.org/xsd/smooks/smooks-core-1.6.xsd"
                      xmlns:edi="https://www.smooks.org/xsd/smooks/edi-2.0.xsd">

    <!-- Configure the reader to parse the EDI stream into a stream of SAX events. -->
    <edi:parser schemaUri="/edi-to-xml-mapping.dfdl.xsd" // (1)
                segmentTerminator="%NL;" // (2)
                compositeDataElementSeparator="^"/> // (3)

    <!-- Apply a pipeline on the root event and replace the XML result produced from <edifact:parser .../> with the pipeline EDI result. -->
    <core:smooks filterSourceOn="/Order">
        <core:action>
            <core:inline>
                <core:replace/>
            </core:inline>
        </core:action>
        <core:config>
            <smooks-resource-list>
                <!-- Configure the writer to serialise the event stream into EDI. -->
                <edi:unparser schemaUri="/edi-to-xml-mapping.dfdl.xsd" // (1)
                              segmentTerminator="%NL;" // (2)
                              compositeDataElementSeparator="^" // (3)
                              unparseOnNode="*"/> // (4)
            </smooks-resource-list>
        </core:config>
    </core:smooks>

</smooks-resource-list>

Config attributes common to the parser and unparser resources are:

  1. schemaUri: the DFDL schema describing the structure of the EDI document to be parser or unparsed.

  2. segmentTerminator: the terminator for groups of related data elements. DFDL interprets %NL; as a newline.

  3. compositeDataElementSeparator: the delimiter for compound data elements.

The unparseOnNode attribute is exclusive to the unparser visitor. It tells the unparser which event to intercept and serialise. Consult with the EDI cartridge’s XSD documentation for the complete list of config attributes and elements.

EDI DFDL Schema

The user-defined DFDL schema supplied to the parser and unparser config elements drives the event mapping, whether it is EDI to SAX or SAX to EDI. This schema must import the bundled IBM_EDI_Format.dfdl.xsd DFDL schema which defines common EDI constructs like segments and data elements.

The following figure illustrates the mapping process:

Image:Edi-mapping.svg

  • input-message.edi is the input/output EDI document.

  • edi-to-xml-order-mapping.dfdl.xsd describes the EDI to SAX, or SAX to EDI, event mapping.

  • expected.xml is the result event stream from applying the mapping.

Segments

The next snippet shows a segment declaration in DFDL:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
            xmlns:ibmEdiFmt="http://www.ibm.com/dfdl/EDI/Format">

    <xsd:import namespace="http://www.ibm.com/dfdl/EDI/Format" schemaLocation="/EDIFACT-Common/IBM_EDI_Format.dfdl.xsd"/>

    <xsd:annotation>
        <xsd:appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format ref="ibmEdiFmt:EDIFormat"/>
        </xsd:appinfo>
    </xsd:annotation>

    <xsd:element dfdl:initiator="HDR" // (1)
                 name="header" // (2)
                 dfdl:ref="ibmEdiFmt:EDISegmentFormat"> // (3)
        <xsd:complexType>
            ...
        </xsd:complexType>
    </xsd:element>
</xsd:schema>
  1. dfdl:initiator identifies the segment code .

  2. name attribute specifies the segment’s XML mapping.

  3. ibmEdiFmt:EDISegmentFormat holds the segment structure definition; it is important to reference it from within the dfdl:ref attribute.

Segment Cardinality

What is not demonstrated in the previous section is the segment element’s optional attributes minOccurs and maxOccurs (default value of 1 in both cases). These attributes can be used to control the optional and required characteristics of a segment. An unbounded maxOccurs indicates that the segment can repeat any number of times in that location of the EDI document.

Segment Groups

You implicitly create segment groups when:

  1. Setting the "maxOccurs" in a segment element to more than one, and

  2. Adding within the segment element other segment elements

The HDR segment in the next example is a segment group because it is unbounded, and it encloses the CUS and ORD segments:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
            xmlns:ibmEdiFmt="http://www.ibm.com/dfdl/EDI/Format">

    <xsd:import namespace="http://www.ibm.com/dfdl/EDI/Format" schemaLocation="/EDIFACT-Common/IBM_EDI_Format.dfdl.xsd"/>

    <xsd:annotation>
        <xsd:appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format ref="ibmEdiFmt:EDIFormat"/>
        </xsd:appinfo>
    </xsd:annotation>

    <xsd:element dfdl:initiator="HDR" name="order" maxOccurs="unbounded">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentFormat">
                    ...
                </xsd:sequence>
                <xsd:element dfdl:initiator="CUS" dfdl:ref="ibmEdiFmt:EDISegmentFormat" name="customer-details">
                    <xsd:complexType>
                        ...
                    </xsd:complexType>
                </xsd:element>
                <xsd:element dfdl:initiator="ORD" dfdl:ref="ibmEdiFmt:EDISegmentFormat" name="order-item"
                             maxOccurs="unbounded">
                    <xsd:complexType>
                        ...
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

Data Elements

Segment data elements are children within a sequence element referencing the DFDL format ibmEdiFmt:EDISegmentSequenceFormat:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
            xmlns:ibmEdiFmt="http://www.ibm.com/dfdl/EDI/Format">

    <xsd:import namespace="http://www.ibm.com/dfdl/EDI/Format" schemaLocation="/EDIFACT-Common/IBM_EDI_Format.dfdl.xsd"/>

    <xsd:annotation>
        <xsd:appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format ref="ibmEdiFmt:EDIFormat"/>
        </xsd:appinfo>
    </xsd:annotation>

    <xsd:element dfdl:initiator="HDR" dfdl:ref="ibmEdiFmt:EDISegmentFormat" name="header">
        <xsd:complexType>
            <xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentSequenceFormat">
                <xsd:element name="order-id" type="xsd:string"/>
                <xsd:element name="status-code" type="xsd:string"/>
                <xsd:element name="net-amount" type="xsd:string"/>
                <xsd:element name="total-amount" type="xsd:string"/>
                <xsd:element name="tax" type="xsd:string"/>
                <xsd:element name="date" type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

Each child xsd:element within xsd:sequence represents an EDI data element. The name attribute is the name of the target XML element capturing the data element’s value.

Composite Data Elements

Data elements made up of components are yet another xsd:sequence referencing the DFDL format ibmEdiFmt:EDICompositeSequenceFormat:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
            xmlns:ibmEdiFmt="http://www.ibm.com/dfdl/EDI/Format">

    <xsd:import namespace="http://www.ibm.com/dfdl/EDI/Format" schemaLocation="/EDIFACT-Common/IBM_EDI_Format.dfdl.xsd"/>

    <xsd:annotation>
        <xsd:appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format ref="ibmEdiFmt:EDIFormat"/>
        </xsd:appinfo>
    </xsd:annotation>

    <xsd:element dfdl:initiator="CUS" dfdl:ref="ibmEdiFmt:EDISegmentFormat" name="customer-details">
        <xsd:complexType>
            <xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentSequenceFormat">
                <xsd:element name="username" type="xsd:string"/>
                <xsd:element name="name">
                    <xsd:complexType>
                        <xsd:sequence dfdl:ref="ibmEdiFmt:EDICompositeSequenceFormat">
                            <xsd:element name="firstname" type="xsd:string"/>
                            <xsd:element name="lastname" type="xsd:string"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="state" type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

Imports

Many EDI messages use the same segment definitions. Being able to define these segments once and import them into a top-level configuration saves on duplication. A simple configuration demonstrating the import feature would be as follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
            xmlns:ibmEdiFmt="http://www.ibm.com/dfdl/EDI/Format"
            xmlns:def="def">

    <xsd:import namespace="http://www.ibm.com/dfdl/EDI/Format" schemaLocation="/EDIFACT-Common/IBM_EDI_Format.dfdl.xsd"/>
    <xsd:import namespace="def" schemaLocation="example/edi-segment-definition.xml"/>

    <xsd:annotation>
        <xsd:appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format ref="ibmEdiFmt:EDIFormat"/>
        </xsd:appinfo>
    </xsd:annotation>

    <xsd:element name="Order">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:sequence dfdl:initiatedContent="yes">
                    <xsd:element dfdl:initiator="HDR" dfdl:ref="ibmEdiFmt:EDISegmentFormat" name="header" type="def:HDR"/>
                    <xsd:element dfdl:initiator="CUS" dfdl:ref="ibmEdiFmt:EDISegmentFormat" name="customer-details" type="def:CUS"/>
                    <xsd:element dfdl:initiator="ORD" dfdl:ref="ibmEdiFmt:EDISegmentFormat" name="order-item" maxOccurs="unbounded" type="def:ORD"/>
                </xsd:sequence>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

The above schema demonstrates the use of the import element, where just about anything can be moved into its own file for reuse.

Type Support

The type attribute on segment data elements allows datatype specification for validation. The following example shows type support in action:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
            xmlns:ibmEdiFmt="http://www.ibm.com/dfdl/EDI/Format">

    <xsd:import namespace="http://www.ibm.com/dfdl/EDI/Format" schemaLocation="/EDIFACT-Common/IBM_EDI_Format.dfdl.xsd"/>

    <xsd:annotation>
        <xsd:appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format ref="ibmEdiFmt:EDIFormat"/>
        </xsd:appinfo>
    </xsd:annotation>

    <xsd:element dfdl:initiator="HDR" dfdl:ref="ibmEdiFmt:EDISegmentFormat" name="header">
        <xsd:complexType>
            <xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentSequenceFormat">
                <xsd:element name="order-id" type="xsd:string"/>
                <xsd:element name="status-code" type="xsd:int" dfdl:textNumberPattern="0"/>
                <xsd:element name="net-amount" type="xsd:decimal" dfdl:textNumberPattern="0"/>
                <xsd:element name="total-amount" type="xsd:decimal" dfdl:textNumberPattern="#.#"/>
                <xsd:element name="tax" type="xsd:decimal" dfdl:textNumberPattern="#.#"/>
                <xsd:element name="date" type="xsd:date"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

Maven Coordinates

pom.xml
<dependency>
    <groupId>org.smooks.cartridges.edi</groupId>
    <artifactId>smooks-edi-cartridge</artifactId>
    <version>2.0.0-RC4</version>
</dependency>

XML Namespaces

xmlns:edi="https://www.smooks.org/xsd/smooks/edi-2.0.xsd"

Smooks EDIFACT Cartridge

Maven Central Sonatype Nexus (Snapshots) Build Status

Smooks 2 provides out-of-the-box support for UN EDIFACT interchanges in terms of pre-generated EDI DFDL schemas derived from the official UN EDIFACT message definition zip directories. This allows you to easily convert a UN EDIFACT message interchange into a consumable XML document. Specialised edifact:parser and edifact:unparser resources support UN EDIFACT interchanges as shown in the next example:

smooks-config.xml
<?xml version="1.0"?>
<smooks-resource-list xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
                      xmlns:core="https://www.smooks.org/xsd/smooks/smooks-core-1.6.xsd"
                      xmlns:edifact="https://www.smooks.org/xsd/smooks/edifact-2.0.xsd">

    <!-- Configure the reader to parse the EDIFACT stream into a stream of SAX events. -->
    <edifact:parser schemaUri="/d03b/EDIFACT-Messages.dfdl.xsd"/>

    <!-- Apply a pipeline on the root event and replace the XML result produced from <edifact:parser .../> with the pipeline EDIFACT result. -->
    <core:smooks filterSourceOn="/Interchange">
        <core:action>
            <core:inline>
                <core:replace/>
            </core:inline>
        </core:action>
        <core:config>
            <smooks-resource-list>
                <!-- Configure the writer to serialise the event stream into EDIFACT. -->
                <edifact:unparser schemaUri="/d03b/EDIFACT-Messages.dfdl.xsd" unparseOnNode="*"/>
            </smooks-resource-list>
        </core:config>
    </core:smooks>

</smooks-resource-list>

The edifact:parser and edifact:unparser, analogous to the edi:parser and edi:unparser, convert the stream according to the pre-generated DFDL schema referenced in the schemaUri attribute. Given that an EDIFACT schema can be very big compared to your average EDI schema, it may take minutes for the parser to compile it. Even having the cacheOnDisk attribute enabled may not be sufficient to meet your compilation time needs. For such situations, you can mitigate this problem by declaring ahead of time which message types the parser will process:

smooks-config.xml
<?xml version="1.0"?>
<smooks-resource-list xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
                      xmlns:core="https://www.smooks.org/xsd/smooks/smooks-core-1.6.xsd"
                      xmlns:edifact="https://www.smooks.org/xsd/smooks/edifact-2.0.xsd">

    <edifact:parser schemaUri="/d03b/EDIFACT-Messages.dfdl.xsd">
        <edifact:messageTypes>
            <edifact:messageType>ORDERS</edifact:messageType>
            <edifact:messageType>INVOIC</edifact:messageType>
        </edifact:messageTypes>
    </edifact:parser>

    <core:smooks filterSourceOn="/Interchange">
        <core:action>
            <core:inline>
                <core:replace/>
            </core:inline>
        </core:action>
        <core:config>
            <smooks-resource-list>
                <edifact:unparser schemaUri="/d03b/EDIFACT-Messages.dfdl.xsd" unparseOnNode="*">
                   <edifact:messageTypes>
                        <edifact:messageType>ORDERS</edifact:messageType>
                        <edifact:messageType>INVOIC</edifact:messageType>
                    </edifact:messageTypes>
                </edifact:unparser>
            </smooks-resource-list>
        </core:config>
    </core:smooks>
</smooks-resource-list>

The schema compilation time is directly proportional to the number of declared message types. The EDIFACT resources will reject any message which does not have its message type declared within the messageTypes child element. Apart from XML configuration, it is also possible to programmatically control the EDIFACT parser message types via a EdifactReaderConfigurator instance:

Smooks smooks = new Smooks();
smooks.setReaderConfig(new EdifactReaderConfigurator("/d03b/EDIFACT-Messages.dfdl.xsd").setMessageTypes(Arrays.asList("ORDERS", "INVOIC")));

etc...

Schema Packs

In an effort to simplify the processing of UN EDIFACT Interchanges, we have created tools to generate EDIFACT schema packs from the official UN EDIFACT message definition zip directories. The generated schema packs are deployed to a public Maven repository from where users can easily access the EDIFACT schemas for the UN EDIFACT message sets they need to support.

Schema packs are available for most of the UN EDIFACT directories. These are available from the Maven Snapshot and Central repositories and can be added to your application using standard Maven dependency management.

As an example, to add the D93A DFDL schema pack to your application classpath, add the following dependency to your application’s POM:

pom.xml
<!-- The mapping model sip set for the D93A directory... -->
<dependency>
    <groupId>org.smooks.cartridges.edi</groupId>
    <artifactId>edifact-schemas</artifactId>
    <classifier>d93a</classifier>
    <version>2.0.0-RC4</version>
</dependency>

Once you add an EDIFACT schema pack set to the application’s classpath, you configure Smooks to use the schemas by referencing the root schema in schemaUri attribute of the edifact:parser or edifact:unparser configuration (<version>/EDIFACT-Messages.dfdl.xsd):

smooks-config.xml
<?xml version="1.0"?>
<smooks-resource-list xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
                      xmlns:edifact="https://www.smooks.org/xsd/smooks/edifact-1.0.xsd">

    <edifact:parser schemaUri="/d03b/EDIFACT-Messages.dfdl.xsd">
        <edifact:messages>
            <edifact:message>ORDERS</edifact:message>
            <edifact:message>INVOIC</edifact:message>
        </edifact:messages>
    </edifact:parser>

</smooks-resource-list>

See the EDIFACT examples for further reference.

Maven Coordinates

pom.xml
<dependency>
    <groupId>org.smooks.cartridges.edi</groupId>
    <artifactId>smooks-edifact-cartridge</artifactId>
    <version>2.0.0-RC4</version>
</dependency>

XML Namespaces

xmlns:edifact="https://www.smooks.org/xsd/smooks/edifact-2.0.xsd"

LICENSE

Smooks EDI & EDIFACT Cartridges are open source and licensed under the terms of the Apache License Version 2.0, or the GNU Lesser General Public License version 3.0 or later. You may use Smooks EDI & EDIFACT Cartridges according to either of these licenses as is most appropriate for your project.

SPDX-License-Identifier: Apache-2.0 OR LGPL-3.0-or-later

smooks-edi-cartridge's People

Contributors

cjmamo avatar dependabot-preview[bot] avatar dependabot[bot] avatar deradam avatar ulischuster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

smooks-edi-cartridge's Issues

How to configure edifact unparser programatically?

Currently we use xml to configure the EDIFACT unparser while converting from Java to EDIFACT.
Kindly share an example on how to configure the same via Java program while initializing Smooks.

<?xml version="1.0"?> <smooks-resource-list xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd" xmlns:edifact="https://www.smooks.org/xsd/smooks/edifact-2.0.xsd" xmlns:core="https://www.smooks.org/xsd/smooks/smooks-core-1.6.xsd"> <core:smooks filterSourceOn="/Interchange"> <core:action> <core:inline> <core:replace/> </core:inline> </core:action> <core:config> <smooks-resource-list> <edifact:unparser schemaURI="/d97a/EDIFACT-Messages.dfdl.xsd" unparseOnNode="*"> <edifact:messageTypes> <edifact:messageType>DELFOR</edifact:messageType> </edifact:messageTypes> </edifact:unparser> </smooks-resource-list> </core:config> </core:smooks> </smooks-resource-list>

final Smooks smooks = new Smooks("smooks-config.xml");

How to initialize this configuration programmatically?

Thanks in advance.

UnEdifactSpecificationReader fails to read C770 from D96A

Hi Claude,
there seems to be a small issue with the UnEdifactSpecificationReader implementation (checked with 2.0.0-M2).

The C770 definition from D96A looks like this:

----------------------------------------------------------------------

      C770  ARRAY CELL DETAILS

      Desc: To contain the data for a contiguous set of cells in an
            array.

      Note: The component 9424 - array cell information - occurs 100
            times in the composite.

010   9424   Array cell information                        C  an..35

----------------------------------------------------------------------

-> the information about element 9424 is missing.

Compared to D01B version, where the outcome is as expected.

----------------------------------------------------------------------

       C770 ARRAY CELL DETAILS

       Desc: To contain the data for a contiguous set of cells in
             an array.

010    9424  Array cell data description               C      an..512

       Note: 
             The composite C770 - array cell details - occurs
             9999 times in the segment. The use of the ARR
             segment is restricted to be used only with Version 3
             of ISO-9735.
             The component 9424 - array cell information - occurs
             100 times in the composite C770. The use of C770 is
             restricted to be used only with the ARR segment
             within Version 3 of ISO-9735.

----------------------------------------------------------------------

Is it easy for you to adopt the specification reader accordingly?

Thanks, Philip

Problem with Code lists in UnEdifactSpecificationReader

HI Claude,
We stumbled over another issue in UnEdifactSpecificationReader: the code lists for D93A until (and including) D96B are not ready, because the ZIP-filenames are different than afterwards.
In the old versions the "UNCL.ZIP" contains e.g. these files:

UNCL-1.96A
UNCL-2.96A

whereas the newer versions (D97A and onwards) use this naming scheme:

UNCL.D97A

The UnEdifactSpecificationReader constructor calls readDefinitionEntries with a lot of parameters including new ZipDirectoryEntry("uncl.", definitionFiles) which translates internally to new ZipDirectoryEntry("uncl.", "uncl.", definitionFiles) meaning the filename in the outer ZIP starts with "uncl." and the filename in the inner ZIP starts with "uncl."

And this is error, since in D96A example above, it starts with uncl-1. etc.

So by replacing new ZipDirectoryEntry("uncl.", definitionFiles) with new ZipDirectoryEntry("uncl.", "uncl", definitionFiles) (no dot on the filename part) or even new ZipDirectoryEntry("uncl.", "*", definitionFiles) if you think this is better. We haven't analyzed the contents of the files though.

hth, Philip

No support for Edifact extensions, i.e. EAN011, available?

I have the use-case where I have to convert a D.01B Invoice which uses EAN011 extensions, i.e. a IMD+C++CU::9' segment (https://www.gs1.org/sites/default/files/docs/eancom/ean02s4/part2/invoic/0541.htm), though upon reading in the stream the following exception is raised:

Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 4889; cvc-enumeration-valid: Value 'CU' is not facet-valid with respect to enumeration '[1, 2, 3, 4, 5]'. It must be a value from the enumeration.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
	at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidType(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator.processElementContent(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.jaxp.validation.StreamValidatorHelper.validate(Unknown Source)
	at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
	at javax.xml.validation.Validator.validate(Validator.java:124)
	at org.apache.daffodil.util.Validator$.validateXMLSources(Validator.scala:87)
	at org.apache.daffodil.processors.ParseResult.validateResult(DataProcessor.scala:682)
	at org.apache.daffodil.processors.DataProcessor.$anonfun$parse$1(DataProcessor.scala:419)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at org.apache.daffodil.ExecutionMode$.$anonfun$usingRuntimeMode$1(ExecutionMode.scala:65)
	at org.apache.daffodil.processors.DataProcessor.parse(DataProcessor.scala:408)
	at org.apache.daffodil.processors.DataProcessor.parse(DataProcessor.scala:404)
	at org.apache.daffodil.japi.DataProcessor.parse(Daffodil.scala:718)
	at org.smooks.cartridges.dfdl.parser.DfdlParser.parse(DfdlParser.java:180)
	... 8 more

Process finished with exit code 1

as clearly the validator only uses the default IMD segment definition which only defines the 5 specified values for item description codes mentioned also by the exception message.

Edit: I'm currently using version 2.0.0-M1 of this library

The edi:parser's performance is not good

Hello,

Thank for providing Smooks. It is amazing.
Recently, I tried mooks-edi-cartridge 2.0.0-RC3.
I want to convert my edi message to xml, but I found the performance is not good.

This is my edi text.
edi.txt

This is my xsd. I change the file name to txt for uploading
edifact-to-xml-desadv-mapping.dfdl.xsd.txt

My source:

protected static String runSmooksTransform() throws IOException, SAXException {
// Instantiate Smooks with the config...
Smooks smooks = new Smooks(new DefaultApplicationContextBuilder().setClassLoader(EdiToXml.class.getClassLoader()).build());
smooks.addConfigurations("smooks-config-edifact-to-xml-desadv.xml");
try {
// Create an exec context - no profiles....
//ExecutionContext executionContext = smooks.createExecutionContext();

         StringResult result = new StringResult();

         // Configure the execution context to generate a report...
         //executionContext.getContentDeliveryRuntime().addExecutionEventListener(new HtmlReportGenerator("target/report/report.html"));

         // Filter the input message to the outputWriter, using the execution context...
         //smooks.filterSource(executionContext, new StreamSource(new ByteArrayInputStream(messageIn)), result);
         smooks.filterSource(new StreamSource(new ByteArrayInputStream(messageIn)), result);

         return result.getResult();
     } finally {
         smooks.close();
     }
}

I tried to run it, it ran 1 hour, but still didn't finish.

SecurityManager warnings when using the `smooks-edi-cartridge` and the `camel-spring-boot-starter` dependencies in same project.

Description

When smooks-edi-cartridge is used alongside the camel-spring-boot-starter dependency, XMLConverter spams WARN log messages for the following reason:

WARN 63053 --- [  restartedMain] o.a.camel.converter.jaxp.XmlConverter    : DocumentBuilderFactory doesn't support the attribute http://apache.org/xml/properties/security-manager, due to class org.apache.xerces.util.SecurityManager cannot be cast to class org.smooks.engine.delivery.sax.ng.org.apache.xerces.util.SecurityManager (org.apache.xerces.util.SecurityManager and org.smooks.engine.delivery.sax.ng.org.apache.xerces.util.SecurityManager are in unnamed module of loader 'app').

No other Smooks or Camel dependencies cause the warning messages.

Reproduce

In a Camel Spring Boot app, the camel-spring-boot-starter Maven dependency shown below is added to the POM.

 <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-spring-boot-starter</artifactId>
            <version>3.10.0</version>
        </dependency>

For Smooks, the following dependencies are added to the POM.

...
<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.smooks</groupId>
                <artifactId>smooks-bom</artifactId>
                <version>2.0.0-M3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

<dependencies>
...
        <dependency>
            <groupId>org.smooks.cartridges.edi</groupId>
            <artifactId>smooks-edi-cartridge</artifactId>
        </dependency>
...
</dependencies>

The following warning occurs multiple time when the app starts up.

2021-06-30 15:31:58.016  WARN 63053 --- [  restartedMain] o.a.camel.converter.jaxp.XmlConverter    : DocumentBuilderFactory doesn't support the attribute http://apache.org/xml/properties/security-manager, due to class org.apache.xerces.util.SecurityManager cannot be cast to class org.smooks.engine.delivery.sax.ng.org.apache.xerces.util.SecurityManager (org.apache.xerces.util.SecurityManager and org.smooks.engine.delivery.sax.ng.org.apache.xerces.util.SecurityManager are in unnamed module of loader 'app').

java.lang.IllegalArgumentException: class org.apache.xerces.util.SecurityManager cannot be cast to class org.smooks.engine.delivery.sax.ng.org.apache.xerces.util.SecurityManager (org.apache.xerces.util.SecurityManager and org.smooks.engine.delivery.sax.ng.org.apache.xerces.util.SecurityManager are in unnamed module of loader 'app')
	at org.smooks.engine.delivery.sax.ng.org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.setAttribute(DocumentBuilderFactoryImpl.java:145) ~[smooks-core-2.0.0-M3.jar:na]
	at org.apache.camel.converter.jaxp.XmlConverter.createDocumentBuilderFactory(XmlConverter.java:975) ~[camel-xml-jaxp-3.10.0.jar:3.10.0]
	at org.apache.camel.converter.jaxp.XmlConverter.getDocumentBuilderFactory(XmlConverter.java:880) ~[camel-xml-jaxp-3.10.0.jar:3.10.0]
	at org.apache.camel.converter.jaxp.XmlConverter.getDocumentBuilderFactory(XmlConverter.java:938) ~[camel-xml-jaxp-3.10.0.jar:3.10.0]
	at org.apache.camel.converter.jaxp.XmlConverter.toDOMDocument(XmlConverter.java:674) ~[camel-xml-jaxp-3.10.0.jar:3.10.0]
	at org.apache.camel.xml.jaxb.JaxbHelper.loadRouteTemplatesDefinition(JaxbHelper.java:233) ~[camel-xml-jaxb-3.10.0.jar:3.10.0]
	at org.apache.camel.dsl.xml.jaxb.JaxbXmlRoutesBuilderLoader$1.configure(JaxbXmlRoutesBuilderLoader.java:52) ~[camel-xml-jaxb-dsl-3.10.0.jar:3.10.0]
	at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:541) ~[camel-core-model-3.10.0.jar:3.10.0]
	at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:487) ~[camel-core-model-3.10.0.jar:3.10.0]
	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:462) ~[camel-core-model-3.10.0.jar:3.10.0]
	at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1150) ~[camel-base-engine-3.10.0.jar:3.10.0]
	at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:200) ~[camel-main-3.10.0.jar:3.10.0]
	at org.apache.camel.spring.boot.CamelSpringBootApplicationListener.onApplicationEvent(CamelSpringBootApplicationListener.java:106) ~[camel-spring-boot-3.10.0.jar:3.10.0]
	at org.apache.camel.spring.boot.CamelSpringBootApplicationListener.onApplicationEvent(CamelSpringBootApplicationListener.java:58) ~[camel-spring-boot-3.10.0.jar:3.10.0]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.8.jar:5.3.8]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.8.jar:5.3.8]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.8.jar:5.3.8]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.8.jar:5.3.8]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.8.jar:5.3.8]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.8.jar:5.3.8]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.8.jar:5.3.8]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.7.jar:2.4.7]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) ~[spring-boot-2.4.7.jar:2.4.7]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) ~[spring-boot-2.4.7.jar:2.4.7]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) ~[spring-boot-2.4.7.jar:2.4.7]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.7.jar:2.4.7]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.7.jar:2.4.7]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) ~[spring-boot-2.4.7.jar:2.4.7]
	at com.example.integrationdemo.IntegrationDemoApplication.main(IntegrationDemoApplication.java:12) ~[classes/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.7.jar:2.4.7]

EDIFACT D97A doesn't have valid enumerations

Dear All,

We are trying to create EDIFACT DELFOR D97A messages using Smooks 2.0.0-RC1.
We found that few of the qualifier enumerations are not valid for D97A messages.
Kindly advice on how this could be fixed?

pom.xml is attached for reference, the D97A XSD Schema also has only invalid enum values.

Example:
E1153ReferenceQualifier --> has only one value AAA in the enumeration
E3035PartyQualifier
E7143ItemNumberTypeCoded
E2013FrequencyCoded

Thanks a lot in advance
pom.xml.txt

Add schema support and bindings for post-2019 directories

Thanks for the fabulous work of the smooks team, I can now parse a whole range of EDIFACT files. For my appllication at hand, some files require the latest directories (D.20a and D.20b, to be precise). Is there a chance that they will be added to the smooks edifact cartridge and bindings? Alternatively, how would I go about creating them from the official directories myself?

M3 release

Hi,

as all of the tickets for M3 have been closed, is there any ETA when M3 will be available on Maven Central?

TIA,
Roman

Invalid edifact schemas in 2.0.0-RC2

Describe the bug

When trying to parse a valid edifact d96a ORDERS file with Smooks#filterSource a parsing exception is thrown:

Caused by: org.smooks.api.SmooksException: Validation Error: E6063 failed facet checks due to: facet enumeration(s): 1|2|3|8
Schema context: E6063 Location line 2180 column 14 in jar:file:.../.gradle/caches/modules-2/files-2.1/org.smooks.cartridges.edi/edifact-schemas/2.0.0-RC2/2a9680cfde02150481b654bc4ff52e65870ffaa3/edifact-schemas-2.0.0-RC2-d96a.jar!/d96a/EDIFACT-Segments.dfdl.xsd

The xds file indeed only specifies the options "1|2|3|8"

xsd

But according to this (truugo) and other pages "21" is a valid value here. Also available in the ZIP files of UNECE.

validationTool

To Reproduce

Pass a valid edifact d96a ORDERS file with value "21" for segment E6063 to Smooks#filterSource method.

Expected behavior

It's expected that the edifact file is parsed without exceptions.

Environment

Example:

  • Smooks: 2.0.0-RC2
  • Java: OpenJDK 17
  • OS: Ubuntu 22.04

C504-CurrencyDetails schema is incorrect

CUX segment has two C504 segments in EDIFACT spec but maxOccurs is one in the XML schema. JAXB represents C504-CurrencyDetails as JAXBElement and failing to produce EDIFACT.

    <xsd:complexType name="CUX-Currencies">
        <xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentSequenceFormat">
            <xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentPartRepeatSequenceFormat">
                <xsd:element dfdl:nilKind="literalValue" dfdl:nilValue="%ES;" dfdl:useNilForDefault="no" maxOccurs="1" minOccurs="0" name="C504" nillable="true" type="D03B:C504-CurrencyDetails"/>
            </xsd:sequence>
            <xsd:element minOccurs="0" name="E5402" type="D03B:E5402-CurrencyExchangeRate"/>
            <xsd:element minOccurs="0" name="E6341" type="D03B:E6341-ExchangeRateCurrencyMarketIdentifier"/>
        </xsd:sequence>
    </xsd:complexType>

CUX java bean to be change from

/*     */    @XmlElementRef(
/*     */       name = "C504",
/*     */       type = JAXBElement.class,
/*     */       required = false
/*     */    )
/*     */    protected JAXBElement<C504CurrencyDetails> c504;

to

/*     */    @XmlElement(
/*     */       name = "C504",
/*     */       nillable = true
/*     */    )
/*     */    protected List<C504CurrencyDetails> c504;

Got an incorrect edifact message when i ran smooks-examples -> java-to-edifact

Hello i'm trying to generate edifact messge ,so i modified examples(java-to-edifact) project . just added some chinese words in the NAD segment. The xml data was correct ..but i got an incorrect edifact message . please help me to check it .. thank you ..
such as :
NAD+SU+CN11::91++????????-????????????????????????????????????????+????????????????????????????????????18????+??????++300384+CN'

Allow Compilation on JDK > 9

To add new EDIFACT directories (see #172), I forked and cloned the repo. For the fresh clone, all tests in org.smooks.cartridges.edi and org.smooks.cartridges.edifact on master are failing.

For most tests, the stack trace is similar to the following:

[INFO] Running org.smooks.cartridges.edi.EdiFunctionalTestCase
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.41 s <<< FAILURE! - in org.smooks.cartridges.edi.EdiFunctionalTestCase
[ERROR] testSmooksConfigGivenUnparser  Time elapsed: 0.398 s  <<< ERROR!
java.lang.NoClassDefFoundError: javax/annotation/Resource
	at org.smooks.engine.DefaultApplicationContext.<init>(DefaultApplicationContext.java:88)
	at org.smooks.engine.DefaultApplicationContextBuilder.build(DefaultApplicationContextBuilder.java:90)
	at org.smooks.Smooks.<init>(Smooks.java:151)
	at org.smooks.cartridges.edi.EdiFunctionalTestCase.beforeEach(EdiFunctionalTestCase.java:60)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptLifecycleMethod(TimeoutExtension.java:126)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptBeforeEachMethod(TimeoutExtension.java:76)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeMethodInExtensionContext(ClassBasedTestDescriptor.java:490)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$synthesizeBeforeEachMethodAdapter$19(ClassBasedTestDescriptor.java:475)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachMethods$2(TestMethodTestDescriptor.java:167)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$5(TestMethodTestDescriptor.java:195)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:195)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachMethods(TestMethodTestDescriptor.java:164)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:127)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:150)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
	Suppressed: java.lang.NullPointerException: Cannot invoke "org.smooks.Smooks.close()" because "this.smooks" is null
		at org.smooks.cartridges.edi.EdiFunctionalTestCase.afterEach(EdiFunctionalTestCase.java:65)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
		at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
		at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
		at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
		at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
		at org.junit.jupiter.engine.extension.TimeoutExtension.interceptLifecycleMethod(TimeoutExtension.java:126)
		at org.junit.jupiter.engine.extension.TimeoutExtension.interceptAfterEachMethod(TimeoutExtension.java:108)
		at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
		at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
		at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
		at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
		at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
		at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
		at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
		at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
		at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeMethodInExtensionContext(ClassBasedTestDescriptor.java:490)
		at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$synthesizeAfterEachMethodAdapter$20(ClassBasedTestDescriptor.java:480)
		at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAfterEachMethods$9(TestMethodTestDescriptor.java:236)
		at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAllAfterMethodsOrCallbacks$12(TestMethodTestDescriptor.java:269)
		at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
		at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAllAfterMethodsOrCallbacks$13(TestMethodTestDescriptor.java:269)
		at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
		at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeAllAfterMethodsOrCallbacks(TestMethodTestDescriptor.java:268)
		at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeAfterEachMethods(TestMethodTestDescriptor.java:234)
		at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
		... 43 more
Caused by: java.lang.ClassNotFoundException: javax.annotation.Resource
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	... 73 more

I am running an up-to-date Maven setup locally:

❯ mvn --version
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Java version: 17.0.2, vendor: Eclipse Adoptium
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "12.3.1", arch: "x86_64", family: "mac"

I suppose that the code on the master branch on GitHub is functional. Any hints what I am missing locally? Does the code target an (outdated) JDK8 setup, where javax.* libraries are still part of the JDK?

Apache Daffodil default triad separator clashes with the comma as EDIFACT decimal separator

Apache Daffodil uses both a decimal separator (textStandardDecimalSeparator) and a thousand group separator (textStandardGroupingSeparator). The group separator by default is the comma. Setting the decimal separator to be the comma as well leads to a clash. This situation arises during EDIFACT parsing either if the comma is set in the service string advise – i.e., UNA:+,? ' – or when setting the comma as default decimal separator when configuring smooks – e.g.,

val reader = EdifactReaderConfigurator(schemaUri)
reader.setDecimalSign(",")
smooks.setReaderConfig(reader)

The resulting error is

org.smooks.api.SmooksException: Failed to filter source
[..]
Caused by: org.smooks.api.SmooksException: Schema Definition Error: Non-distinct property ',' found in: textStandardGroupingSeparator, textStandardDecimalSeparator
Schema context: E0017 Location line 3334 column 14 in jar:file:.m2/repository/org/smooks/cartridges/edi/edi-schemas/2.0.0-RC1/edi-schemas-2.0.0-RC1.jar!/EDIFACT-Common/EDIFACT-Service-Segments-4.1.dfdl.xsd

A workaround is to set the Daffodil triad separator to some character that is not used in EDIFACT, like reader.setDecimalSign(",").setTriadSeparator("~"). However, it would be great if the smooks EDIFACT cartridge would take care of this issue in its default configuration

edifact-schemas:d93a -> Cannot resolve the name 'D93A:SPS-SamplingParametersForSummaryStatiC1DTMDateTimePeriod'

Hi team,

I wanted to parse an edifact file using smooks on d93a directory and had the following issue:

Caused by: org.smooks.cdr.SmooksConfigurationException: org.smooks.cdr.SmooksConfigurationException: java.lang.RuntimeException: Schema Definition Error: Error loading schema due to org.xml.sax.SAXParseException; systemId: jar:file:/Users/user/.m2/repository/org/smooks/cartridges/edi/edifact-schemas/2.0.0-SNAPSHOT/edifact-schemas-2.0.0-20200503.064839-16-d93a.jar!/d93a/EDIFACT-Messages.dfdl.xsd; lineNumber: 5045; columnNumber: 211; src-resolve: Cannot resolve the name 'D93A:SPS-SamplingParametersForSummaryStatiC1DTMDateTimePeriod' to a(n) 'type definition' component.
Schema context: file:/var/folders/dt/kh2b6dzs0kn01ytwdr9ml9n80000gn/T/EDIFACT-Interchange13258740284105143729.dfdl.xsd Location in file:/var/folders/dt/kh2b6dzs0kn01ytwdr9ml9n80000gn/T/EDIFACT-Interchange13258740284105143729.dfdl.xsd

It seems that the EDIFACT-Messages.dfdl.xsd contains an unkown type here

            <xsd:element maxOccurs="200" minOccurs="0" name="SegGrp-5">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:sequence dfdl:initiatedContent="yes">
                            <xsd:element dfdl:initiator="LIN" dfdl:ref="ibmEdiFmt:EDISegmentFormat" maxOccurs="1" minOccurs="1" name="LIN" type="D93A:LIN-LineItem"/>
                            <xsd:element dfdl:initiator="PIA" dfdl:ref="ibmEdiFmt:EDISegmentFormat" maxOccurs="10" minOccurs="0" name="PIA" type="D93A:PIA-AdditionalProductId"/>
                            <xsd:element dfdl:initiator="IMD" dfdl:ref="ibmEdiFmt:EDISegmentFormat" maxOccurs="10" minOccurs="0" name="IMD" type="D93A:IMD-ItemDescription"/>
                            <xsd:element dfdl:initiator="MEA" dfdl:ref="ibmEdiFmt:EDISegmentFormat" maxOccurs="10" minOccurs="0" name="MEA" type="D93A:MEA-Measurements"/>
                            <xsd:element dfdl:initiator="PSD" dfdl:ref="ibmEdiFmt:EDISegmentFormat" maxOccurs="1" minOccurs="0" name="PSD" type="D93A:PSD-PhysicalSampleDescription"/>
                            <xsd:element dfdl:initiator="SPS" dfdl:ref="ibmEdiFmt:EDISegmentFormat" maxOccurs="10" minOccurs="0" name="SPS" type="D93A:SPS-SamplingParametersForSummaryStatiC1DTMDateTimePeriod"/>
                            <xsd:element dfdl:initiator="QTY" dfdl:ref="ibmEdiFmt:EDISegmentFormat" maxOccurs="10" minOccurs="0" name="QTY" type="D93A:QTY-Quantity"/>
                            <xsd:element dfdl:initiator="FTX" dfdl:ref="ibmEdiFmt:EDISegmentFormat" maxOccurs="5" minOccurs="0" name="FTX" type="D93A:FTX-FreeText"/>
                        </xsd:sequence>

The type D93A:SPS-SamplingParametersForSummaryStatiC1DTMDateTimePeriod is missing.

I guess that the issue is the edg parser. The element

<xsd:element dfdl:initiator="SPS" dfdl:ref="ibmEdiFmt:EDISegmentFormat" maxOccurs="10" minOccurs="0" name="SPS" type="D93A:SPS-SamplingParametersForSummaryStatiC1DTMDateTimePeriod"/>

is based on the following segment group definition. Seems like it does not like the missing space between the name and the "C".

  --- Segment Group 5 ------------------------------- C    200 ------+
  LIN  Line item                            M      1                 |
  PIA  Additional product id                C     10                 |
  IMD  Item description                     C     10                 |
  MEA  Measurements                         C     10                 |
  PSD  Physical sample description          C      1                 |
  SPS  Sampling parameters for summary statiC      1                 |
  DTM  Date/time/period                     C     10                 |
  QTY  Quantity                             C     10                 |
  FTX  Free text                            C      5                 |

I guess the issue is in this pattern (https://github.com/smooks/smooks-edi-cartridge/blob/master/ect/src/main/java/org/smooks/edi/ect/formats/unedifact/UnEdifactMessage.java#L80)

The correct one removes the whitespace in front of the M|C|m|c
(\d{4,5})[-+* XS](\w{3}) (.)(M|C|m|c) (\d+)[ |]

The correct one can be tested here -> https://regex101.com/r/Gxfvsf/1

EDI parsing/Unparsing fails in case of nested jars

Because of the following bug introduced in daffodil v3.6.0
https://issues.apache.org/jira/browse/DAFFODIL-2892

Smooks version RC3 and above fail to parse and unparse EDI.

Steps to reproduce:

  1. Create a jar with EDI parsing or unparsing example.
  2. deploy that jar and try to invoke EDI parsing/unparsing.
  3. The transfprmation fails with following stacktrace:

Caused by: org.smooks.api.SmooksConfigException: org.smooks.api.SmooksConfigException: java.lang.RuntimeException: org.apache.daffodil.lib.exceptions.Abort: Invariant broken: parts.length.==(2)
org.apache.daffodil.lib.exceptions.Assert$.abort(Assert.scala:159)
org.apache.daffodil.lib.util.Misc$.optRelativeJarFileURI(Misc.scala:183)
org.apache.daffodil.lib.util.Misc$.getResourceRelativeOnlyOption(Misc.scala:145)
org.apache.daffodil.lib.xml.XMLUtils$.$anonfun$resolveSchemaLocation$3(XMLUtils.scala:1492)
at org.smooks.cartridges.dfdl.unparser.DfdlUnparserContentHandlerFactory.create(DfdlUnparserContentHandlerFactory.java:74)
at org.smooks.cartridges.dfdl.unparser.DfdlUnparserContentHandlerFactory.create(DfdlUnparserContentHandlerFactory.java:56)
at org.smooks.engine.delivery.DefaultContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.addContentDeliveryUnit(DefaultContentDeliveryConfigBuilder.java:442)
at org.smooks.engine.delivery.DefaultContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyContentDeliveryUnitStrategy(DefaultContentDeliveryConfigBuilder.java:399)
at org.smooks.engine.delivery.DefaultContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyStrategy(DefaultContentDeliveryConfigBuilder.java:373)
at org.smooks.engine.delivery.DefaultContentDeliveryConfigBuilder$ResourceConfigTableIterator.iterate(DefaultContentDeliveryConfigBuilder.java:524)
at org.smooks.engine.delivery.DefaultContentDeliveryConfigBuilder$ResourceConfigTableIterator.access$200(DefaultContentDeliveryConfigBuilder.java:504)
at org.smooks.engine.delivery.DefaultContentDeliveryConfigBuilder.extractContentHandlers(DefaultContentDeliveryConfigBuilder.java:346)
at org.smooks.engine.delivery.DefaultContentDeliveryConfigBuilder.load(DefaultContentDeliveryConfigBuilder.java:238)
at org.smooks.engine.delivery.DefaultContentDeliveryConfigBuilder.build(DefaultContentDeliveryConfigBuilder.java:140)
at org.smooks.engine.delivery.DefaultContentDeliveryRuntimeFactory.create(DefaultContentDeliveryRuntimeFactory.java:86)
at org.smooks.engine.DefaultExecutionContext.(DefaultExecutionContext.java:117)
at org.smooks.engine.DefaultExecutionContext.(DefaultExecutionContext.java:94)
at org.smooks.Smooks.createExecutionContext(Smooks.java:438)
at org.smooks.Smooks.createExecutionContext(Smooks.java:404)
at org.smooks.engine.resource.visitor.smooks.NestedSmooksVisitor.filterSource(NestedSmooksVisitor.java:398)
at org.smooks.engine.resource.visitor.smooks.NestedSmooksVisitor.replaceBefore(NestedSmooksVisitor.java:325)
at org.smooks.engine.resource.visitor.smooks.NestedSmooksVisitor.visitBefore(NestedSmooksVisitor.java:264)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:178)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:175)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor.intercept(AbstractInterceptorVisitor.java:122)
at org.smooks.engine.delivery.interceptor.EventInterceptor.visitBefore(EventInterceptor.java:67)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:178)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:175)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor.intercept(AbstractInterceptorVisitor.java:122)
at org.smooks.engine.delivery.interceptor.TextConsumerInterceptor.visitBefore(TextConsumerInterceptor.java:89)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:178)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:175)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor.intercept(AbstractInterceptorVisitor.java:122)
at org.smooks.engine.delivery.interceptor.StreamResultWriterInterceptor.visitBefore(StreamResultWriterInterceptor.java:87)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:178)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:175)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor.intercept(AbstractInterceptorVisitor.java:122)
at org.smooks.engine.delivery.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:106)
at org.smooks.engine.delivery.interceptor.ExceptionInterceptor.visitBefore(ExceptionInterceptor.java:86)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:178)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor$VisitBeforeInvocation.invoke(AbstractInterceptorVisitor.java:175)
at org.smooks.engine.delivery.interceptor.AbstractInterceptorVisitor.intercept(AbstractInterceptorVisitor.java:122)
at org.smooks.engine.delivery.interceptor.StaticProxyInterceptor.visitBefore(StaticProxyInterceptor.java:120)
at org.smooks.engine.delivery.sax.ng.SaxNgHandler.visitBefore(SaxNgHandler.java:284)
at org.smooks.engine.delivery.sax.ng.SaxNgHandler.startElement(SaxNgHandler.java:186)
at org.smooks.engine.delivery.SmooksContentHandler.startElement(SmooksContentHandler.java:110)
at com.ctc.wstx.sr.BasicStreamReader.fireSaxStartElement(BasicStreamReader.java:1787)
at com.ctc.wstx.sax.WstxSAXParser.fireStartTag(WstxSAXParser.java:806)
at com.ctc.wstx.sax.WstxSAXParser.fireEvents(WstxSAXParser.java:691)
at com.ctc.wstx.sax.WstxSAXParser.parse(WstxSAXParser.java:623)
at org.smooks.engine.delivery.sax.ng.SaxNgParser.parse(SaxNgParser.java:86)
at org.smooks.engine.delivery.sax.ng.SaxNgFilter.doFilter(SaxNgFilter.java:110)
... 158 more

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior.

Expected behavior

A clear and concise description of what you expected to happen.

Environment

Sample

A link to a GitHub repository with a minimal, reproducible sample.

Reports that include a sample will take priority over reports that do not. At times, we may require a sample, so it is good to try and include a sample up front.

Creates a wrong message

Hi,

I've a problem while generating EDIFACT messages, I'm receiving an object, I transform it to smooks binding Interchange object and then converting it again to a EDI file using smooks converter, the question here is that the fields has size limits (as shown in definition and schemas), and there are not being validated so i can put (for example) a value larger than expected, is there any way to validate them or I must do it manually?

Thanks.

Generating composite elements loses codelist entry information

While parsing the respective code list, composite element and segment definition files in UnEdifactDefinitionReader the parsed code list information is unfortunately lost on composite elements.

I.e. at the referenced line datas contains a list of component definition containing the respective code list entries within a list of string values. However, later on only the ID itself is copied over to the new component which therefore leads to the loss of that information.

If a simple data element uses code list entries they actually get copied over as here the data from the datas object is directly copied over while for composite elements the object with the lost information is used.

Is this working as intended?

As the code list itself only stores the code list identifier but not the actual value, i.e. YYMMDD or CCYYMMDD in case of DTM's code list, actual values for such components can never really be validated. I guess changing List<String> to Map<String, String> would be beneficial here.

Characters to escape are hard-coded in IBM_EDI_Format.dfdl.xsd

Describe the bug

The characters to escape are hard-coded in IBM_EDI_Format.dfdl.xsd. This means that during unparsing, when non-default delimiters are used, characters which should not be escaped are escaped anyway.

Solving this bug is tricky because there isn't an easy way to dynamically set the characters to be escaped from the DFDL schema. This issue has been reported to the Daffodil team and a JIRA issue was created.

To Reproduce

Go to the XML-to-EDI example and remove the workaround that declares a new escape scheme. Run the example and the following will be printed to the console:

HDR*1*0*59.97*64.92*4.95*Wed Nov 15 13?:45?:28 EST 2006
CUS*user1*Harry^Fletcher*SD
ORD*1*1*364*The 40-Year-Old Virgin*29.98
ORD*2*1*299*Pulp Fiction*29.99

Expected behavior

Referencing the earlier example, the expected output should be:

HDR*1*0*59.97*64.92*4.95*Wed Nov 15 13:45:28 EST 2006
CUS*user1*Harry^Fletcher*SD
ORD*1*1*364*The 40-Year-Old Virgin*29.98
ORD*2*1*299*Pulp Fiction*29.99

Environment

  • Smooks: 2.0.0-RC3

edifact-to-xml example does not run on Windows. tests both on M1 and M2

While testing edifact example, there is an error on building the D03B EDIFACT-Interchange6125501674812409972.dfdl.xsd in temp.
When I look to the file it is not xml valid. (I used xerces validation in notepad++).
The © character is changed to xA9
I guess the problem is in MustacheParser compile method which, I suppose, does not read the file using utf-8.

d:\smooks\smooks-examples\edifact-to-xml>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] --------< org.smooks.examples:smooks-example-unedifact-to-xml >---------
[INFO] Building Smooks Example - UN/EDIFACT - To XML 1.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ smooks-example-unedifact-to-xml ---
[INFO] Deleting d:\smooks\smooks-examples\edifact-to-xml\target
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce) @ smooks-example-unedifact-to-xml ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ smooks-example-unedifact-to-xml ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory d:\smooks\smooks-examples\edifact-to-xml\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ smooks-example-unedifact-to-xml ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to d:\smooks\smooks-examples\edifact-to-xml\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ smooks-example-unedifact-to-xml ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ smooks-example-unedifact-to-xml ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to d:\smooks\smooks-examples\edifact-to-xml\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ smooks-example-unedifact-to-xml ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.smooks.examples.edifact2xml.MainTestCase
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.822 s <<< FAILURE! - in org.smooks.examples.edifact2xml.MainTestCase
[ERROR] testRunSmooksTransform Time elapsed: 1.818 s <<< ERROR!
org.smooks.cdr.SmooksConfigurationException: Error invoking @PostConstruct method 'initialize' on class 'org.smooks.cartridges.dfdl.parser.DfdlParser'.
at org.smooks.cdr.lifecycle.phase.AbstractLifecyclePhase.invoke(AbstractLifecyclePhase.java:78)
at org.smooks.cdr.lifecycle.phase.PostConstructLifecyclePhase.doApplyLifecycle(PostConstructLifecyclePhase.java:88)
at org.smooks.cdr.lifecycle.phase.AbstractLifecyclePhase.applyLifecycle(AbstractLifecyclePhase.java:60)
at org.smooks.cdr.lifecycle.DefaultLifecycleManager.applyPhase(DefaultLifecycleManager.java:52)
at org.smooks.delivery.JavaContentHandlerFactory$1.apply(JavaContentHandlerFactory.java:99)
at org.smooks.delivery.JavaContentHandlerFactory$1.apply(JavaContentHandlerFactory.java:85)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at org.smooks.delivery.JavaContentHandlerFactory.create(JavaContentHandlerFactory.java:85)
at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.addContentDeliveryUnit(DefaultContentDeliveryConfigBuilder.java:520)
at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyContentDeliveryUnitStrategy(DefaultContentDeliveryConfigBuilder.java:464)
at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyStrategy(DefaultContentDeliveryConfigBuilder.java:451)
at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.iterate(DefaultContentDeliveryConfigBuilder.java:602)
at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.access$300(DefaultContentDeliveryConfigBuilder.java:582)
at org.smooks.delivery.DefaultContentDeliveryConfigBuilder.extractContentHandlers(DefaultContentDeliveryConfigBuilder.java:393)
at org.smooks.delivery.DefaultContentDeliveryConfigBuilder.load(DefaultContentDeliveryConfigBuilder.java:255)
at org.smooks.delivery.DefaultContentDeliveryConfigBuilder.build(DefaultContentDeliveryConfigBuilder.java:138)
at org.smooks.container.standalone.StandaloneExecutionContext.(StandaloneExecutionContext.java:118)
at org.smooks.container.standalone.StandaloneExecutionContext.(StandaloneExecutionContext.java:92)
at org.smooks.Smooks.createExecutionContext(Smooks.java:458)
at org.smooks.Smooks.createExecutionContext(Smooks.java:416)
at org.smooks.Smooks.filterSource(Smooks.java:490)
at org.smooks.examples.edifact2xml.Main.runSmooksTransform(Main.java:77)
at org.smooks.examples.edifact2xml.MainTestCase.testRunSmooksTransform(MainTestCase.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:212)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:208)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:150)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: org.smooks.cdr.SmooksConfigurationException: org.smooks.cdr.SmooksConfigurationException: java.lang.RuntimeException: Schema Definition Error: Error loading schema due to org.xml.sax.SAXParseException; systemId: file:/C:/Users/JEAN-F1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd; lineNumber: 0; columnNumber: 0; java.nio.charset.MalformedInputException: Input length = 1
Schema context: file:/C:/Users/JEAN-F
1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd Location in file:/C:/Users/JEAN-F1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd
at org.smooks.cartridges.edi.EdiDataProcessorFactory.createDataProcessor(EdiDataProcessorFactory.java:87)
at org.smooks.cartridges.dfdl.parser.DfdlParser.initialize(DfdlParser.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.smooks.cdr.lifecycle.phase.AbstractLifecyclePhase.invoke(AbstractLifecyclePhase.java:74)
... 87 more
Caused by: org.smooks.cdr.SmooksConfigurationException: java.lang.RuntimeException: Schema Definition Error: Error loading schema due to org.xml.sax.SAXParseException; systemId: file:/C:/Users/JEAN-F
1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd; lineNumber: 0; columnNumber: 0; java.nio.charset.MalformedInputException: Input length = 1
Schema context: file:/C:/Users/JEAN-F1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd Location in file:/C:/Users/JEAN-F1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd
at org.smooks.cartridges.edifact.EdifactDataProcessorFactory.doCreateDataProcessor(EdifactDataProcessorFactory.java:124)
at org.smooks.cartridges.edi.EdiDataProcessorFactory.createDataProcessor(EdiDataProcessorFactory.java:85)
... 93 more
Caused by: java.lang.RuntimeException: Schema Definition Error: Error loading schema due to org.xml.sax.SAXParseException; systemId: file:/C:/Users/JEAN-F1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd; lineNumber: 0; columnNumber: 0; java.nio.charset.MalformedInputException: Input length = 1
Schema context: file:/C:/Users/JEAN-F
1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd Location in file:/C:/Users/JEAN-F1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd
at org.smooks.cartridges.dfdl.DataProcessorFactory.lambda$compileOrGet$0(DataProcessorFactory.java:110)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at org.smooks.cartridges.dfdl.DataProcessorFactory.compileOrGet(DataProcessorFactory.java:105)
at org.smooks.cartridges.edifact.EdifactDataProcessorFactory.doCreateDataProcessor(EdifactDataProcessorFactory.java:122)
... 94 more
Caused by: Schema Definition Error: Error loading schema due to org.xml.sax.SAXParseException; systemId: file:/C:/Users/JEAN-F
1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd; lineNumber: 0; columnNumber: 0; java.nio.charset.MalformedInputException: Input length = 1
Schema context: file:/C:/Users/JEAN-F1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd Location in file:/C:/Users/JEAN-F1/AppData/Local/Temp/EDIFACT-Interchange6125501674812409972.dfdl.xsd
at org.apache.daffodil.dsom.DFDLSchemaFile.error(DFDLSchemaFile.scala:103)
at org.apache.daffodil.dsom.DFDLSchemaFile.fatalError(DFDLSchemaFile.scala:112)
at org.apache.daffodil.xml.DaffodilConstructingLoader.load(DaffodilConstructingLoader.scala:192)
at org.apache.daffodil.xml.DaffodilXMLLoader.load(DaffodilXMLLoader.scala:567)
at org.apache.daffodil.dsom.DFDLSchemaFile.$anonfun$loadedNode$1(DFDLSchemaFile.scala:127)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:675)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:673)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:670)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:720)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:720)
at org.apache.daffodil.dsom.DFDLSchemaFile.loadedNode(DFDLSchemaFile.scala:114)
at org.apache.daffodil.dsom.DFDLSchemaFile.node$lzycompute(DFDLSchemaFile.scala:136)
at org.apache.daffodil.dsom.DFDLSchemaFile.node(DFDLSchemaFile.scala:136)
at org.apache.daffodil.dsom.IIBase.$anonfun$iiSchemaFile$1(IIBase.scala:275)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:675)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:673)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:670)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:720)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:720)
at org.apache.daffodil.dsom.IIBase.iiSchemaFile(IIBase.scala:273)
at org.apache.daffodil.dsom.Import.$anonfun$mapPair$3(Import.scala:65)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.daffodil.dsom.Import.$anonfun$mapPair$1(Import.scala:45)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:675)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:673)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:670)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:720)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:720)
at org.apache.daffodil.dsom.Import.mapPair(Import.scala:43)
at org.apache.daffodil.dsom.IIBase.$anonfun$notSeenThisBefore$1(IIBase.scala:147)
at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:23)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:675)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:673)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:670)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:720)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:720)
at org.apache.daffodil.dsom.IIBase.notSeenThisBefore(IIBase.scala:146)
at org.apache.daffodil.dsom.IIBase.$anonfun$iiSchemaFileMaybe$1(IIBase.scala:264)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:675)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:673)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:670)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:720)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:720)
at org.apache.daffodil.dsom.IIBase.iiSchemaFileMaybe(IIBase.scala:263)
at org.apache.daffodil.dsom.IIBase.$anonfun$seenAfter$1(IIBase.scala:172)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:675)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:673)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:670)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:720)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:720)
at org.apache.daffodil.dsom.IIBase.seenAfter(IIBase.scala:171)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.$anonfun$getImportsOrIncludes$1(SchemaDocIncludesAndImportsMixin.scala:147)
at scala.collection.TraversableOnce$folder$1$.apply(TraversableOnce.scala:187)
at scala.collection.TraversableOnce$folder$1$.apply(TraversableOnce.scala:185)
at scala.collection.Iterator.foreach(Iterator.scala:943)
at scala.collection.Iterator.foreach$(Iterator.scala:943)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
at scala.collection.IterableLike.foreach(IterableLike.scala:74)
at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
at scala.collection.TraversableOnce.foldLeft(TraversableOnce.scala:189)
at scala.collection.TraversableOnce.foldLeft$(TraversableOnce.scala:184)
at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:108)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.getImportsOrIncludes(SchemaDocIncludesAndImportsMixin.scala:143)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.getImportsOrIncludes$(SchemaDocIncludesAndImportsMixin.scala:139)
at org.apache.daffodil.dsom.XMLSchemaDocument.getImportsOrIncludes(SchemaDocument.scala:54)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.$anonfun$ismli_$1(SchemaDocIncludesAndImportsMixin.scala:158)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:675)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:673)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:670)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:720)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:720)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.ismli_(SchemaDocIncludesAndImportsMixin.scala:157)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.importStatementsMap(SchemaDocIncludesAndImportsMixin.scala:155)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.importStatementsMap$(SchemaDocIncludesAndImportsMixin.scala:155)
at org.apache.daffodil.dsom.XMLSchemaDocument.importStatementsMap(SchemaDocument.scala:54)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.$anonfun$sali_$1(SchemaDocIncludesAndImportsMixin.scala:165)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:675)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:673)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:670)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:720)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:720)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.sali_(SchemaDocIncludesAndImportsMixin.scala:164)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.seenAfter(SchemaDocIncludesAndImportsMixin.scala:162)
at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.seenAfter$(SchemaDocIncludesAndImportsMixin.scala:162)
at org.apache.daffodil.dsom.XMLSchemaDocument.seenAfter(SchemaDocument.scala:54)
at org.apache.daffodil.dsom.SchemaSetIncludesAndImportsMixin.$anonfun$allSchemaFiles$1(SchemaSetIncludesAndImportsMixins.scala:62)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:675)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:673)
at org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:670)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:720)
at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:720)
at org.apache.daffodil.dsom.SchemaSetIncludesAndImportsMixin.allSchemaFiles(SchemaSetIncludesAndImportsMixins.scala:60)
at org.apache.daffodil.dsom.SchemaSetIncludesAndImportsMixin.allSchemaFiles$(SchemaSetIncludesAndImportsMixins.scala:60)
at org.apache.daffodil.dsom.SchemaSet.allSchemaFiles(SchemaSet.scala:66)
at org.apache.daffodil.dsom.SchemaSet.$anonfun$isValid$2(SchemaSet.scala:142)
at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:23)
at org.apache.daffodil.oolag.OOLAG$.keepGoing(OOLAG.scala:60)
at org.apache.daffodil.dsom.SchemaSet.isValid$lzycompute(SchemaSet.scala:141)
at org.apache.daffodil.dsom.SchemaSet.isValid(SchemaSet.scala:140)
at org.apache.daffodil.dsom.SchemaSet.$anonfun$isError$3(SchemaSet.scala:478)
at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:23)
at org.apache.daffodil.oolag.OOLAG$.keepGoing(OOLAG.scala:60)
at org.apache.daffodil.dsom.SchemaSet.$anonfun$isError$1(SchemaSet.scala:477)
at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:23)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
at org.apache.daffodil.ExecutionMode$.$anonfun$usingCompilerMode$1(ExecutionMode.scala:64)
at org.apache.daffodil.dsom.SchemaSet.isError(SchemaSet.scala:477)
at org.apache.daffodil.compiler.ProcessorFactory.isError(Compiler.scala:122)
at org.apache.daffodil.compiler.Compiler.org$apache$daffodil$compiler$Compiler$$compileSourceInternal(Compiler.scala:340)
at org.apache.daffodil.compiler.Compiler$.org$apache$daffodil$compiler$Compiler$$compileSourceSynchronizer(Compiler.scala:378)
at org.apache.daffodil.compiler.Compiler.compileSource(Compiler.scala:325)
at org.apache.daffodil.japi.Compiler.compileSource(Daffodil.scala:176)
at org.apache.daffodil.japi.Compiler.compileSource(Daffodil.scala:160)
at org.smooks.cartridges.dfdl.DfdlSchema.compileSource(DfdlSchema.java:128)
at org.smooks.cartridges.dfdl.DfdlSchema.compile(DfdlSchema.java:116)
at org.smooks.cartridges.dfdl.DataProcessorFactory.lambda$compileOrGet$0(DataProcessorFactory.java:108)
... 97 more

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] MainTestCase.testRunSmooksTransform:59 » SmooksConfiguration Error invoking @p...
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.915 s
[INFO] Finished at: 2020-11-04T10:51:00+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project smooks-example-unedifact-to-xml: There are test failures.
[ERROR]
[ERROR] Please refer to d:\smooks\smooks-examples\edifact-to-xml\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Create own EDIFACT JAXB entity

Trying to figure out how to generate JAXB entity for EDIFACT message. The reason I want to build own JAXB entities is to accomodate user defined identifier or qualifier.

Also I noticed org.smooks.edifact.binding.d95b.E1153ReferenceQualifier from out of box doesn't have all specified qualifers in the specification.

Can you please guide me how to build onw JAXB enitities from modified EDIFACT message specification?

@XmlType(name = "E1153-ReferenceQualifier")
@XmlEnum
public enum E1153ReferenceQualifier {

    AAA;

    public String value() {
        return name();
    }

    public static E1153ReferenceQualifier fromValue(String v) {
        return valueOf(v);
    }

}

Regression in M2 SNAPSHOT compared to M1

Hi guys,
when filtering an EDIFACT message with validation mode "Full" I get the following error message when doing so. That worked without problems in M1:

Exception in thread "main" org.smooks.cdr.SmooksConfigurationException: Error invoking @PostConstruct method 'initialize' on class 'org.smooks.cartridges.dfdl.parser.DfdlParser'.
	at org.smooks.cdr.lifecycle.phase.AbstractLifecyclePhase.invoke(AbstractLifecyclePhase.java:78)
	at org.smooks.cdr.lifecycle.phase.PostConstructLifecyclePhase.doApplyLifecycle(PostConstructLifecyclePhase.java:88)
	at org.smooks.cdr.lifecycle.phase.AbstractLifecyclePhase.applyLifecycle(AbstractLifecyclePhase.java:60)
	at org.smooks.cdr.lifecycle.DefaultLifecycleManager.applyPhase(DefaultLifecycleManager.java:52)
	at org.smooks.delivery.JavaContentHandlerFactory$1.apply(JavaContentHandlerFactory.java:99)
	at org.smooks.delivery.JavaContentHandlerFactory$1.apply(JavaContentHandlerFactory.java:85)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at org.smooks.delivery.JavaContentHandlerFactory.create(JavaContentHandlerFactory.java:85)
	at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.addContentDeliveryUnit(DefaultContentDeliveryConfigBuilder.java:520)
	at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyContentDeliveryUnitStrategy(DefaultContentDeliveryConfigBuilder.java:464)
	at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyStrategy(DefaultContentDeliveryConfigBuilder.java:451)
	at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.iterate(DefaultContentDeliveryConfigBuilder.java:602)
	at org.smooks.delivery.DefaultContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.access$300(DefaultContentDeliveryConfigBuilder.java:582)
	at org.smooks.delivery.DefaultContentDeliveryConfigBuilder.extractContentHandlers(DefaultContentDeliveryConfigBuilder.java:393)
	at org.smooks.delivery.DefaultContentDeliveryConfigBuilder.load(DefaultContentDeliveryConfigBuilder.java:255)
	at org.smooks.delivery.DefaultContentDeliveryConfigBuilder.build(DefaultContentDeliveryConfigBuilder.java:138)
	at org.smooks.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:118)
	at org.smooks.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:92)
	at org.smooks.Smooks.createExecutionContext(Smooks.java:458)
	at org.smooks.Smooks.createExecutionContext(Smooks.java:416)
	at org.smooks.Smooks.filterSource(Smooks.java:490)
	at SmooksEdifactToXML.runSmooksTransform(SmooksEdifactToXML.java:83)
	at SmooksEdifactToXML.main(SmooksEdifactToXML.java:97)
Caused by: org.smooks.cdr.SmooksConfigurationException: org.smooks.cdr.SmooksConfigurationException: java.lang.RuntimeException: org.apache.daffodil.japi.InvalidUsageException: 'Full' validation not allowed when using a restored parser.
	at org.smooks.cartridges.edi.EdiDataProcessorFactory.createDataProcessor(EdiDataProcessorFactory.java:87)
	at org.smooks.cartridges.dfdl.parser.DfdlParser.initialize(DfdlParser.java:175)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.smooks.cdr.lifecycle.phase.AbstractLifecyclePhase.invoke(AbstractLifecyclePhase.java:74)
	... 22 more
Caused by: org.smooks.cdr.SmooksConfigurationException: java.lang.RuntimeException: org.apache.daffodil.japi.InvalidUsageException: 'Full' validation not allowed when using a restored parser.
	at org.smooks.cartridges.edifact.EdifactDataProcessorFactory.doCreateDataProcessor(EdifactDataProcessorFactory.java:138)
	at org.smooks.cartridges.edi.EdiDataProcessorFactory.createDataProcessor(EdiDataProcessorFactory.java:85)
	... 28 more
Caused by: java.lang.RuntimeException: org.apache.daffodil.japi.InvalidUsageException: 'Full' validation not allowed when using a restored parser.
	at org.smooks.cartridges.dfdl.DataProcessorFactory.lambda$0(DataProcessorFactory.java:110)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at org.smooks.cartridges.dfdl.DataProcessorFactory.compileOrGet(DataProcessorFactory.java:105)
	at org.smooks.cartridges.edifact.EdifactDataProcessorFactory.doCreateDataProcessor(EdifactDataProcessorFactory.java:136)
	... 29 more
Caused by: org.apache.daffodil.japi.InvalidUsageException: 'Full' validation not allowed when using a restored parser.
	at org.apache.daffodil.japi.DataProcessor.withValidationMode(Daffodil.scala:590)
	at org.smooks.cartridges.dfdl.DfdlSchema.compile(DfdlSchema.java:123)
	at org.smooks.cartridges.dfdl.DataProcessorFactory.lambda$0(DataProcessorFactory.java:108)
	... 32 more

Any ideas what that might have caused?

Missing new Enumarions in simpletype E0054-MessageReleaseNumber

Hi,

im getting an error when i try to validate an file from directory higher than 12B.
I think the cause is because nobody add's the new directories to the Common Edifact Service-Segment.
The Enumartions in simpletype E0054-MessageReleaseNumber higher than 12B are missing.
Could anyone have a look on it?

Kind regards
Fabian

Include 91-2 EDIFACT directory

HI All,
I have seen that the mappings and bindings are only available for directories on or after 1992. Directories from before are missing bindings and mappings. Concretely 91-2 EDIFACT directory is missing and I need it. What are the chances to add it?

Thanks,

Tom

Support 91-1 EDIFACT

Hi there,

It would be nice if Smooks had bindings and mappings for EDIFACT 91-1.

Reason: my organisation has a "black box" EDIFACT system for Invoices, Orders and Dispatch Advice, we produce and consume v91-1 messages. We are updating our DB and the system requires to be re-written from the ground up but it needs to support 91-1.

After having looked at the below realise this is unlikely.

#45
https://groups.google.com/g/smooks-user/c/sYrgs_FtHZs

Thanks in advance and keep up the good work!

Skip EDIFACT 95B UNOC syntax version validation

I need to parse INVOIC 95B EDIFACT document but UNOC syntax version is 1. Simple hack might be change version before processing the document but is there anyway I can allow Smooks to process version 1 document.

I have tried using local version of EDIFACT-Interchange.dfdl.xsd but EdifactDataProcessorFactory class always getting it from EDIFACT-Common directory.

    static {
        try {
            MUSTACHE = new DefaultMustacheFactory().compile("EDIFACT-Common/EDIFACT-Interchange.dfdl.xsd.mustache");
        } catch (Throwable t) {
            throw new SmooksConfigException(t);
        }
    }

Tolerate array and optional EDIFACT segments that exceed their maximum bounds

Expected Behavior

Tolerate array and optional EDIFACT segments that exceed their maximum bounds.

Current Behavior

The EDIFACT cartridge jumps to a BadMessage event when an array or an optional segment exceeds its maximum bounds. Organisations might have their own flavour of the UN implementation guidelines but the EDIFACT reader should still tolerate these small validation errors so that the user doesn't need to edit the DFDL schema.

Context

See the discussion in the Smooks user forum for the motivation behind this enhancement.

edifact-schemas: maxOccurs in generated xsd is off-by-one in some cases

Hi.

When generating the xsds from the definitions in edifact-schemas/src/main/resources the maxOccurs of xsd:elements sometimes is one less than expected.

It was noticed for the file EDIFACT-Segments.dfdl.xsd in the artifact edifact-schemas-2.0.0-M3-d07a.jar: Here the section from the section for the GIN-GoodsIdentityNumber reads

    <xsd:complexType name="GIN-GoodsIdentityNumber">
        <xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentSequenceFormat">
            <xsd:element minOccurs="1" name="E7405" type="D07A:E7405-ObjectIdentificationCodeQualifier"/>
            <xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentPartRepeatSequenceFormat">
                <xsd:element dfdl:nilKind="literalValue" dfdl:nilValue="%ES;" dfdl:useNilForDefault="no" maxOccurs="4" minOccurs="1" name="C208" nillable="true" type="D07A:C208-IdentityNumberRange"/>
            </xsd:sequence>
        </xsd:sequence>
    </xsd:complexType>

Note maxOccurs="4" of C208 above.

On the other hand, in edifact-schemas/src/main/resources/d07a.zip -> edsd/edsd.zip -> EDSD.07A the corresponding section is

----------------------------------------------------------------------

       GIN  GOODS IDENTITY NUMBER      

       Function: To give specific identification numbers, either
                 as single numbers or ranges.    

010    7405 OBJECT IDENTIFICATION CODE QUALIFIER       M    1 an..3
  
020    C208 IDENTITY NUMBER RANGE                      M    1
       7402  Object identifier                         M      an..35                   
       7402  Object identifier                         C      an..35                   
  
030    C208 IDENTITY NUMBER RANGE                      C    1
       7402  Object identifier                         M      an..35                   
       7402  Object identifier                         C      an..35                   

040    C208 IDENTITY NUMBER RANGE                      C    1
       7402  Object identifier                         M      an..35                   
       7402  Object identifier                         C      an..35                   

050    C208 IDENTITY NUMBER RANGE                      C    1
       7402  Object identifier                         M      an..35                   
       7402  Object identifier                         C      an..35                   

060    C208 IDENTITY NUMBER RANGE                      C    1
       7402  Object identifier                         M      an..35                   
       7402  Object identifier                         C      an..35                   

----------------------------------------------------------------------

which indicates that C208 may be repeated up to 5 times.

This issue happens to a variety of type definitions (we noticed that GIR RELATED IDENTIFICATION NUMBERS, GOR GOVERNMENTAL REQUIREMENTS , PNA PARTY IDENTIFICATION are affected as well, there may be many more instances).

It seems that the problem only appears when there are repeated "C-type" components (like C208 in the example above), the simple "E-type" fields have the correct maxOccurs in all instances we have looked at.

Feel free to reach out if further details are required.

Cheers

Failed to Get XSD Schema from HTTP URI

When an HTTP URI is specified as the schemaURI of the edi:parser as shown below, no schema document is found. The imported file is imported over HTTP though.

<?xml version="1.0" encoding="UTF-8" ?>
<smooks-resource-list
        xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
        xmlns:edi="https://www.smooks.org/xsd/smooks/edi-2.0.xsd">

    <edi:parser schemaURI="http://localhost:8085/config/odfl-shipment-status-message"
                segmentTerminator="~"
                dataElementSeparator="*"
                compositeDataElementSeparator="^"/>

    <import file="http://localhost:8085/config/shipment-status-message-map"/>

</smooks-resource-list>

The error message is:

org.smooks.api.SmooksConfigException: java.lang.RuntimeException: Schema Definition Error: No schema document at location http://localhost:8085/config/odfl-shipment-status-message.
Schema context: Import Location in file:unknown

Testing the URI with Postman, the XSD is available. If the schemaURI is changed to a local file URI, the mapping is successful.

Maven > 3.8.1 cannot access non-HTTPS repository for smooks dependencies

Upon dependency resolution, I run into the following problem:
[WARNING] Could not transfer metadata org.smooks.cartridges.edi:edifact-jaxb-bindings:2.0.0-RC1-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/org/smooks/cartridges/edi/edifact-jaxb-bindings/2.0.0-RC1-SNAPSHOT/maven-metadata.xml

and
[WARNING] Could not transfer metadata org.smooks.cartridges.edi:smooks-edi-pom:2.0.0-RC1-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/org/smooks/cartridges/edi/smooks-edi-pom/2.0.0-RC1-SNAPSHOT/maven-metadata.xml

The problem seems to result from the new maven policy to disallow non-secure repositories (maven inserts the default-http-blocker) instead. However, in my POM, I do reference the smooks snapshot repository via HTTPS only:


oss.sonatype.org-snapshot
https://oss.sonatype.org/content/repositories/snapshots
...

Is there a transitive dependency somewhere that points to a non-HTTPS repository?

Add field delimeter to error message when segment has less fields than required

First off, thank you so much for this tool and the wonderful exception messages you provide in this tool!

They are so good, in fact, that I was almost able to construct an EDI mapping from just the exception messages alone (they do a wonderful job of hinting at what to do next).

To that end, it would be great if, when the number of fields is less than there should be for a segment, to add information about what the current field delimiter is. That way, the user can add the required amount of field delimiters to move on to a successful parse or, in the worst case, the next error message they can use to continue.

This idea would be great to add for any location in parsing where a delimiter is required.

Here's the exception in question:

throw new EDIParseException(edifactModel.getEdimap(), "Segment [" + segment.getSegcode() + "] expected to contain " + (numFieldsExpected - 1) + " fields. Actually contains " + (currentSegmentFields.length - 1) + " fields (not including segment code). Currently at segment number " + segmentReader.getCurrentSegmentNumber() + ".", segment, segmentReader.getCurrentSegmentNumber(), segmentReader.getCurrentSegmentFields());

Again, thank you! :)

How to validate syntax error in EDIFACT document

I am trying to figure out how to create document syntax exception when processing EDIFACT data.

I noticed you can get assert exception when it is defined in dfdl.xsd file. At the moment, I only get BadMessage segment when document has faulty but cannot interpret what went wrong.

		<D95B:BadMessage>
			<Segment>
				<Name>BGM</Name>
				<Data>2B3338302B494E563030303030312B39</Data>
			</Segment>
			<Segment>
				<Name>DTM</Name>
				<Data>2B333A32303230313133303A313032</Data>
			</Segment>
			<Segment>
				<Name>RFF</Name>
				<Data>2B4F4E3A54455354</Data>
			</Segment>

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.