|
next
|
Subject: Adapter issues - Failng to Convert From XML to a fixed length text format Author: Matt Dawson Date: 29 Jun 2006 10:23 AM
|
Hi,
I've used the New\Convert to XML menu item to create INF10OTIS.conv (attached), which converts a fixed length field document to XML (sample in INF10OTIS-OTISTest.txt). This works fine, and I've been using the WYSIWYG XSLT editor to manipulate that without any issues.
My problem is when I want to 'round trip' data back to the fixed length format. According to the video tutorial/doco round tripping is possible, but when I try I get an error (03 Error.jpg) implying I can only convert to XML, not from. Other adapters such as CSV will allow Convert from XML, but not my fixed length field adapter.
I've even tried hacking demo.java in case it was an issue with the GUI only. I tried adjusting the 'two' section to reference my adapter instead of the CSV one - i.e.
...
input = (StreamSource) sff.resolve("x.xml", uriBase);
if (input==null)
throw new IOException("Unable to find 'x.xml' in " + uriBase);
output = (StreamResult) sff.outputStreamResolver("x.txt", uriBase);
if (output==null)
throw new IOException("Unable to create 'x.txt' in " + uriBase);
Converter fromXML = factory.newConvertFromXML("adapter:INF10OTIS.conv");
fromXML.convert(input, output);
input.getInputStream().close();
output.getOutputStream().close();
System.out.println("test 2 finished: x.xml -> x.txt");
...
Unfortunately I ended up with a similar error to that seen in the GUI:
...
test 1 finished: one.csv -> one.xml
Exception in thread "main" com.stylusstudio.converter.ConverterException: The adapter "Convert to XML" cannot convert from XML, it can only convert to XML.
at com.stylusstudio.converter.ConverterImpl.validateDirection(ConverterImpl.java:260)
...
Can anyone shed any light on how I can get this to work? I'm trying to hit a deadline less than 24 hours away and this is the last major roadblock to making it.
Thanks,
Matt
PS What I see in Enterprise 2006 r3 does look slightly different from the video describing EDI round tripping (see 01 Doco.jpg and 02 Actual.jpg), but I'm guessing that is just a minor difference due to the release.
INF10OTIS.conv Fixed length field adapter
01Doco.jpg Documentation Adapter Dialog
02Actual.jpg Actual Adapter Dialog
INF10OTIS-OTISTest.txt Sample data
|
next
|
Subject: Adapter issues - Failng to Convert From XML to a fixed length text format Author: Tony Lavinio Date: 29 Jun 2006 11:35 AM
|
Convert-to-XML is named that because it only goes in one direction.
The reason, not that it helps you much, is that it is much easier to
convert from various formats to a standardized one than it is to specify
all of the details of the various target formats (e.g. leading spaces or
not, leading zeros or not, sign on left or right, use + or nothing for
positive,...).
You can use XSLT to write fixed-width data.
Use the substring function, and add spaces.
For example:
<xsl:value-of select="substring(concat($value, ' '), 1, 10)"/>
It might even be easier to define a variable called $space that contains
the most number of spaces you'll need.
I hope this helps.
|
next
|
Subject: Adapter issues - Failing to Convert From XML to a fixed length text format Author: Matt Dawson Date: 29 Jun 2006 05:29 PM Originally Posted: 29 Jun 2006 05:26 PM
|
Hi Tony,
The outputting fixed length data solution will probably work, but I would have expected there to be something more automatic. All of the data lengths etc are already in the conv file - all that needs to happen is for them to be used. Now it sounds like I need to laboriously re-create all of that information I've already entered into your tool.
Another thing I noticed here is that the Convert XML ( http://www.stylusstudio.com/docs/v62/d_flatfileconversion10.html ) page shows that my .conv files should be directly accessible using this dialog. I have found no way to be able to achieve this, other than manually typing the adapter URL into the "Convert to XML" property. My adapter is part of my project, and also in the Stylus Studio Adapter directory so I've done everything I can think of to make this work. I included some screen shots demonstrating this in the original post.
While you made the flippant comment above about Convert-to-XML above, the products features, documentation and web site content imply this can be done:
- The deployment adapter FAQ ( http://www.stylusstudio.com/deployment/faq.html ) basically says it can be done. It classifies EDI and flat file adapters in exactly the same way, then separately states that the deployment adapters are bidirectional.
- Coverage of EDI round tripping shows "Convert to XML definitions" in the "Convert from XML" dialog, implying these can be used here.
- Both the built-in adapters and the "Convert to XML" wizard's resultant conv files are invoked using adapter URLs.
- I can select a conv file as my target document in the XSLT Mapper.
- Doco and web site content are rather sparse on topic of adapters and converting from XML, and also imply "convert to" adapters can be used in the "convert from" section.
So while you know what the product is capable of, those buying the product or trying to work out how to use it have to find out the hard way.
This is all rather disappointing, especially as this feature is one of the main reasons I chose Enterprise over Professional. Sounds now like that was money wasted.
Thanks,
Matt
|
|
|
|