
org.databene.edifatto.EdiParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of edifatto Show documentation
Show all versions of edifatto Show documentation
'Edifatto' is an open source software library for parsing,
generating and verifying EDIFACT and X12 documents written by Volker Bergmann.
/*
* Copyright (C) 2013-2014 Volker Bergmann ([email protected]).
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.databene.edifatto;
import org.databene.edifatto.model.EdiProtocol;
import org.databene.edifatto.model.Interchange;
import org.databene.edifatto.parser.EdifactParser;
import org.databene.edifatto.parser.X12Parser;
import org.databene.edifatto.util.EdiUtil;
/**
* Parses EDIFACT and X12 documents into a hierarchical syntax tree.
* Created: 17.10.2013 12:38:01
* @since 1.0
* @author Volker Bergmann
*/
public class EdiParser {
public Interchange parse(String text) {
EdiProtocol protocol = EdiUtil.protocolForContent(text);
switch (protocol) {
case EDIFACT: return new EdifactParser().parse(text);
case X12: return new X12Parser().parse(text);
default: throw new UnsupportedOperationException("Not a supported protocol: " + protocol);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy