Hi everyone,
I’ve been working on parsing large files. A client has about a 3MB file that dumps out approximately 1100 separate xml files. I never know how many records to assume, or if the records are valid.
I started the routine with the usual getFile, stream to bytes, bytes to string, string to document, document to record. If the record is malformed, then it throws an error. It is a peculiar error that was far down into the xml tree. So, I tried to map each iteration as a string. Here are the basic formats before and after:
[B]
[/b]
xmlRecord
record
Field
Field
Field
Field
record
…
…xmlRecord
record
I’m trying to make the xmlRecord:record = type string so I can just write it to a file.
If anyone has any ideas how I can skirt mapping to an exact record and map to a kind of loose record, please let me know…
So, I gave up on trying to get past correct records, out of memory errors and making Wm happy and tried something new.
I performed a getFile, converted all the way to a NODE. I instantiated a NODE Iterator (pub.web.getNodeIterator), and named the XMLRecord as my criteria. This is nice because it creates a BoundObject. I pass the bound object to a RecordToDocument, pass the resulting string to a write file. I put this into a REPEAT operation and so it now parses my document all the way through. I set the count on the repeat to “-1”. I have set enforceLegalXML to false.
My main issue is that it throws the following error:
[B2BSERV.0062.9001] Service record argument in RecordToDocument is null.
It throws this error whether I have a record name argument or not and it is always on the document count + 1 iteration.
Hopefully someone has encountered this or figured out how to get around this error. It is a B2BServer level error so I not sure exactly how to catch this and ignore it.
Thanks.
I tried to run this with and without specifying the correct record.