Comments (5)
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.
@carlosgoce it's clear now or you need some more insight?
from edifact.
I am going to try it today! But I think so. Thank you
from edifact.
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.
@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)
- Release 0.5.0 not available via Composer HOT 2
- Possibility to have IDs instead of name as output from Interpreter::prepare HOT 5
- CDR read HOT 4
- Problems reading RFF segment from EDI-File HOT 1
- Array to string conversion, if an epty array met. HOT 1
- X12 HOT 6
- Package ramsey/array_column is abandoned HOT 2
- Trouble understanding how to get the data we need HOT 5
- Segment is ambiguous HOT 1
- Elements with maxrepeat > 1 should be considered arrays when parsed as json HOT 6
- Reader doesn't return full multi-line texts HOT 4
- Multiple SG2 segments not allowed HOT 8
- Issue parsing linebreaks in segments HOT 9
- UTF8 characters handling in input edi file HOT 15
- How to create edi document with .edi extension for healthcare HOT 4
- readEdiSegmentDTM for SG12 HOT 5
- File has multiple messages HOT 6
- question marks are not parsed correctly HOT 5
- Fatal error on integer-value segments for Encoder HOT 2
- Reader cannot be init with a null param HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edifact.