XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
- Stylus Studio Technical Forum (14621)
-> + JVM detection not finding JDK ... (2)
-> - stylus studio version 2011 pro... (1)
-> - WSDL 2.0 (1)
-> + Special characters in xml (2)
-> + cannot connect to mysql commun... (2)
-> + create a report from an existi... (2)
-> + Content not allowed in prolog (2)
-> + DB IInformix with database loc... (8)
-> + Stylus Report Designer (XML Re... (4)
-> - error: cos-nonambig: Content m... (1)
-> - UNIX .csv conversion and java ... (1)
-> + Nillable element, Validation e... (2)
-> + EDI Converter Error (2)
-> - CSV FILE INTO CARGO-IMP MESSAG... (1)
-> + BUG: Validation in piple will ... (2)
-> + Is there a 64-Bit Stylus Studi... (2)
-> + BUG: Read structure on SQL Ser... (3)
-> + [Customer Toyoto Motors Europe... (2)
-> - Get a schema for a JSON file (1)
-> + UNOC:4 forces converter to inp... (2)
-> - java class for xs:any elements (1)
-> + changing component separator (3)
-> + Output view disappeared (6)
-> + How to convert deeply nested X... (2)
-> + javax.net.ssl.SSLException (4)
-> - error converting .csv in a uni... (10)
-> ->error converting .csv in ...
-> ->error converting .csv in ...
-> ->error converting .csv in ...
-> ->error converting .csv in ...
-> ->error converting .csv in ...
-> ->error converting .csv in ...
-> ->error converting .csv in ...
-> ->error converting .csv in ...
-> ->error converting .csv in ...
-> + Menu bar disappeared (3)
-> - No Topic (1)
-> - What does "XML" stand for? So... (1)
-> - So XML is just HTML on steroid... (1)
-> + XHTML to XML conversion (2)
-> - Stylus Studio with DDTek xml c... (1)
-> + Installation fails (3)
-> + Is there a keyboard shortcut t... (2)
-> - Bug: Adding a scenario to an X... (1)
-> - Bug: Bug reporting outputs an ... (1)
-> - Tradacoms Invoice 9 Batch Quer... (1)
-> - problem with the product regis... (1)
-> + Help: Documentation... ends in... (2)
-> + How to install LIBxml2 (2)
-> - line numbers in validator outp... (1)
-> + Sharing Viollation in Stylus v... (5)
-> - support for asp.net in stylus... (1)
-> + how to use the latest java xml... (2)
-> - how to show xsd element relate... (1)
-> - Testing Stylus in a secure env... (1)
-> + How do you remove linemarkings... (3)
-> - Bug: Comment / Uncomment via C... (1)
-> + Setting escape (release) chara... (2)
-> + Xalan processor not showing up (2)
-> + Is there a keyboard shortcut t... (3)
-> - Modifying reports outside of S... (1)
-> + Run ALL Scenarios? (2)
-> + predefined macros ${ (4)
-> - TRADACOMS - EDI (1)
-> + SUM not working (3)
-> - Large xml file handling gives ... (1)
-> + 2011 Enterprise code folding f... (9)
-> + custom xml converter (3)
-> - Start Excel feter the mapping ... (1)
-> + Uninstall (2)
-> + xpath to compare two values fr... (2)
-> - xpath to compare two values fr... (1)
-> + SS2011 cannot save XML files u... (3)
-> + SS 2011 Enterprise saying 2010... (2)
-> + How to change the way whitespa... (7)
-> + Updating Relational Data Using... (4)
-> - Contract Stylus Studio help. ... (1)
-> + UTF_8 characters not displayed (6)
-> + Problem XSL to PDF ( dont reco... (2)
-> + HIPAA EDI - Looping question (4)
-> - HIPAA EDI - Looping question (1)
-> + Does XML Report support column... (2)
-> + Limited choice of XSL elements... (2)
-> + Single Source Publishing? (3)
-> - Stylus Stodio License (1)
-> - Stylus Stodio License (1)
-> + relax ng (3)
-> + having problem converting csv ... (8)
-> + error when selecting items fro... (2)
-> + CSV File to XML (3)
-> + Software registration - How to... (4)
-> - Software registration - How to... (1)
-> + .Net Saxon not supported by th... (2)
-> + How do I extend the Evaluation... (2)
-> + dst file (4)
-> + Flat File Custom XML conversio... (4)
-> + converting ascii file to xml f... (2)
-> + Evaluation Copy of Stylus Stud... (8)
-> + Batch process for soap (4)
-> + Strange error when running gen... (5)
-> + Merge Files (2)
-> + Convert cvs to XML (2)
-> + Stylus studio 2010 crashes in ... (5)
-> + excel to text (2)
-> + licence key? (2)
-> + JVM Heap error (4)
-> + How Do I clean TXT File? (2)
-> + SS Web Service Call Tester Pay... (3)
-> - SS Web Service Call Tester Mic... (1)
-- Previous [421-440] [441-460] [461-480] Next
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Jon GallegosSubject: error converting .csv in a unix script
Author: Jon Gallegos
Date: 12 Jan 2011 11:47 AM
I have been using the following code for a couple years converting XML to XML.

cd $IN_DIR
export PLF=ExtractedPartsList.csv

for eachfile in $PLF
do
java $TRANSFORM_DIR/saxon9.jar -s:$IN_DIR/$eachfile -warnings:silent -xsl:$MAP_DIR/NAPLMoTcMSE_TcMSE20a.xsl -o:$OUT_DIR/$eachfile

-----------------------------------------------------------------
But now I need to convert a .csv file. Here is the code I have;

java $TRANSFORM_DIR/saxon9.jar -s:converter:CSV:root=Document:row=Row?file:///$IN_DIR/$eachfile -warnings:silent -xsl:$MAP_DIR/NAPLMoTcMSE_TcMSE20b.xsl

and I get the following error.

$ ksh NAPLMoTcMSE_TcMSE20.sh
total 1888
-rw-r--r-- 1 38999 cat2jt 211262 Jan 11 15:38 Extracted PartsList.csv
-rw-r--r-- 1 38999 cat2jt 357486 Jan 12 10:19 ExtractedProcessStructure.csv
-rw-r--r-- 1 38999 cat2jt 362727 Jan 11 15:36 ExtractedProcessStructure.csv.bak
Source file converter:CSV:root=Document:row=Row?file:/nas02/ECRF/NGPA/Test/TcMSE2TcMSE/IDIR/ExtractedProcessStructure.csv does not exist

---------------------------------------------------
The file obviously exists. What am I doing wrong?

Postnext
Ivan PedruzziSubject: error converting .csv in a unix script
Author: Ivan Pedruzzi
Date: 18 Jan 2011 10:33 PM


Jon,

Saxon doesn't know how to resolve convert: URL unless you register a XML Converter as URI resolver.

If you ask Stylus Studio to generate the Java code (click XSLT -> Generate Java Code) you will see which API you need to call

Hope this helps
Ivan

Postnext
Jon GallegosSubject: error converting .csv in a unix script
Author: Jon Gallegos
Date: 28 Jan 2011 01:35 PM
Originally Posted: 28 Jan 2011 11:01 AM
in my UNIX directory I have the following files

$ ls -l
total 24672
-rwxr-xr-x 1 ngpqabat staff 7599 Jan 28 09:37 NAPLMiPDDA_TcMSE10.sh
-rw-r--r-- 1 ngpqabat staff 27255 Jan 28 10:27 NAPLMiPDDA_TcMSE10a.xsl
-rw-r--r-- 1 ngpqabat staff 887054 Jan 28 09:24 XMLConverters.jar
-rw-r--r-- 1 ngpqabat staff 4742210 Jan 27 13:57 saxon9.jar
-rw-r--r-- 1 ngpqabat staff 1864136 Jan 27 16:19 xerces-c_1.lib
-rw-r--r-- 1 ngpqabat staff 1597440 Jan 27 16:20 xerces-c_1_6_0.dll
-rw-r--r-- 1 ngpqabat staff 3385368 Jan 27 16:20 xerces260.lib
$

Yet i still get the following error when I run


$ ksh NAPLMiPDDA_TcMSE10.sh
Error on line 1 column 1 of file:/nas02/NGPA/NAPLMiPDDA_TcMSE10/InDir/ExtractedProcessStructure.csv:
SXXP0003: Error reported by XML parser: Content is not allowed in prolog.
Transformation failed: Run-time errors were reported
$


What am i doing wrong? Is there a file that i am missing?


UnknownNAPLMiPPDA_TcMSE10a.xsl
xslt map

UnknownPDDAInShort.csv
input file

Postnext
Ivan PedruzziSubject: error converting .csv in a unix script
Author: Ivan Pedruzzi
Date: 29 Jan 2011 12:48 AM
Jon,


.dll and .lib have no use on unix machine, you can safely delete the xerces-c.* files.

Copy the attached file run.jar side by side with saxon9.jar and use the following command line

SET IN=converter:CSV:first=yes:double=yes:root=PDDA:row=Row?PDDAInShort.csv
SET OUT=converter:TAB:encoding=utf-8:quotes=:collapse=no:root=Document:row=Row?InitialProcessStructure.txt
SET XSL=NAPLMiPPDA_TcMSE10a.xsl

java -cp saxon9.jar;XMLConverters.jar;run.jar run %IN% %OUT% %XSL%

Hope this helps
Ivan


Documentrun.jar

Postnext
Jon GallegosSubject: error converting .csv in a unix script
Author: Jon Gallegos
Date: 04 Feb 2011 11:20 AM
This is still not working for me.

Here is my file directory
-rwxrwxrwx 1 ngpqabat staff 8789 Feb04 10:38 NAPLMiPDDA_TcMSE10.sh
-rwxrwxrwx 1 ngpqabat staff 27255 Feb01 11:39 NAPLMiPDDA_TcMSE10a.xsl
-rwxrwxrwx 1 ngpqabat staff 887054 Jan28 09:24 XMLConverters.jar
-rwxrwxrwx 1 ngpqabat staff 2697 Jan31 14:51 run.jar
-rwxrwxrwx 1 ngpqabat staff 4742210 Jan27 13:57 saxon9.jar

I have attached my script.

and here is the message I am getting
Setting the variable environment.
Create the Logfile and Archive file names.
Archive the Extracted Process Structure file
Translate the Extracted Process structure into the Initial Proccss Structure format

Usage: java [-options] class [args...]
(to execute a class)
or java [-jar] [-options] jarfile [args...]
(to execute a jar file)

where options include:
-cp -classpath <directories and zip/jar files separated by :>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-? -help print this help message
-X print help on non-standard options
-assert print help on assert options

NAPLMiPDDA_TcMSE10.sh: XMLConverters.jar: 0403-006 Execute permission denied.
NAPLMiPDDA_TcMSE10.sh: run.jar: 0403-006 Execute permission denied.


UnknownNAPLMiPPDA_TcMSE10.xsl

Postnext
Ivan PedruzziSubject: error converting .csv in a unix script
Author: Ivan Pedruzzi
Date: 04 Feb 2011 11:06 PM
Hi Jon,

On Unix the classpath separator is : and System variables are addressed with $. See if the following command line works other ways please reference the online documentation of the Java Virtual Machine version you are using running.

java -cp saxon9.jar:XMLConverters.jar:run.jar run $IN $OUT $XSL

Hope this helps
Ivan

Postnext
Jon GallegosSubject: error converting .csv in a unix script
Author: Jon Gallegos
Date: 07 Feb 2011 10:09 AM
Originally Posted: 07 Feb 2011 10:08 AM
Ivan

I get the following error.

The java class could not be loaded. java.lang.UnsupportedClassVersionError: (run) bad major version at offset=6

We are runnning java5 on our unix servers

Postnext
Ivan PedruzziSubject: error converting .csv in a unix script
Author: Ivan Pedruzzi
Date: 08 Feb 2011 01:09 AM

I don't have Java 5 on my machine you have to recompile on your system

1) Extract Java source code from the run.jar

jar -xf run.jar run.java

2) compile run.java using Java Compile from JDK 1.5

javac -classpath saxon9.jar:XMLConverters.jar run.java

3) update run.jar

jar -uf run.jar run.class


Hope this helps
Ivan

Postnext
Jon GallegosSubject: error converting .csv in a unix script
Author: Jon Gallegos
Date: 17 Feb 2011 04:28 PM
This will not compile

run.java:2: package com.ddtek.xmlconverter does not exist
import com.ddtek.xmlconverter.ConverterFactory;
^
run.java:3: package com.ddtek.xmlconverter does not exist
import com.ddtek.xmlconverter.ConverterResolver;
^
run.java:11: package net.sf.saxon does not exist
import net.sf.saxon.FeatureKeys;
^
run.java:24: cannot find symbol
symbol : class ConverterResolver
location: class run ConverterResolver resolver = new ConverterFactory().newResolver();
^
run.java:24: cannot find symbol
symbol : class ConverterFactory
location: class run ConverterResolver resolver = new ConverterFactory().newResolver();
^
run.java:34: package net.sf.saxon does not exist TransformerFactory tFactory = new net.sf.saxon.TransformerFactoryImpl();
^
run.java:35: cannot find symbol
symbol : variable FeatureKeys
location: class run tFactory.setAttribute(FeatureKeys.RECOGNIZE_URI_QUERY_PARAMETERS, Boolean.TRUE);
^
run.java:36: cannot find symbol
symbol : variable FeatureKeys
location: class run tFactory.setAttribute(FeatureKeys.STRIP_WHITESPACE, "ignorable");
^
run.java:37: cannot find symbol
symbol : variable FeatureKeys
location: class run tFactory.setAttribute(FeatureKeys.VERSION_WARNING, Boolean.FALSE);
^
9 errors

Posttop
Jon GallegosSubject: error converting .csv in a unix script
Author: Jon Gallegos
Date: 18 Feb 2011 01:20 PM
I resolved the compiling issue, but now I am getting the following error when I run my script

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
at run.main(run.java:27)

the code in my script looks like this

set IN=converter:CSV:first=yes:double=yes:root=Document:row=Row?$IN_DIR/ExtractedProcessStructure.csv

set OUT=converter:TAB:encoding=utf-8:quotes=:collapse=no:root=Document:row=Row$OUT_DIR/InitialProcessStructure.txt

set XSL=NAPLMiTcMSE_TcMSE20a.xsl

java -cp saxon9.jar:XMLConverters.jar:NAPLMiTcMSE_TcMSE.jar NAPLMiTcMSE_TcMSE $IN $OUT $XSL

exit


ApplicationNAPLMiTcMSE_TcMSE.jar
Run .jar file

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.