Comments (5)
I created a test that is working in SegmentTest. It uses the new helper method which is not released, but you could easily just replace the two string addElement
with new Element(id, value)
. Please look at that. It runs properly in the integration tests.
@Test
void testReadmeExample() {
Loop isaLoop = new Loop("ISA_LOOP");
Segment segment = new Segment("ISA");
segment.addElement("01", "00");
segment.addElement("02", " ");
segment.addElement("03", "01");
segment.addElement("04", "SECRET ");
segment.addElement("05", "ZZ");
segment.addElement("06", "SUBMITTERS.ID ");
segment.addElement("07", "ZZ");
segment.addElement("08", "RECEIVERS.ID ");
segment.addElement("09", "030101");
segment.addElement("10", "1253");
segment.addElement("11", "U");
segment.addElement("12", "00501");
segment.addElement("13", "000000905");
segment.addElement("14", "1");
segment.addElement("15", "T");
segment.addElement("16", ":");
isaLoop.addSegment(segment);
segment = new Segment("IEA");
segment.addElement("01", "1");
segment.addElement("02", "000000905");
isaLoop.addSegment(segment);
assertEquals(2, isaLoop.getSegments().size());
}
from x12-parser.
I created a test that is working in SegmentTest. It uses the new helper method which is not released, but you could easily just replace the two string
addElement
withnew Element(id, value)
. Please look at that. It runs properly in the integration tests.@Test void testReadmeExample() { Loop isaLoop = new Loop("ISA_LOOP"); Segment segment = new Segment("ISA"); segment.addElement("01", "00"); segment.addElement("02", " "); segment.addElement("03", "01"); segment.addElement("04", "SECRET "); segment.addElement("05", "ZZ"); segment.addElement("06", "SUBMITTERS.ID "); segment.addElement("07", "ZZ"); segment.addElement("08", "RECEIVERS.ID "); segment.addElement("09", "030101"); segment.addElement("10", "1253"); segment.addElement("11", "U"); segment.addElement("12", "00501"); segment.addElement("13", "000000905"); segment.addElement("14", "1"); segment.addElement("15", "T"); segment.addElement("16", ":"); isaLoop.addSegment(segment); segment = new Segment("IEA"); segment.addElement("01", "1"); segment.addElement("02", "000000905"); isaLoop.addSegment(segment); assertEquals(2, isaLoop.getSegments().size()); }
The index parameter also has to be an int, not a String; I had to remove the quotes to even get it to compile.
I am still getting IndexOutOfBoundsException when using lines of the form,
segment.addElement(1, new Element("00", "00"));
from x12-parser.
That is a different issue. The elements are stored as a collection on the segment. You cannot add at a specific index if it doesn't already exist. To be honest, the addElement at a specific index method should probably just be removed.
Just use it without the index and if it is the first one it will be added at the first index.
segment.addElement(new Element("00", "00"));
This library has been used much more for reading X12 files. The APIs for creating new files could definitely be cleaned up.
from x12-parser.
That is a different issue. The elements are stored as a collection on the segment. You cannot add at a specific index if it doesn't already exist. To be honest, the addElement at a specific index method should probably just be removed.
Just use it without the index and if it is the first one it will be added at the first index.
segment.addElement(new Element("00", "00"));This library has been used much more for reading X12 files. The APIs for creating new files could definitely be cleaned up.
Fair enough. I need to mainly create files, so I'll probably be extending the heck out of this. Things like automatically adding the SE for an ST with the proper count and such... that should all be automatic.
from x12-parser.
I understand. As I said, we developed this because we needed to read different types of X12 files. The creation APIs were basically added to allow us to more easily unit test.
from x12-parser.
Related Issues (20)
- Make changes to toHtml output so that it supports an Edit form HOT 1
- Fix method that removes loop ambiguity HOT 1
- getFinalizedMatch function needs to prioritize child loops over siblings HOT 1
- Examples for converting x12 837 and 835 to xml using java using this parser HOT 4
- Handling apostrophes in elements in `toX12String()` HOT 2
- Unable to parse huge x12 documents HOT 4
- X12 270/271 HOT 1
- Is it possible to get updated 5010 based 270/271 mapping files? HOT 3
- add 271 5010 - 005010X279A1 HOT 3
- X12Reader - getMatchedLoop unable to handle 271 LS and LE segments HOT 1
- Fix 277 5010 x212 mapping HOT 2
- CLM is never in a 2300 loop but should always be. HOT 4
- 277 5010 x212 mapping has loop 2000B nested under 2000A HOT 1
- We found an ending segment but we never stored the first part of the loop! HOT 2
- README.md is pretty incomplete. HOT 7
- A new PRV segment Mapper missing after the HI segment HOT 9
- Allow for custom mapping files
- 270/271 5010 support HOT 9
- Documentation error? HOT 1
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 x12-parser.