Giter Site home page Giter Site logo

Comments (5)

sabas avatar sabas commented on May 28, 2024 1

If you're trying to validate an existing EDI you need the Parser (errors here are basic on the syntax)

$c = new EDI\Parser($file);
var_dump($c->errors());

Then you can use Analyser to get a string representation of the EDI, Interpreter to process it according to a xml mapping you load from the other package (Interpreter gives the error according to the message "semantic")

from edifact.

sabas avatar sabas commented on May 28, 2024

@carlosgoce it's clear now or you need some more insight?

from edifact.

carlosgoce avatar carlosgoce commented on May 28, 2024

I am going to try it today! But I think so. Thank you

from edifact.

itg-dave avatar itg-dave commented on May 28, 2024

Hi,

I tried to follow the recommendations but even if I force the wrong mapping, I still get no errors.

What I did:

use EDI\Parser;
use EDI\Analyser;
use EDI\Mapping\MappingProvider;

require_once __DIR__ . '/vendor/autoload.php';

$parser = new Parser();
$parser->load(__DIR__ . '/files/test1.edi');
var_dump($parser->get());
var_dump($parser->errors());

$mapping = new MappingProvider('D01B');

$analyser = new Analyser();
$segments = $analyser->loadSegmentsXml($mapping->getSegments());
$serviceSegments = $analyser->loadSegmentsXml($mapping->getServiceSegments(3));

$interpreter = new EDI\Interpreter($mapping->getMessage('INVOIC'), $segments, $serviceSegments);
$prep = $interpreter->prepare($parser->get());
var_dump($interpreter->getErrors());

The test file (INVOIC) uses the D96A specification so I should get some errors here.

Edit:
It works with a wrong set message type (p.e. DESADV instead of INVOIC).

from edifact.

sabas avatar sabas commented on May 28, 2024

@Dave3o3 in theory a later version of the same message could/should be compatible (it should have at least the same segments), so you can get no errors if it's well formed...
What kind of errors did you expect?

from edifact.

Related Issues (20)

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.