5 | Jack
6 | Straw
7 |
8 | EOF
9 |
10 | echo First name is <[$data/name/first/string()]>
11 |
12 |
--------------------------------------------------------------------------------
/xmlsh/samples/demo/xml/xml_proc.xsh:
--------------------------------------------------------------------------------
1 | # XML sub processes
2 | files=$<(xls)
3 | echo First file is <[$files//file[1]/@name/string()]>
4 |
--------------------------------------------------------------------------------
/xmlsh/samples/query/books-to-html.xquery:
--------------------------------------------------------------------------------
1 | xquery version "1.0";
2 |
3 |
4 | A list of books
5 |
6 |
7 | A list of books
8 | Here are some interesting books:
9 | {
10 | for $b in //BOOKS/ITEM
11 | order by $b/TITLE return
12 | { string($b/TITLE) } by { string($b/AUTHOR) }
13 | }
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/xmlsh/samples/styles/books-tle.xsl:
--------------------------------------------------------------------------------
1 |
2 |
4 | Generated at
6 |
7 | 120
8 |
9 |
10 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/xmlsh/samples/styles/identity.xsl:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/xmlsh/samples/styles/total.xsl:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | Total value of books in stock:
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/xmlsh/schemas/module.rnc:
--------------------------------------------------------------------------------
1 | default namespace = ""
2 |
3 | start =
4 | element module {
5 | attribute module_version { xsd:integer },
6 | attribute name { xsd:string },
7 | attribute package { xsd:string },
8 | attribute require { xsd:string }?,
9 | element classpath {
10 | element file {
11 | attribute url { xsd:NCName }
12 | }+
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/xmlsh/src/3rdparty/org/json/JSONException.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /**
4 | * The JSONException is thrown by the JSON.org classes when things are amiss.
5 | * @author JSON.org
6 | * @version 2008-09-18
7 | */
8 | public class JSONException extends Exception {
9 | /**
10 | *
11 | */
12 | private static final long serialVersionUID = 0;
13 | private Throwable cause;
14 |
15 | /**
16 | * Constructs a JSONException with an explanatory message.
17 | * @param message Detail about the reason for the exception.
18 | */
19 | public JSONException(String message) {
20 | super(message);
21 | }
22 |
23 | public JSONException(Throwable t) {
24 | super(t.getMessage());
25 | this.cause = t;
26 | }
27 |
28 | public Throwable getCause() {
29 | return this.cause;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/xmlsh/src/3rdparty/org/json/JSONString.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 | /**
3 | * The JSONString
interface allows a toJSONString()
4 | * method so that a class can change the behavior of
5 | * JSONObject.toString()
, JSONArray.toString()
,
6 | * and JSONWriter.value(
Object)
. The
7 | * toJSONString
method will be used instead of the default behavior
8 | * of using the Object's toString()
method and quoting the result.
9 | */
10 | public interface JSONString {
11 | /**
12 | * The toJSONString
method allows a class to produce its own JSON
13 | * serialization.
14 | *
15 | * @return A strictly syntactically correct JSON text.
16 | */
17 | public String toJSONString();
18 | }
19 |
--------------------------------------------------------------------------------
/xmlsh/src/WEB-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Created-By: 1.6.0 (Sun Microsystems Inc.)
3 | Main-Class: org.xmlsh.sh.shell.Shell
4 |
--------------------------------------------------------------------------------
/xmlsh/src/commands/org/xmlsh/commands/experimental/commands.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/xmlsh/src/commands/org/xmlsh/commands/experimental/tagsoup.xsh:
--------------------------------------------------------------------------------
1 | # tagsoup quick implementation
2 | jcall org.ccil.cowan.tagsoup.CommandLine $@
--------------------------------------------------------------------------------
/xmlsh/src/commands/org/xmlsh/commands/internal/jsoncat.xsh:
--------------------------------------------------------------------------------
1 | # jcat [ files ]
2 | # concatenate json files into an array
3 | import commands posix
4 |
5 | echo "["
6 | sep=""
7 | if [ $# -gt 0 ] ; then
8 | for file ; do
9 | echo $sep
10 | cat $file
11 | sep=","
12 | done
13 | else
14 | cat
15 | fi
16 |
17 | echo "]"
18 |
--------------------------------------------------------------------------------
/xmlsh/src/commands/org/xmlsh/commands/internal/schematron.xsh:
--------------------------------------------------------------------------------
1 | # Validate schematron
2 | # schematron schema file
3 | DSDL=$(xuri -r /org/xmlsh/resources/schematron/iso_dsdl_include.xsl)
4 | ABS=$(xuri -r /org/xmlsh/resources/schematron/iso_abstract_expand.xsl)
5 | SVRL=$(xuri -r /org/xmlsh/resources/schematron/iso_svrl_for_xslt2.xsl)
6 |
7 | set +omit-xml-declaration
8 | xslt -f $DSDL -i $1 |
9 | xslt -f $ABS |
10 | xslt -f $SVRL |
11 | xslt -f - -i $2
12 |
--------------------------------------------------------------------------------
/xmlsh/src/commands/org/xmlsh/commands/internal/time.xsh:
--------------------------------------------------------------------------------
1 | # time command ...
2 | _T1=<[current-time()]>
3 | eval "$@"
4 | echo <[ let $t := current-time() - $_T1
5 | return (
6 | hours-from-duration($t),'hours' ,
7 | minutes-from-duration($t),'minutes',
8 | seconds-from-duration($t),'seconds'
9 | )
10 | ]> 1>&2
11 |
--------------------------------------------------------------------------------
/xmlsh/src/commands/org/xmlsh/commands/internal/xaddattribute.xsh:
--------------------------------------------------------------------------------
1 | # xaddattribute
2 | # Usage:
3 | # xaddattribute matches attr-name value
4 |
5 | xed -matches "$1" -a <[ attribute { $_2 } { $_3 } ]>
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/xmlsh/src/commands/org/xmlsh/commands/internal/xdelete.xsh:
--------------------------------------------------------------------------------
1 | # deletes an attribute element or node
2 | xed -d "$@"
--------------------------------------------------------------------------------
/xmlsh/src/commands/org/xmlsh/commands/posix/pwd.xsh:
--------------------------------------------------------------------------------
1 | echo $PWD
--------------------------------------------------------------------------------
/xmlsh/src/core/org/xmlsh/core/InvalidArgumentException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * $Id$
3 | * $Date$
4 | *
5 | */
6 |
7 | package org.xmlsh.core;
8 |
9 | public class InvalidArgumentException extends CoreException {
10 |
11 | /**
12 | *
13 | */
14 | private static final long serialVersionUID = 4670201075104636642L;
15 |
16 | public InvalidArgumentException() {
17 | // TODO Auto-generated constructor stub
18 | }
19 |
20 | public InvalidArgumentException(String message) {
21 | super(message);
22 |
23 | // TODO Auto-generated constructor stub
24 | }
25 |
26 | public InvalidArgumentException(Throwable cause) {
27 | super(cause);
28 | // TODO Auto-generated constructor stub
29 | }
30 |
31 | public InvalidArgumentException(String message, Throwable cause) {
32 | super(message, cause);
33 | // TODO Auto-generated constructor stub
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/xmlsh/src/core/org/xmlsh/core/NamedPort.java:
--------------------------------------------------------------------------------
1 | package org.xmlsh.core;
2 |
3 |
4 |
5 | public class NamedPort {
6 | String mName; // Name
7 | P mPort; // port
8 |
9 | public NamedPort( String name , P port )
10 | {
11 | mName = name ;
12 |
13 | mPort = port ;
14 | }
15 |
16 | public NamedPort( NamedPort
that ){
17 | mName = that.mName ;
18 | mPort = that.mPort;
19 | if( mPort != null )
20 | mPort.addRef();
21 | }
22 | public String getName() {
23 | return mName ;
24 | }
25 | public P getPort(){
26 | return mPort ;
27 | }
28 | }
--------------------------------------------------------------------------------
/xmlsh/src/core/org/xmlsh/core/UnknownOption.java:
--------------------------------------------------------------------------------
1 | /**
2 | * $Id$
3 | * $Date$
4 | *
5 | */
6 |
7 | package org.xmlsh.core;
8 |
9 | @SuppressWarnings("serial")
10 | public class UnknownOption extends Exception {
11 |
12 | public UnknownOption() {
13 | // TODO Auto-generated constructor stub
14 | }
15 |
16 | public UnknownOption(String message) {
17 | super(message);
18 | // TODO Auto-generated constructor stub
19 | }
20 |
21 | public UnknownOption(Throwable cause) {
22 | super(cause);
23 | // TODO Auto-generated constructor stub
24 | }
25 |
26 | public UnknownOption(String message, Throwable cause) {
27 | super(message, cause);
28 | // TODO Auto-generated constructor stub
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/xmlsh/src/core/org/xmlsh/core/XDynamicVariable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * $Id$
3 | * $Date$
4 | *
5 | */
6 |
7 | package org.xmlsh.core;
8 |
9 | import java.util.EnumSet;
10 |
11 | public abstract class XDynamicVariable extends XVariable {
12 |
13 | public XDynamicVariable(String name, EnumSet flags) {
14 | super(name, flags);
15 | // TODO Auto-generated constructor stub
16 | }
17 |
18 | /* (non-Javadoc)
19 | * @see org.xmlsh.core.XVariable#getValue()
20 | */
21 | @Override
22 | public abstract XValue getValue();
23 |
24 | /* (non-Javadoc)
25 | * @see org.xmlsh.core.XVariable#setValue(org.xmlsh.core.XValue)
26 | */
27 | @Override
28 | public void setValue(XValue value) throws InvalidArgumentException {
29 | throw new InvalidArgumentException("Cannot set value of variable: " + getName() );
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/xmlsh/src/generated/org/xmlsh/sh/grammar/.gitignore:
--------------------------------------------------------------------------------
1 | /ParseException.java
2 | /ShellParser.java
3 | /ShellParserConstants.java
4 | /ShellParserTokenManager.java
5 | /SimpleCharStream.java
6 | /Token.java
7 | /TokenMgrError.java
8 |
--------------------------------------------------------------------------------
/xmlsh/src/shell/org/xmlsh/sh/shell/.gitignore:
--------------------------------------------------------------------------------
1 | *.properties
2 |
--------------------------------------------------------------------------------
/xmlsh/src/shell/org/xmlsh/sh/shell/ShellURIResolver.java:
--------------------------------------------------------------------------------
1 | /**
2 | * $Id$
3 | * $Date$
4 | *
5 | */
6 |
7 | package org.xmlsh.sh.shell;
8 |
9 | import javax.xml.transform.Source;
10 | import javax.xml.transform.TransformerException;
11 | import javax.xml.transform.URIResolver;
12 |
13 | public class ShellURIResolver implements URIResolver {
14 |
15 | private URIResolver mDelegate;
16 | /* (non-Javadoc)
17 | * @see javax.xml.transform.URIResolver#resolve(java.lang.String, java.lang.String)
18 | */
19 | public Source resolve(String href, String base) throws TransformerException {
20 | // TODO Auto-generated method stub
21 | return mDelegate.resolve(href, base);
22 | }
23 |
24 | public ShellURIResolver(URIResolver delegate) {
25 | mDelegate = delegate;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/xmlsh/test/ant/test.xsh:
--------------------------------------------------------------------------------
1 | echo Testing $*
2 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_colon.xsh:
--------------------------------------------------------------------------------
1 | # Test the null command ":"
2 | :
3 | : and some args
4 |
5 | # Colon in if
6 | if true ; then : ; else echo failed ; fi
7 |
8 | # colon in brace
9 | { : ; }
10 |
11 | # colon in subshell
12 | ( : do nothing )
13 | echo success
14 | exit 0
15 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_echo.xsh:
--------------------------------------------------------------------------------
1 | # Tests of builtin echo
2 | #
3 | # echo a blank line
4 | echo
5 | # echo a string
6 | echo "hi there"
7 | # echo an XML expression
8 | echo <[bar ]>
9 | # echo an xml sequence seperated by space
10 | echo <[1,"hi", ]>
11 | # echo with variable expansion
12 | A=var1
13 | B=var2
14 |
15 | # echo with null middle variable
16 | echo $A$C$B
17 | # echo quoted
18 | echo "$A$C$B"
19 | #
20 | # echo single quoted
21 | echo '$A$C$B'
22 |
23 | # Echo -n
24 | echo -n foo ; echo bar
25 |
26 | # Echo to a named port
27 | echo -p output to output
28 | echo -p xxx to xxx (xxx)>&(output)
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_eval.xsh:
--------------------------------------------------------------------------------
1 | # Test of eval
2 |
3 | # Set a variable
4 | eval '_A=b'
5 | echo _A is $_A
6 |
7 | eval 'unset _A'
8 | echo _A is now unset : $_A
9 |
10 | # Echo evaled
11 | _A=B eval 'echo _A is $_A'
12 | unset _A
13 |
14 | echo Empty Eval
15 | eval ''
16 | eval '#'
17 | eval ' '
18 | echo Empty Done
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_jset.xsh:
--------------------------------------------------------------------------------
1 | jset -v int -c java.lang.Integer 12345
2 | xtype $int
3 | echo $int
4 | jset -v hex -c java.lang.Integer -m toHexString $int
5 | xtype $hex
6 | echo $hex
7 | jset -v min -c java.lang.Integer -f MIN_VALUE
8 | echo $min
9 | jset -v s -c java.lang.String "Hello World"
10 | echo $s
11 | jset -v upper -o $s -m toUpperCase
12 | echo $upper
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_jsonread.xsh:
--------------------------------------------------------------------------------
1 | # builtin jsonread command
2 | # reads input into a single json variable
3 |
4 | # read from a hear document
5 | jsonread a <]>
19 | # check that variable gets put into environment and output with 0-arg set
20 |
21 | echo environment is
22 | set | xpath '//variable[@name="A"]'
23 | set | xpath '//variable[@name="B"]'
24 |
25 | # Test set --
26 | set -- arg1
27 | [ $# -eq 1 ] || { echo Failed ; exit 1 ; }
28 |
29 | set --
30 | [ $# -eq 0 ] || { echo Failed ; exit 1 ; }
31 |
32 | exit 0
33 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_shift.xsh:
--------------------------------------------------------------------------------
1 | # Test of shift operator
2 |
3 | echo Initial args list is $# $*
4 | set arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg8 arg10 arg11 arg12 arg13
5 | while [ $# -gt 0 ] ; do
6 | echo $1
7 | shift
8 | done
9 |
10 | # Test shift of empty list
11 | shift
12 | echo final args list is $# $*
13 |
14 | # Test shift of variable
15 | a=(foo bar 1 2 3 4 5)
16 | shift a 2
17 | [ ${#a} -eq 5 ] || echo Shift Failed
18 |
19 | exit 0
20 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_source.xsh:
--------------------------------------------------------------------------------
1 | # Test of source (.) command
2 |
3 | if [ -z "$_SOURCE" ] ; then
4 | echo top level invocation of $(xfile -b $0)
5 | _SOURCE=source
6 | . $0
7 | echo _VAR is $_VAR
8 | unset _SOURCE
9 | unset _VAR
10 |
11 | # Try using source command instead of .
12 | _SOURCE=source
13 | source $0
14 | echo _VAR is $_VAR
15 | unset _SOURCE
16 | unset _VAR
17 | else
18 | echo sourced invocation of $(xfile -b $0)
19 | echo _SOURCE is $_SOURCE
20 | _VAR=var
21 | fi
22 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_xecho.xsh:
--------------------------------------------------------------------------------
1 | # Tests of builtin xecho
2 | # xecho differs from echo in that it outputs XML expressions
3 | #
4 | # echo a blank line
5 | xecho
6 | # echo a string
7 | xecho "hi there"
8 | # echo an XML expression
9 | xecho <[bar ]>
10 | # echo an xml sequence seperated by newlines (differe then echo)
11 | xecho <[1,"hi", ]>
12 | # echo into a sequence
13 | xecho <[ ,1,"bar" ]> >{_seq}
14 | xecho <[ 3,"bletch" ]> >>{_seq}
15 | # should be 5
16 | echo There are <[ count($_seq) ]> elements in the sequence
17 | echo -n No Newlines:
18 | xecho -n <[ 'in this text' ]>
19 | echo :Between the colons
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_xmkpipe.xsh:
--------------------------------------------------------------------------------
1 | # Test of mkpipe
2 |
3 | # Test stream pipes
4 |
5 | xmkpipe s
6 |
7 | { while read a ; do echo $a ; xtype $a ; done <(s) ; echo Done ; } &
8 |
9 | for i in <[ 1 to 100 ]> ; do
10 | echo <[ {$i} ]>
11 | done >(s)
12 | xmkpipe -close s
13 | wait
14 | echo Text Complete
15 |
16 |
17 | xmkpipe -xml x
18 |
19 | { while xread a ; do xecho $a ; xtype $a ; done <(x) ; echo Done ; } &
20 |
21 | for i in <[ 1 to 100 ]> ; do
22 | xecho <[ {$i} ]>
23 | done >(x)
24 | xmkpipe -close x
25 | wait
26 | echo XML Complete
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_xmlsh.xsh:
--------------------------------------------------------------------------------
1 | # simple tests of xmlsh builtin command
2 | # cannot test interactive subshells in a script
3 |
4 | # if called with 1 arg then calling self
5 | if [ $# -gt 0 ] ; then
6 | echo Called into self
7 | echo \$0 is $(xfile -b $0)
8 | echo \$* is $*
9 | exit 0;
10 | fi
11 |
12 | xmlsh -norc $0 Arg1 Arg2
13 |
14 |
15 | echo In parent shell
16 | xmlsh -norc -c 'echo In sub shell ; exit 1'
17 | echo Exit value is $?
18 | exit 0
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_xread.xsh:
--------------------------------------------------------------------------------
1 | # builtin xread command
2 | # reads input into a single xml variable
3 | # input is expected in XML format (not xquery format, no sequences)
4 |
5 | # read from a hear document
6 | xread a <data
8 | EOF
9 |
10 | echo a is $a
11 | # test type with xquery on set
12 | echo type of a is $(set | xquery '//variable[@name="a"]/@type/string()')
13 |
14 |
15 | # read from a file
16 | cd ../../samples/data
17 |
18 | xread b < books.xml
19 | # Test type by test -X
20 | [ -X $b ] && echo document is XML type
21 | exit 0
22 |
23 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_xtype.xsh:
--------------------------------------------------------------------------------
1 | # Test of the xtype command
2 |
3 | xtype 1 <[ 2 ]> <[ 2.5 ]> "foo" <[ ]>
4 | xtype <[ document{ } ]>
5 | a=string
6 | b=(a list of strings)
7 | xtype $a {$b}
8 | xtype "" {<[ () ]>}
9 |
10 | # Check that types of assigned variables keep their types
11 | a=<[ xs:integer(1) ]>
12 | b=$<(xquery -n -q '2.5')
13 | xtype $a $b
14 |
15 |
16 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/builtin_xwhich.xsh:
--------------------------------------------------------------------------------
1 | # Test of xwhich
2 |
3 | foo()
4 | { echo bar ; }
5 |
6 | # test of builtin
7 | xwhich echo
8 |
9 | # test of internal
10 | xwhich xfile
11 |
12 | # test of function
13 | xwhich foo
14 |
15 | # test of script
16 | F=$<(xwhich builtin_xwhich.xsh)
17 | echo xwhich is <[$F/xwhich/command/@name/string()]>
18 |
19 | # test of external
20 | # PATH MAY VARY - only output name
21 | F=$<(xwhich rm)
22 | echo rm is <[$F/xwhich/command/@name/string()]>
23 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_colon.xsh.out:
--------------------------------------------------------------------------------
1 | success
2 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_echo.xsh.out:
--------------------------------------------------------------------------------
1 |
2 | hi there
3 | bar
4 | 1 hi
5 | var1var2
6 | var1var2
7 | $A$C$B
8 | foobar
9 | to output
10 | to xxx
11 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_eval.xsh.out:
--------------------------------------------------------------------------------
1 | _A is b
2 | _A is now unset :
3 | _A is B
4 | Empty Eval
5 | Empty Done
6 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_exit.xsh.out:
--------------------------------------------------------------------------------
1 | Exit test 1
2 | return value 1
3 | Exit test 2
4 | return value 0
5 | Exit test 3
6 | return value 0
7 | Exit test 4
8 | return value 0
9 | Exit test 5
10 | return value 0
11 | Exit test 6
12 | return value 0
13 | Exit test 100
14 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_jset.xsh.out:
--------------------------------------------------------------------------------
1 | java.lang.Integer
2 | 12345
3 | java.lang.String
4 | 3039
5 | -2147483648
6 | Hello World
7 | HELLO WORLD
8 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_jsonread.xsh.out:
--------------------------------------------------------------------------------
1 | {"A":1,"B":[1,true,null,"hi"]}
2 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_log.xsh.out:
--------------------------------------------------------------------------------
1 | success
2 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_read.xsh.out:
--------------------------------------------------------------------------------
1 | a is foo
2 | a b c is foo bar spam
3 | echo a b c is foo bar
4 | author is AUTHOR
5 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_require.xsh.err:
--------------------------------------------------------------------------------
1 | requires version: 99999
2 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_require.xsh.out:
--------------------------------------------------------------------------------
1 | entering require
2 | Require succeeded with no args
3 | Require 1.0.1 succeeded
4 | Require 9.0.2 failed correctly
5 | entering require test
6 | Correctly failed require 99999
7 | Correctly caught failed require in sub
8 | requires version: 99999
9 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_set.xsh.out:
--------------------------------------------------------------------------------
1 | environment is
2 |
3 |
4 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_shift.xsh.out:
--------------------------------------------------------------------------------
1 | Initial args list is 0
2 | arg1
3 | arg2
4 | arg3
5 | arg4
6 | arg5
7 | arg6
8 | arg7
9 | arg8
10 | arg8
11 | arg10
12 | arg11
13 | arg12
14 | arg13
15 | final args list is 0
16 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_source.xsh.out:
--------------------------------------------------------------------------------
1 | top level invocation of builtin_source
2 | sourced invocation of builtin_source
3 | _SOURCE is source
4 | _VAR is var
5 | sourced invocation of builtin_source
6 | _SOURCE is source
7 | _VAR is var
8 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_test.xsh.err:
--------------------------------------------------------------------------------
1 | [:unexpected arg: )
2 | [:Expected operator
3 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_test.xsh.out:
--------------------------------------------------------------------------------
1 | Success nonzero
2 | Success nonzero
3 | Success -z
4 | Success =
5 | Success !=
6 | Success -eq
7 | Success -eq
8 | Success -ge
9 | Success -ge
10 | Success -gt
11 | Success -gt
12 | Success -le
13 | Success -le
14 | Success -lt
15 | Success -lt
16 | Success -ne
17 | Success -ne
18 | Success -ef
19 | success -ef
20 | Success -d
21 | Success -e
22 | Success -s
23 | Success -w
24 | Success empty ()
25 | Success ()
26 | Success simple -o
27 | success -o
28 | success -a
29 | Success compound
30 | success xexpr true
31 | success sequence
32 | success -z xexpr false
33 | success -z xexpr 0
34 | succeed xexpr or
35 | success xexpr string
36 | success xexpr var sequence
37 | Success
38 | Success
39 | success
40 | Success
41 | Success
42 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_xecho.xsh.out:
--------------------------------------------------------------------------------
1 |
2 | hi there
3 | bar
4 | 1
5 | hi
6 |
7 | There are 5 elements in the sequence
8 | No Newlines:in this text:Between the colons
9 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_xmlsh.xsh.out:
--------------------------------------------------------------------------------
1 | Called into self
2 | $0 is builtin_xmlsh
3 | $* is Arg1 Arg2
4 | In parent shell
5 | In sub shell
6 | Exit value is 1
7 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_xread.xsh.out:
--------------------------------------------------------------------------------
1 | a is data
2 | type of a is xml
3 | document is XML type
4 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_xtype.xsh.out:
--------------------------------------------------------------------------------
1 | xs:string
2 | xs:integer
3 | xs:decimal
4 | xs:string
5 | element()
6 | document-node()
7 | xs:string
8 | xs:string+
9 | xs:string
10 | empty-sequence()
11 | xs:integer
12 | xs:decimal
13 |
--------------------------------------------------------------------------------
/xmlsh/test/builtin/out/builtin_xwhich.xsh.out:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | xwhich is builtin_xwhich.xsh
11 | rm is rm
12 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_andor.xsh:
--------------------------------------------------------------------------------
1 | # core_andor
2 | # Tests of && and ||
3 |
4 | true && echo true
5 | false && echo false
6 | true || false && echo true
7 | false || false && echo false
8 |
9 | if true && false ; then
10 | echo false
11 | exit 1
12 | fi
13 |
14 | exit 0;
15 |
16 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_array.xsh:
--------------------------------------------------------------------------------
1 | # core_array.xsh
2 | # test array notation
3 |
4 | a=()
5 | echo ${#a}
6 | a=(foo)
7 | echo ${#a}
8 | a=(foo bar spam)
9 | echo ${#a}
10 | echo ${a[2]}
11 | echo ${a[*]}
12 |
13 | a=<[ ('foo' , text , 1) ]>
14 | set +indent
15 | xecho ${a[2]}
16 |
17 | # Test array notation on positional params
18 | set foo {<[ 1,2,3 ]>} {$a}
19 |
20 | echo ${1[1]}
21 | echo ${2[2]}
22 | xecho ${3[2]}
23 |
24 |
25 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_brace2.xsh:
--------------------------------------------------------------------------------
1 | # core_brace2.xsh
2 | # Testing more complicated brace syntax
3 |
4 | # Test case - was failing on 9/17/2007]
5 | #
6 | for a in a b c ; do
7 | echo In for
8 | {
9 | echo Value is $a
10 | }
11 | done
--------------------------------------------------------------------------------
/xmlsh/test/core/core_case2.xsh:
--------------------------------------------------------------------------------
1 | # core_case2.xsh
2 | # Test of case
3 |
4 | for i in update insert delete ; do
5 | echo $i
6 | case $i in
7 | update|insert) echo update/insert ;;
8 | delete) echo delete ;;
9 | esac
10 | done
11 |
12 | # Test quoted strings
13 |
14 | case "foo bar" in
15 | "foo" | bar ) echo FAIL SNH ;;
16 | "foo bar spam" ) echo FAIL SNH ;;
17 | "foo bar" ) echo Success ;;
18 | *) echo FAIL SNH ;;
19 | esac
20 |
21 | # Test expanded vars
22 | a="foo"
23 | b="bar"
24 |
25 | case "foo bar" in
26 | "foo" | bar ) echo FAIL SNH ;;
27 | "foo bar spam" ) echo FAIL SNH ;;
28 | "$a $b" | "spam" ) echo Success ;;
29 | *) echo FAIL SNH ;;
30 | esac
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_case3.xsh:
--------------------------------------------------------------------------------
1 | # core_case3.xsh
2 | # multiline cases
3 |
4 | case foo in
5 | bar)
6 | echo SNH
7 | ;;
8 | foo)
9 | case "a()" in
10 | "b()" )
11 | echo FAIL
12 | ;;
13 | "a()" )
14 | echo SUCCESS
15 | ;;
16 | *)
17 | echo FAIL
18 | ;;
19 | esac
20 | ;;
21 | esac
22 |
23 | # simple variable setting cases
24 |
25 | case A in
26 | X) echo Failed should be A ;;
27 | A) _A=B ;;
28 | esac
29 |
30 | [ "$_A" = "B" ] || echo Failed variable not set
31 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_exfunctions.xsh:
--------------------------------------------------------------------------------
1 | # Test of xmlsh xpath/ex functions
2 | #
3 | # Note this is an experimental feature
4 | #
5 |
6 | # NO need to predeclare for builtin
7 | xecho <[ xmlsh:eval("xecho $*" , ("foo" , , 1 ) ) ]>
8 |
9 | # Need to declare for running xquery
10 | declare namespace xmlsh=http://www.xmlsh.org/extfuncs
11 |
12 | xquery -n 'xmlsh:eval("echo -n No Args")'
13 | var=<[ xmlsh:eval("xecho <[ bar ]> ") ]>
14 | xecho $var
15 | xread a < ../../samples/data/books.xml
16 | xecho <[ $a//BOOKS[1]/ITEM[1]/xmlsh:eval("xcat")//ISBN ]>
17 | xecho <[ xmlsh:eval("xcat",(),$a//BOOKS[1]/ITEM[1])//ISBN ]>
18 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_expandsub.xsh:
--------------------------------------------------------------------------------
1 | # core_expandsub.xsh
2 | # test expanding of subprocess aka $()
3 |
4 |
5 | a=$(echo foo)
6 | echo Should be foo: $a
7 |
8 | a=$(echo a; echo b ; echo c;)
9 | echo Should be 3 : ${#a}
10 |
11 | b=$(echo a1 ; echo b1 ; echo c1 ; )
12 | for c in $b ; do
13 | echo Arg $c
14 | done
15 |
16 | # Test return values in $()
17 | A=$(true) || echo FAIL true should be success
18 | A=$(false) || echo Success expected false
19 | A=$(true;false)
20 | echo retval is $?
21 | unset A
22 |
23 | # Test backticks
24 | A=`echo foo1`
25 | [ "$A" = "foo1" ] || echo FAIL should be foo1
26 |
27 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_for2.xsh:
--------------------------------------------------------------------------------
1 | # tricky lexical case from http://www.aosabook.org/en/bash.html
2 | #
3 | for for in for; do
4 | for=for;
5 | done
6 |
7 | echo $for
8 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_for3.xsh:
--------------------------------------------------------------------------------
1 | function restart ()
2 | {
3 | echo list
4 | for group ; do
5 | for x in a b c ; do
6 | echo $group $x
7 | done
8 | done
9 | }
10 |
11 | restart 1 2 3
--------------------------------------------------------------------------------
/xmlsh/test/core/core_function2.xsh:
--------------------------------------------------------------------------------
1 | # Test of function declarations
2 |
3 |
4 | args ()
5 | {
6 | echo args are $*
7 | }
8 |
9 | setvar ()
10 | {
11 | _A=$1
12 | }
13 |
14 | subpipe()
15 | {
16 | echo <[bar ]> | xcat
17 | }
18 |
19 |
20 | echo Test of Args
21 | args arg1 arg2 arg3
22 |
23 | echo Test of setvar
24 | setvar ABC
25 | echo _A is $_A
26 |
27 | echo Test of subpipe
28 |
29 | subpipe | xcat
30 |
31 | # Functions returning values
32 |
33 | ret0()
34 | {
35 | echo in ret 0 ;
36 | return 0;
37 | echo SNH
38 | }
39 |
40 | ret0 && echo Success of ret0
41 | ret0 || echo Fail of ret0
42 |
43 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_function3.xsh:
--------------------------------------------------------------------------------
1 | # Test of functions using function call syntax
2 |
3 | function f1() {
4 | return $@
5 | }
6 |
7 | xtype f1( a 1 <[2,3,4]> )
8 | echo next
9 | xtype {f1( {<[2,3,4]>} )}
10 |
11 | # Assignment
12 | a=f1()
13 | echo empty $a
14 | a=f1(hello world)
15 | echo $a
16 |
17 | # Recursion
18 |
19 | function add()
20 | {
21 | return <[ $_1 + $_2 ]>
22 | }
23 |
24 | function mult()
25 | {
26 | return <[ $_1 * $_2 ]>
27 | }
28 |
29 | echo mult( add( <[1,3]> ) mult( <[ 4,5]> ) )
30 |
31 | # Test for function containing -
32 |
33 | function a-b()
34 | {
35 | echo function a-b
36 | }
37 |
38 | function -()
39 | {
40 | echo function -
41 | }
42 |
43 | a-b
44 | -
45 |
46 |
47 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_here.xsh:
--------------------------------------------------------------------------------
1 | # core_here.xsh
2 | # HERE documents
3 |
4 | echo Tabbed
5 | xcat <
7 | bar
8 |
9 | EOF
10 |
11 | echo Untabbed
12 | # Tab stripping
13 | xcat <<-EOF
14 |
15 | bar
16 |
17 | EOF
18 |
19 | exit 0
--------------------------------------------------------------------------------
/xmlsh/test/core/core_here2.xsh:
--------------------------------------------------------------------------------
1 | # core_here.xsh
2 | # Test EOF case where there is no trailing nl
3 | import commands posix
4 |
5 | cat <text ]>
9 | a+=<[ text , "text" ]>
10 | xecho $a
11 |
12 |
13 | # Test sequence appending is scoped
14 | a=<[1 to 10]>
15 | (
16 | a+=<[11 to 20]>
17 | echo $a
18 | )
19 | echo $a
20 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_serialize.xsh:
--------------------------------------------------------------------------------
1 | # Test global and local serialization options
2 | a=<[ bar ,1,"hi" ]>
3 |
4 | # Default seperator is newline
5 | xecho $a
6 |
7 | # use ","
8 | xecho -sequence-sep , $a
9 |
10 | xecho -sequence-sep : -sequence-term '
11 | EOF
12 | ' $a
--------------------------------------------------------------------------------
/xmlsh/test/core/core_subshell2.xsh:
--------------------------------------------------------------------------------
1 | # Test of subshell expressions with here docs
2 | # discovered as part of xproc implementation
3 |
4 | (
5 | true
6 | if true
7 | then
8 | xcat <
10 | EOF
11 |
12 | else
13 | echo false
14 | fi
15 | )
16 |
17 | {
18 | true
19 | if true
20 | then
21 | xcat <
23 | EOF
24 | else
25 | echo false
26 | fi
27 | }
28 |
29 |
30 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_throwerror2.xsh:
--------------------------------------------------------------------------------
1 | # throw on error
2 | # Test -e across scripts
3 |
4 |
5 | if [ $# -gt 0 ] ; then
6 | echo in script arg count $#
7 | if [ $# -gt 1 ] ; then
8 | shift
9 | $0 "$@"
10 | exit 0;
11 | fi
12 | [ $1 = "ignore" ] || echo Next command should fail
13 | false
14 |
15 | [ $1 = "ignore" ] && exit 0
16 | echo Fail SNH - after throw
17 |
18 | fi
19 |
20 | set -e
21 | try {
22 |
23 | $0 foo bar spam test
24 | } catch E {
25 | echo Success caught $E
26 | }
27 |
28 | # Test if calling script with condition doesnt throw
29 | try {
30 |
31 | ! $0 ignore
32 | echo Success
33 | } catch E {
34 | echo Fail - should not have caught error
35 | }
--------------------------------------------------------------------------------
/xmlsh/test/core/core_tie.xsh:
--------------------------------------------------------------------------------
1 | # Test of tie
2 | # simple use of properties
3 |
4 | A=$<( xproperties -a foo="foo value" -a bar="bar value" -a a.b="a.b value")
5 | tie A './/entry[@key = $_ ]/string()'
6 |
7 | echo ${A:foo}
8 | echo ${A:bar}
9 | echo ${A:a.b}
10 |
11 | # Make sure tie survives after assignment
12 | A=$<( xproperties -a a="a value")
13 | echo ${A:a}
14 |
15 | # Book example
16 |
17 | xread BOOKS < ../../samples/data/books.xml
18 | tie BOOKS './/CATEGORIES[@DESC eq $_]'
19 |
20 | xecho ${BOOKS:Miscellaneous categories}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_try2.xsh:
--------------------------------------------------------------------------------
1 | # try/catch/finally test 2
2 | # Test throw within a script
3 |
4 | if [ $# -gt 0 ] ; then
5 | echo in script arg count $#
6 | if [ $# -gt 1 ] ; then
7 | shift
8 | $0 "$@"
9 | exit 0;
10 | fi
11 | echo throwing $1
12 | throw $1
13 | echo Fail SNH - after throw
14 | fi
15 |
16 | try {
17 | $0 foo bar spam test
18 | } catch E {
19 | echo Success caught $E
20 | } finally {
21 | echo Success in finally
22 | }
23 |
24 |
25 | func_throws ()
26 | {
27 | echo in fun_throws
28 | throw $1
29 | echo Fail - SNH after throw
30 | }
31 |
32 |
33 | try {
34 | echo calling throw function
35 | func_throws <[ ]>
36 | echo Fail - SNH after throw
37 | } catch X
38 | {
39 | echo Success caught $X
40 | }
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_try3.xsh:
--------------------------------------------------------------------------------
1 | # try/catch/finally test 2
2 | # Test try in a while
3 |
4 | while true ; do
5 | echo in while
6 | try {
7 | throw "Thrown"
8 | }
9 | catch E { # Test { on same line of catch as 2nd statement in a compound group
10 | echo Caught $E
11 | }
12 | break ;
13 | done
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_unicode.xsh:
--------------------------------------------------------------------------------
1 | # unicode literals
2 | echo 日本国
--------------------------------------------------------------------------------
/xmlsh/test/core/core_vars2.xsh:
--------------------------------------------------------------------------------
1 | # core_vars.xsh
2 | # test variables
3 |
4 | if [ -z "$TMPDIR" -o ! -d "$TMPDIR" ] ; then
5 | echo Temp directory required TMPDIR: $TMPDIR
6 | exit 1;
7 | fi
8 |
9 |
10 |
11 |
12 |
13 | # turn off indentation for this test
14 | set +indent
15 |
16 |
17 | # clear just in case they were exported
18 | unset A AA
19 | unset I
20 |
21 | # Test expended [] notation
22 | A=(a b c)
23 | I=2
24 |
25 | echo "A[2] is" ${A[$I]}
26 |
27 | # Test empty variables expand to nothing
28 | A=
29 | B=test
30 | C=
31 |
32 | echo $A $B $C
33 | set $A $B $C
34 | echo $#
35 |
36 | # Test we cannot set to the empty variable name using >{}
37 | echo SNH >{""}
38 | blank=""
39 | echo SNH >{$blank}
40 | exit 0
41 |
--------------------------------------------------------------------------------
/xmlsh/test/core/core_xpipe.xsh:
--------------------------------------------------------------------------------
1 | # Test of xpipes
2 |
3 | # first test string pipes
4 |
5 | xecho <[ 1,"hello", ,document { } , attribute attr {"b"} ]> |
6 | while read a ; do xtype $a ; done
7 |
8 | # Now with xpipes
9 | set -xpipe
10 | xecho <[ 1,"hello", ,document { } , attribute attr {"b"} ]> |
11 | while xread a ; do xtype $a ; done
12 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_andor.xsh.out:
--------------------------------------------------------------------------------
1 | true
2 | true
3 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_args.xsh.out:
--------------------------------------------------------------------------------
1 | success
2 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_array.xsh.out:
--------------------------------------------------------------------------------
1 | 0
2 | 1
3 | 3
4 | bar
5 | foo bar spam
6 | text
7 | foo
8 | 2
9 | text
10 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_brace.xsh.out:
--------------------------------------------------------------------------------
1 | true
2 | line1
3 | line2
4 |
5 |
6 |
7 | test
8 | A is 2
9 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_brace2.xsh.out:
--------------------------------------------------------------------------------
1 | In for
2 | Value is a
3 | In for
4 | Value is b
5 | In for
6 | Value is c
7 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_case.xsh.out:
--------------------------------------------------------------------------------
1 | test1
2 | success
3 | test2
4 | success
5 | test3
6 | success
7 | test4
8 | data is data
9 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_case2.xsh.out:
--------------------------------------------------------------------------------
1 | update
2 | update/insert
3 | insert
4 | update/insert
5 | delete
6 | delete
7 | Success
8 | Success
9 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_case3.xsh.out:
--------------------------------------------------------------------------------
1 | SUCCESS
2 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_exfunctions.xsh.out:
--------------------------------------------------------------------------------
1 | foo
2 |
3 | 1
4 | No Args
5 | bar
6 | 0679601686
7 | 0679601686
8 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_expandsub.xsh.out:
--------------------------------------------------------------------------------
1 | Should be foo: foo
2 | Should be 3 : 3
3 | Arg a1
4 | Arg b1
5 | Arg c1
6 | Success expected false
7 | retval is 1
8 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_for.xsh.out:
--------------------------------------------------------------------------------
1 | a
2 | b
3 | c
4 | a
5 | b
6 | c
7 | After for a is c
8 | xa
9 | xb
10 | xc
11 | ac ad ae
12 | bc bd be
13 | cc cd ce
14 | 1 level break
15 | a is a
16 | 1 level continue
17 | a is a
18 | a is c
19 | 2 level for with break 1
20 | ac ad
21 | bc bd
22 | cc cd
23 | 2 level for with break 2
24 | ac ad
25 | 2 level for with continue 1
26 | ac ad ae
27 | bc bd be
28 | cc cd ce
29 | 2 level for with continue 2
30 | ac ad bc bd cc cd
31 | Output is
32 | line1
33 | line2
34 | line3
35 | arg a1
36 | arg b1
37 | arg c1
38 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_for2.xsh.out:
--------------------------------------------------------------------------------
1 | for
2 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_for3.xsh.out:
--------------------------------------------------------------------------------
1 | list
2 | 1 a
3 | 1 b
4 | 1 c
5 | 2 a
6 | 2 b
7 | 2 c
8 | 3 a
9 | 3 b
10 | 3 c
11 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_function.xsh.out:
--------------------------------------------------------------------------------
1 | foo: args are arg1 arg2 arg3
2 | after foo _A is foo
3 | bar: args are arg1 arg2
4 | after bar _A is
5 | in spam
6 | bar: args are arg1 arg2
7 | foo: args are arg1 arg2
8 | _A is
9 | before f1 f2
10 | enter f1 _A is f2
11 | after f1 f2
12 | _A is
13 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_function2.xsh.out:
--------------------------------------------------------------------------------
1 | Test of Args
2 | args are arg1 arg2 arg3
3 | Test of setvar
4 | _A is ABC
5 | Test of subpipe
6 | bar
7 | in ret 0
8 | Success of ret0
9 | in ret 0
10 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_function3.xsh.out:
--------------------------------------------------------------------------------
1 | xs:string
2 | xs:string
3 | xs:integer
4 | xs:integer
5 | xs:integer
6 | next
7 | xs:integer+
8 | empty
9 | hello world
10 | 80
11 | function a-b
12 | function -
13 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_here.xsh.out:
--------------------------------------------------------------------------------
1 | Tabbed
2 |
3 | bar
4 |
5 | Untabbed
6 |
7 | bar
8 |
9 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_here2.xsh.out:
--------------------------------------------------------------------------------
1 | test
2 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_if.xsh.out:
--------------------------------------------------------------------------------
1 | Single statement
2 | Multi
3 | Statement
4 | line is line1
5 | line2 is line1
6 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_if2.xsh.out:
--------------------------------------------------------------------------------
1 | Success
2 | Success
3 | Success
4 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_iffor.xsh.out:
--------------------------------------------------------------------------------
1 | a
2 | b
3 | c
4 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_io.xsh.out:
--------------------------------------------------------------------------------
1 | foo
2 | foo
3 | foo
4 | foo
5 | foo
6 | foo
7 | foo
8 | foo
9 | line1
10 | line2
11 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_namespaces.xsh.out:
--------------------------------------------------------------------------------
1 | t1=http://www.example.org/test1
2 | t2=http://www.example.org/test2
3 | Test
4 | t1=http://www.example.org/test1
5 | Test
6 | Test
7 |
8 |
9 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_nest.xsh.out:
--------------------------------------------------------------------------------
1 | got a
2 | a
3 | b
4 | c
5 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_ports.xsh.out:
--------------------------------------------------------------------------------
1 | input4
2 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_random.xsh.out:
--------------------------------------------------------------------------------
1 | Success
2 | Success
3 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_seqass.xsh.out:
--------------------------------------------------------------------------------
1 | 1 2 3 4 5 6
2 | text
3 |
4 | text
5 |
6 | text
7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
8 | 1 2 3 4 5 6 7 8 9 10
9 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_serialize.xsh.out:
--------------------------------------------------------------------------------
1 | bar
2 | 1
3 | hi
4 | bar ,1,hi
5 | bar :1:hi
6 | EOF
7 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_subshell.xsh.out:
--------------------------------------------------------------------------------
1 | true
2 | line1
3 | line2
4 |
5 |
6 |
7 | Success of last command
8 | A B C
9 | A B C
10 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_subshell2.xsh.out:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_throwerror1.xsh.out:
--------------------------------------------------------------------------------
1 | Success - executed true
2 | Success caught error
3 | Success
4 | Success caught error
5 | Success caught error
6 | Success ignored error
7 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_throwerror2.xsh.out:
--------------------------------------------------------------------------------
1 | in script arg count 4
2 | in script arg count 3
3 | in script arg count 2
4 | in script arg count 1
5 | Next command should fail
6 | Success caught 1
7 | in script arg count 1
8 | Success
9 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_tie.xsh.out:
--------------------------------------------------------------------------------
1 | foo value
2 | bar value
3 | a.b value
4 | a value
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_try1.xsh.out:
--------------------------------------------------------------------------------
1 | Success
2 | Success
3 | Success No Finally
4 | Success No Finally
5 | Success No Finally
6 | Before throw
7 | Catch success: A string
8 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_try2.xsh.out:
--------------------------------------------------------------------------------
1 | in script arg count 4
2 | in script arg count 3
3 | in script arg count 2
4 | in script arg count 1
5 | throwing test
6 | Success caught test
7 | Success in finally
8 | calling throw function
9 | in fun_throws
10 | Success caught
11 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_try3.xsh.out:
--------------------------------------------------------------------------------
1 | in while
2 | Caught Thrown
3 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_unicode.xsh.out:
--------------------------------------------------------------------------------
1 | 日本国
2 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_vars.xsh:
--------------------------------------------------------------------------------
1 | NO variable
2 | NO variable
3 | NO variable
4 | NO variable
5 | foo variable
6 | bar variable
7 | bar variable
8 |
9 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_vars.xsh.out:
--------------------------------------------------------------------------------
1 | NO variable
2 | NO variable
3 | NO variable
4 | NO variable
5 | foo variable
6 | bar variable
7 | bar variable
8 |
9 | foo bar
10 | foo bar
11 | spam bletch
12 | text
13 | A is B
14 | $<
15 | $(cmd)
16 | xcc://foo:bar@home:8003/5MCC
17 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_vars2.xsh.err:
--------------------------------------------------------------------------------
1 | [/home/dlee/git.repo/xmlsh-1.3/xmlsh/test/core/core_vars2.xsh line: 37]
2 | Exception running: echo
3 | org.xmlsh.core.CoreException: Invalid blank name for output variable
4 | [/home/dlee/git.repo/xmlsh-1.3/xmlsh/test/core/core_vars2.xsh line: 39]
5 | Exception running: echo
6 | org.xmlsh.core.CoreException: Invalid blank name for output variable
7 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_vars2.xsh.out:
--------------------------------------------------------------------------------
1 | A[2] is b
2 | test
3 | 1
4 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_varseq.xsh.out:
--------------------------------------------------------------------------------
1 | empty string count 1 should be 1
2 | empty sequence count 0 should be 0
3 | appended a b count 2 should be 2
4 | mixed sequence count 5 should be 5
5 | bar foo should be bar foo
6 | bar foo should be bar foo
7 | * should be *
8 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_while.xsh.out:
--------------------------------------------------------------------------------
1 | before while
2 | while RET = 1
3 | while2 RET = 0
4 | Until 0
5 | X = 1 - should be 1
6 | RET = 0 - should be 0
7 | 2 level while
8 | 00 01 02
9 | 10 11 12
10 | 20 21 22
11 | 2 level while with break
12 | 00 01
13 | 10 11
14 | 20 21
15 | 2 level while with break 2
16 | 00 01
17 | 2 level while with continue
18 | 00 01 02
19 | 10 11 12
20 | 20 21 22
21 |
22 | data is
23 | line is line1
24 | line is line2
25 | line is line3
26 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_xexpr.xsh.out:
--------------------------------------------------------------------------------
1 | empty sequence
2 | 1 2 string bar
3 | the following crashes saxon sometimes
4 | value
5 | for: 1
6 | for: string
7 | for:
8 | for: value
9 | for: 2
10 | for: 3
11 | for: 4
12 | Number of params: 2
13 | value
14 | second arg
15 | foo barspam
16 |
--------------------------------------------------------------------------------
/xmlsh/test/core/out/core_xpipe.xsh.out:
--------------------------------------------------------------------------------
1 | xs:string
2 | xs:string
3 | xs:string
4 | xs:string
5 | xs:string
6 | xs:integer
7 | xs:string
8 | element()
9 | document-node()
10 | attribute()
11 |
--------------------------------------------------------------------------------
/xmlsh/test/extra/out/xsql_sqlite2.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1
5 | 2
6 | 3
7 | 4
8 | 5
9 | 6
10 | 7
11 | 8
12 | 9
13 | 10
14 |
15 |
16 |
17 |
18 | 1
19 | My Test Class
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/xmlsh/test/extra/out/xsql_sqlite3.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/xmlsh/test/extra/xsql_csvjdbc.xsh:
--------------------------------------------------------------------------------
1 | # Test a csvjdbc dump from a csv file
2 | # connector from http://csvjdbc.sourceforge.net/
3 |
4 | CP=/java/csvjdbc-r0-10/csvjdbc.jar
5 |
6 | cd ../../samples/data
7 | xsql -cp $CP -d org.relique.jdbc.csv.CsvDriver -o suppressHeaders=true -c "jdbc:relique:csv:$PWD" "select * from books"
8 |
9 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_csv2xml.xsh:
--------------------------------------------------------------------------------
1 | # test of csv2xml
2 | set +indent
3 | x1=$<(echo foo,bar,spam | csv2xml)
4 | xpath '/root/row/col[2]' <{x1} >{x2}
5 | xcmp $x2 <[ bar ]> || echo Failed compare
6 |
7 | F=../../samples/data/books.csv
8 | csv2xml -root books -row item -header -attr $F
9 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_csv2xml2.xsh:
--------------------------------------------------------------------------------
1 | # test of csv2xml using our own supplied column names
2 | # Try with one row that exceeds the limit
3 |
4 | csv2xml -colnames {<["col1","col2","col3"]>} <} -trim <
14 | a=QName(prefix1 http://foo.bar1 bar)
15 | b=QName(prefix2 http://foo.bar2 spam)
16 | echo <[ element {$b} { attribute {$a} { "value" , "hi" } } ]>
17 |
18 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_quote.xsh:
--------------------------------------------------------------------------------
1 | # Test of quote function
2 |
3 | echo quote( 'hi"there' )
4 | echo quote( <[ bar ]> )
5 | echo quote( a b c <[ 123 ]> <[ ]> )
6 | echo quote( a\\b )
7 |
8 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_rngvalidate.xsh:
--------------------------------------------------------------------------------
1 | # test of rngvalidate
2 |
3 | echo RNG Validation
4 | rngvalidate ../../samples/data/books.rng ../../samples/data/books.xml || { echo failed RNG validation ; exit 1 ; }
5 |
6 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_schematron.xsh:
--------------------------------------------------------------------------------
1 | # Test schematron validation
2 | # same as xvalidate -schematron
3 |
4 | echo Schematron validation
5 | N=$(schematron ../../samples/data/books.sch ../../samples/data/books.xml | xmlns:svrl=http://purl.oclc.org/dsdl/svrl xpath 'count(//svrl:fired-rule)')
6 | echo Matching Items: $N
7 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_time.xsh:
--------------------------------------------------------------------------------
1 | # Test time command
2 | # ignore actual time output but test that it executes the command
3 |
4 | time echo 2>/dev/null
5 | time echo foo 2>/dev/null
6 | time echo foo bar 2>/dev/null
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xaddbase.xsh:
--------------------------------------------------------------------------------
1 | # test for xaddbase
2 | X=$<(xaddbase < http://test.xmlsh.org/data/books.xml)
3 | echo base is <[ $X/BOOKLIST/@xml:base/string() ]>
4 | X=$<(xaddbase < http://test.xmlsh.org/data/xml-base-test.xml)
5 | echo inner base is <[ $X/doc/div/@xml:base/string() ]>
6 | unset X
7 | exit 0
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xbase.xsh:
--------------------------------------------------------------------------------
1 | # test of xbase
2 | xbase < http://test.xmlsh.org/data/books.xml
3 | X=$<(xaddbase < http://test.xmlsh.org/data/books.xml)
4 | X2=<[ $X/BOOKLIST ]>
5 | xbase <{X2}
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xcat.xsh:
--------------------------------------------------------------------------------
1 | # internal_xcat.xsh
2 | # test of xcat
3 |
4 |
5 | cd $TMPDIR
6 | echo <[bar ]> > x1.xml
7 | echo <[spam ]> > x2.xml
8 |
9 | echo xcat files only
10 | xcat -r -w foo x1.xml x2.xml
11 |
12 | echo xcat text element
13 | xcat -w test -r x1.xml x2.xml
14 | echo xcat xml element
15 | xcat -w <[ ]> -r x1.xml x2.xml
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xdelattribute.xsh:
--------------------------------------------------------------------------------
1 | # test of xdelattribute
2 | xdelattribute -a CODE ../../samples/data/books.xml
3 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xdelattribute2.xsh:
--------------------------------------------------------------------------------
1 | # test of xdelattribute - complex case with namespaces and duplicate attributes
2 |
3 | declare namespace a=http://www.xmlsh.org/a
4 | declare namespace b=http://www.xmlsh.org/b
5 |
6 | xml=<[
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ]>
18 |
19 | # Test delete a:attr and b:attr2 using either QName constructor or strings
20 | # But only on a:item or notanitem
21 | xdelattribute -a QName(a:attr) -a b:attr2 -e "{http://www.xmlsh.org/a}item" -e notanitem <{xml}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xgetopts.xsh:
--------------------------------------------------------------------------------
1 | # test of xgetopts
2 | xgetopts "a=longa:,bc:,bool,multi:+,missing:" -longa "Option A" -bc "Option BC" -bool -multi "Multi 1" -multi <[ Multi 2 as XML ]> Remaining <[ Args ]>
3 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xgetopts2.xsh:
--------------------------------------------------------------------------------
1 | # test of xgetopts
2 |
3 | set -- -longa "Option A" -bc "Option BC" -bool -multi "Multi 1" -multi <[ Multi 2 as XML ]> Remaining <[ Args ]>
4 |
5 | # Test with spaces before and after the , and :
6 | PASS=$(xgetopts -a -o "a=longa:, multi:+ , missing: " -p "bool, bc: " -- "$@")
7 | shift $?
8 | echo PASS $PASS
9 | echo "$@"
10 |
11 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xgrep1.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of xgrep command
3 |
4 | # XML output
5 |
6 | xgrep -r //ITEM ../../samples/data/*.xml
7 |
8 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xgrep2.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of xgrep command
3 |
4 | # XML output
5 |
6 | xgrep -t -r / ../../samples/data/*.xml
7 |
8 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xgrep3.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of xgrep command
3 |
4 | # XML output
5 | # Test assignment to variable to verify that VariableOutputPort works with scripting stax events
6 |
7 | xgrep -r //ITEM ../../samples/data/*.xml >{_out}
8 | xecho $_out
9 |
10 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xidentity.xsh:
--------------------------------------------------------------------------------
1 | # test of xidentity
2 | xidentity < ../../samples/data/books.xml
3 |
4 |
5 | # Check that elements pass through unchanged with variable redirection
6 | a=<[ ]>
7 | xidentity <{a} >{b}
8 |
9 | [ "$a" = "$b" ] || echo Failed identity should preserve plain elements
10 |
11 |
12 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xinclude.xsh:
--------------------------------------------------------------------------------
1 | # test of xinclude
2 |
3 | # Basic test
4 | xinclude < ../../samples/data/xi_doc1.xml
5 |
6 | # This should work too but dont test it now
7 | #xinclude ../../samples/data/xi_doc1.xml
8 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xls.xsh:
--------------------------------------------------------------------------------
1 | # test of xls command
2 | import commands posix
3 | TD=$TMPDIR/_xmlsh
4 | rm -rf $TD
5 | mkdir $TD
6 | cd $TD
7 |
8 | echo > file1.dat
9 | echo -n fixedlen > file2.dat
10 | echo > file3.dat
11 |
12 | D=$<(xls)
13 |
14 |
15 | [ <[count($D//file)]> -ne 3 ] && echo FAILED File count should be 3
16 |
17 | [ <[$D/dir/file[2]/@name/string()]> = file2.dat ] || echo FAILED expected file2.dat
18 |
19 | D2=$<(xls -l)
20 | [ <[ xs:integer($D2/dir/file[2]/@length) ]> -eq 8 ] || echo FAILED expected length of file2.dat = 8
21 |
22 | cd ..
23 | rm -rf $TD
24 |
25 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xmd5sum.xsh:
--------------------------------------------------------------------------------
1 | # Test of xmd5sum
2 |
3 |
4 | echo "Hello World" | xmd5sum
5 |
6 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xmd5sum2.xsh:
--------------------------------------------------------------------------------
1 | # Test of xmd5sum
2 | _D=$PWD
3 | _DIR=$TMPDIR/_xmlsh_md5
4 | [ -d $_DIR ] && rm -rf $_DIR
5 | mkdir -p $_DIR
6 | cp -r ../../samples/data $_DIR
7 | cd $_DIR || exit 1 ;
8 | rm -rf data/.svn
9 |
10 | xmd5sum data
11 |
12 | cd $_D
13 | rm -rf $_DIR
14 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xml2csv.xsh:
--------------------------------------------------------------------------------
1 | # test of xml2csv
2 |
3 | F=../../samples/data/books.csv
4 | csv2xml -header -attr $F | xml2csv -header -attr
5 | echo
6 | csv2xml -header $F | xml2csv -header
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xml2csv2.xsh:
--------------------------------------------------------------------------------
1 | # test of xml2csv2
2 | # test of xls command
3 | import commands posix
4 |
5 | csv2xml -header -tab -input-encoding utf16 < ../../samples/data/employee.txt |
6 | xml2csv -header -tab -output-text-encoding utf8
7 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xml2json.xsh:
--------------------------------------------------------------------------------
1 | # test of xml2json
2 |
3 | F=../../samples/data/books.jxml
4 | xml2json -p < $F
5 |
6 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xmove.xsh:
--------------------------------------------------------------------------------
1 | # test of xsplit
2 | import commands posix
3 |
4 | D=$PWD
5 | [ -d $TMPDIR/_xmlsh ] && rm -rf $TMPDIR/_xmlsh
6 | mkdir $TMPDIR/_xmlsh
7 | cd $TMPDIR/_xmlsh
8 |
9 | # Create a test file to split
10 | xquery -n -f - > test.xml <
13 | {
14 | for $i in 0 to 99
15 | return
16 |
17 | Some text here
18 | Node: {$i}
19 |
20 | }
21 |
22 | }
23 | EOF
24 |
25 | xsplit -n test.xml
26 | rm test.xml
27 |
28 | # Now move all files to just their numbered names
29 | xmove -q -x /child/@id *.xml
30 | xls | xquery '
31 | {
32 | for $f in //file
33 | order by $f/@name
34 | return {$f/@name} }
35 | '
36 |
37 | cd $D
38 | rm -rf $TMPDIR/_xmlsh
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xproperties.xsh:
--------------------------------------------------------------------------------
1 | # test of xproperties
2 |
3 | [ -d $TMPDIR/_xmlsh ] && rm -rf $TMPDIR/_xmlsh
4 | mkdir $TMPDIR/_xmlsh
5 | cd $TMPDIR/_xmlsh
6 |
7 | # create a initial properties files in text form
8 | xproperties -text -a var1="Variable 1" -a var2="Variable 2" -a var3="" > xsh.txt
9 |
10 | # convert the text form to xml form
11 | xproperties -in xsh.txt -xml > xsh.xml
12 |
13 | # delete a property and display as xml with a comment
14 | xproperties -inxml xsh.xml -comment "A comment" -xml -d var2
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xpwd.xsh:
--------------------------------------------------------------------------------
1 | # test of xpwd command
2 |
3 | # xpwd should always return the same value as $PWD
4 |
5 | XP=$<(xpwd)
6 | XF=$(xfile $XP)
7 |
8 | [ "$PWD" = "$XF" ] && echo success xpwd
9 | exit 0
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xquote.xsh:
--------------------------------------------------------------------------------
1 | # test of xquote
2 |
3 | a=<[ bar ]>
4 | # a is a element
5 | xtype $a
6 |
7 | set +indent
8 | # $b is a string
9 | xquote {$a}>{b}
10 | xtype $b
11 |
12 | # Test results within elements
13 | xecho <[ {$a} ]>
14 | xecho <[ {$b} ]>
15 |
16 | # Test quote from stdin
17 | xecho <[ bar ]> | xquote >{c}
18 | xtype $c
19 |
20 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xsdvalidate.xsh:
--------------------------------------------------------------------------------
1 | echo Validating with xsd
2 | xsdvalidate ../../samples/data/books.xsd ../../samples/data/books.xml || echo Validation failed
3 |
4 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xslt.xsh:
--------------------------------------------------------------------------------
1 | # test of xslt command
2 |
3 | # test identity
4 | cd ../../samples/styles
5 |
6 |
7 | xslt -f identity.xsl <
9 | text
10 |
11 | EOF
12 |
13 | # Identity with XML expression
14 |
15 |
16 | xslt -f identity.xsl -i <[text ]>
17 |
18 | # test complicated style
19 | # Note: includes a comment field which is timestamped so failes test
20 | # xslt -f books.xsl -i ../data/books.xml
21 |
22 |
23 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xslt1.xsh:
--------------------------------------------------------------------------------
1 | # test of xslt command
2 |
3 | # test identity
4 | cd ../../samples/styles
5 |
6 |
7 | xslt1 -f identity.xsl -i ../data/books.xml
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xsplit2.xsh:
--------------------------------------------------------------------------------
1 | # test of xsplit
2 |
3 | D=$PWD
4 | [ -d $TMPDIR/_xmlsh ] && rm -rf $TMPDIR/_xmlsh
5 | mkdir $TMPDIR/_xmlsh
6 | cd $TMPDIR/_xmlsh
7 |
8 | # Create a test file to split
9 | xquery -n -f - > test.xml <
12 | {
13 | for $i in 0 to 99
14 | return
15 |
16 | Some text here
17 | Node: {$i}
18 |
19 | }
20 |
21 | }
22 | EOF
23 |
24 | xsplit -l - test.xml
25 |
26 | cd ..
27 | rm -rf $TMPDIR/_xmlsh
28 |
29 |
30 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xsplit3.xsh:
--------------------------------------------------------------------------------
1 | # test of xsplit
2 |
3 | D=$PWD
4 | [ -d $TMPDIR/_xmlsh ] && rm -rf $TMPDIR/_xmlsh
5 | mkdir $TMPDIR/_xmlsh
6 | cd $TMPDIR/_xmlsh
7 |
8 | # Create a test file to split
9 | xquery -n -f - > test.xml <
12 | {
13 | for $i in 0 to 99
14 | return
15 |
16 | Some text here
17 | Node: {$i}
18 |
19 | }
20 |
21 | }
22 | EOF
23 | xmkpipe -xml x
24 |
25 | while xread a ; do
26 | xecho <[ $a/child/@id/string() ]>
27 | done <(x) &
28 | xsplit -n -stream x test.xml
29 |
30 |
31 | xmkpipe -close x
32 |
33 | wait
34 | echo Done
35 |
36 |
37 | cd ..
38 | rm -rf $TMPDIR/_xmlsh
39 |
40 |
41 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xtee.xsh:
--------------------------------------------------------------------------------
1 | # test of xidentity
2 | [ -d $TMPDIR/_xmlsh ] && rm -rf $TMPDIR/_xmlsh
3 | mkdir $TMPDIR/_xmlsh
4 | xtee $TMPDIR/_xmlsh/a.xml $TMPDIR/_xmlsh/b.xml < ../../samples/data/books.xml
5 |
6 | xcmp -x ../../samples/data/books.xml $TMPDIR/_xmlsh/a.xml || { echo compare failed ; exit 1 ; }
7 |
8 | xcmp -x ../../samples/data/books.xml $TMPDIR/_xmlsh/b.xml || { echo compare failed ; exit 1 ; }
9 |
10 | rm -rf $TMPDIR/_xmlsh
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xunquote.xsh:
--------------------------------------------------------------------------------
1 | # test of xunquote
2 |
3 | a=<[ bar ]>
4 | # a is a element
5 | xtype $a
6 |
7 | set +indent
8 | # $b is a string
9 | xquote {$a}>{b}
10 | xtype $b
11 |
12 | #convert to a document
13 | xunquote {$b}>{c}
14 |
15 | xtype {$c}
16 | xecho <[ $c/foo ]>
17 | xecho <[ {$c} ]>
18 |
19 | # Test from stdin
20 |
21 | import commands p=posix
22 | xquote <[ {$b} ]>
23 | xquote <[ {$b} ]> | p:cat | xunquote | xread e
24 | xecho $e
25 | xecho <[ $e/test ]>
26 | echo <[ $e/test/string() ]> >{f}
27 | xunquote "$f"
28 |
29 | xunquote "<foo>bar</foo>"
30 |
31 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xuri.xsh:
--------------------------------------------------------------------------------
1 | # test for xuriu
2 |
3 | xuri http://www.xmlsh.org
4 | xuri http://www.xmlsh.org /foo.bar
5 | xuri http //www.xmlsh.org/foo.bar fragment
6 | xuri http www.xmlsh.org /path/foo.bar query fragment
7 | xuri http user www.xmlsh.org 80 /path/foo.bar query fragment
8 | xuri http "" www.xmlsh.org 80 /path/foo.bar query fragment
9 | xuri http "" www.xmlsh.org "" /path/foo.bar query fragment
10 | xuri http "" www.xmlsh.org "" /path/foo.bar "" fragment
11 |
12 | uri=$(xuri http user www.xmlsh.org 80 /path/foo.bar query fragment)
13 | xuri -a $uri
14 | xuri -f $uri
15 | xuri -h $uri
16 | xuri -p $uri
17 | xuri -P $uri
18 | xuri -q $uri
19 | xuri -s $uri
20 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/internal_xurlencode.xsh:
--------------------------------------------------------------------------------
1 | # test of xurlencode
2 |
3 | xurlencode http://www.xmlsh.org
4 | xurlencode "a string & with < weird =? chars" "second&second"
5 | xurlencode -q "first" "arg1" "sec&end" "arg 2"
6 | xurlencode -q <[ "a" , 1 , "b=2" , "spam&bletch" ]>
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_csv2xml.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_csv2xml2.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | a
4 | b
5 | c
6 |
7 |
8 | d
9 | e
10 | f
11 |
12 |
13 | g
14 | h
15 | i
16 |
17 |
18 | a string
19 | another string
20 | Final string
21 |
22 |
23 | testing quotes
24 | "embedded quotes like excel"
25 | double " quotes
26 |
27 |
28 | embeded,comma
29 | "started with double quotes"
30 |
31 |
32 | j
33 | k
34 | l
35 | Unexpected Column
36 |
37 |
38 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_csv2xml4.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
Pride and Prejudice
4 | Jane Austen
5 | Modern Library
6 | 12/31/2002
7 | English4.95,187,679601686,352,8.3 5.7 1.1,6.1
8 |
9 | -
10 |
Wuthering Heights
11 | Charlotte Bront
12 | Penguin Classics
13 | 12/31/2002
14 | English6.58,113,141439556,430,1.0 5.2 7.8,11.2
15 |
16 |
17 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_fixed2xml.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
FOO
4 | BAR
5 | SPAM
6 |
7 | -
8 |
GOOO
9 | BAH
10 | SPA
11 |
12 |
13 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_jcall.xsh.out:
--------------------------------------------------------------------------------
1 | success jcall
2 | exit
3 | exit status is 1
4 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_jset.xsh.out:
--------------------------------------------------------------------------------
1 | java.lang.String
2 | String Value:
3 | String Value: (init) Hi
4 | String Value: (concat) Hi There
5 | String Value: (replace) Bye There
6 | java.lang.Integer
7 | Length: 8
8 | org.xmlsh.test.TestTypes
9 | TestTypes(String)
10 | TestTypes(Integer)
11 | TestTypes(Long,String)
12 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_jsonpath.xsh.out:
--------------------------------------------------------------------------------
1 | [1,true,null,"hi"]
2 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_qname.xsh.out:
--------------------------------------------------------------------------------
1 | spam
2 | prefix:spam
3 | foo:spam
4 | net.sf.saxon.s9api.QName
5 | hi
6 |
7 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_quote.xsh.out:
--------------------------------------------------------------------------------
1 | "hi\"there"
2 | "bar "
3 | "abc123"
4 | "a\\b"
5 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_rngvalidate.xsh.out:
--------------------------------------------------------------------------------
1 | RNG Validation
2 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_schematron.xsh.out:
--------------------------------------------------------------------------------
1 | Schematron validation
2 | Matching Items: 6
3 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_time.xsh.out:
--------------------------------------------------------------------------------
1 |
2 | foo
3 | foo bar
4 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xaddbase.xsh.out:
--------------------------------------------------------------------------------
1 | base is http://test.xmlsh.org/data/books.xml
2 | inner base is http://test.xmlsh.org/data/xml-base-chap.xml
3 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xbase.xsh.out:
--------------------------------------------------------------------------------
1 | http://test.xmlsh.org/data/books.xml
2 | http://test.xmlsh.org/data/books.xml
3 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xcat.xsh.out:
--------------------------------------------------------------------------------
1 | xcat files only
2 |
3 | bar
4 | spam
5 |
6 | xcat text element
7 |
8 | bar
9 | spam
10 |
11 | xcat xml element
12 |
13 | bar
14 | spam
15 |
16 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xcmp.xsh.out:
--------------------------------------------------------------------------------
1 | Success compared Success
2 | Success compared Failed
3 | xml compare Success
4 | xml compare Success
5 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xdelattribute2.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xed.xsh.out:
--------------------------------------------------------------------------------
1 | bar
2 | Success replace attribute
3 | Success add element
4 | Success delete element
5 | Success xproc replace text
6 | Success xproc replace attriubute
7 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xfile.xsh.out:
--------------------------------------------------------------------------------
1 | foo
2 | foo
3 | foo.bar
4 | foo.bar
5 | Success -d
6 | .bar
7 | .bar
8 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xgetopts.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Option A
5 |
6 |
7 | Option BC
8 |
9 |
10 |
11 | Multi 1
12 |
13 | Multi 2 as XML
14 |
15 |
16 |
17 |
18 | Remaining
19 |
20 | Args
21 |
22 |
23 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xgetopts2.xsh.out:
--------------------------------------------------------------------------------
1 | PASS -bool -bc Option BC
2 | Remaining Args
3 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xgrep1.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xgrep2.xsh.out:
--------------------------------------------------------------------------------
1 | ../../samples/data/REC-xml-20060816.xml
2 | ../../samples/data/books.xml
3 | ../../samples/data/intl.xml
4 | ../../samples/data/othello.xml
5 | ../../samples/data/xi_doc1.xml
6 | ../../samples/data/xi_sub1.xml
7 | ../../samples/data/xml-base-chap.xml
8 | ../../samples/data/xml-base-test.xml
9 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xgrep3.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xinclude.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 | 120 Mz is adequate for an average home user.
3 |
4 | The opinions represented herein represent those of the individual
5 | and should not be interpreted as official policy endorsed by this
6 | organization.
7 |
8 |
9 |
10 | Fallback OK
11 |
12 |
13 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xls.xsh.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/xmlsh/test/internal/out/internal_xls.xsh.out
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xmd5sum.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xml2csv.xsh.out:
--------------------------------------------------------------------------------
1 | AUTHOR,DIMENSIONS,ISBN,LANGUAGE,PAGES,PRICE,PUB-DATE,PUBLISHER,QUANTITY,TITLE,WEIGHT
2 | Jane Austen,8.3 5.7 1.1,679601686,English,352,4.95,12/31/2002,Modern Library,187,Pride and Prejudice,6.1
3 | Charlotte Bront,1.0 5.2 7.8,141439556,English,430,6.58,12/31/2002,Penguin Classics,113,Wuthering Heights,11.2
4 |
5 | TITLE,AUTHOR,PUBLISHER,PUB-DATE,LANGUAGE,PRICE,QUANTITY,ISBN,PAGES,DIMENSIONS,WEIGHT
6 | Pride and Prejudice,Jane Austen,Modern Library,12/31/2002,English,4.95,187,679601686,352,8.3 5.7 1.1,6.1
7 | Wuthering Heights,Charlotte Bront,Penguin Classics,12/31/2002,English,6.58,113,141439556,430,1.0 5.2 7.8,11.2
8 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xpath.xsh.out:
--------------------------------------------------------------------------------
1 | Xpath on stdin
2 | Jane Austen
3 | Charlotte Brontë
4 | Thomas Hardy
5 | Thomas Hardy
6 | Jasper Fforde
7 | Jasper Fforde
8 | Xpath on file
9 | Jane Austen
10 | Charlotte Brontë
11 | Thomas Hardy
12 | Thomas Hardy
13 | Jasper Fforde
14 | Jasper Fforde
15 | xpath on xml expression
16 |
17 | text
18 | text
19 | Success returned xpath
20 | Success empty returned xpath
21 | Test
22 | Test
23 | Test
24 | Test
25 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xproperties.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | A comment
4 |
5 | Variable 1
6 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xpwd.xsh.out:
--------------------------------------------------------------------------------
1 | success xpwd
2 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xquote.xsh.out:
--------------------------------------------------------------------------------
1 | element()
2 | xs:string
3 | bar
4 | <foo>bar</foo>
5 |
6 | xs:string
7 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xsdvalidate.xsh.out:
--------------------------------------------------------------------------------
1 | Validating with xsd
2 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xslt.xsh.out:
--------------------------------------------------------------------------------
1 |
2 | text
3 |
4 | text
5 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xsplit.xsh.out:
--------------------------------------------------------------------------------
1 | Number of files: 100
2 | Node: 10
3 | Number of files: 10
4 | Node: 21
5 | Number of files: 10
6 | Node: 21
7 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xunquote.xsh.out:
--------------------------------------------------------------------------------
1 | element()
2 | xs:string
3 | document-node()
4 | bar
5 | bar
6 | <foo>bar</foo>
7 |
8 | <foo>bar</foo>
9 |
10 | <foo>bar</foo>
11 |
12 | bar
13 | bar
14 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xuri.xsh.out:
--------------------------------------------------------------------------------
1 | http://www.xmlsh.org
2 | http://www.xmlsh.org/foo.bar
3 | http://www.xmlsh.org/foo.bar#fragment
4 | http://www.xmlsh.org/path/foo.bar?query#fragment
5 | http://user@www.xmlsh.org:80/path/foo.bar?query#fragment
6 | http://www.xmlsh.org:80/path/foo.bar?query#fragment
7 | http://www.xmlsh.org/path/foo.bar?query#fragment
8 | http://www.xmlsh.org/path/foo.bar#fragment
9 | user@www.xmlsh.org:80
10 | fragment
11 | www.xmlsh.org
12 | /path/foo.bar
13 | 80
14 | query
15 | http
16 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xurlencode.xsh.out:
--------------------------------------------------------------------------------
1 | http%3A%2F%2Fwww.xmlsh.org
2 | a+string+%26+with+%3C+weird+%3D%3F+chars&second%26second
3 | first=arg1&sec%26end=arg+2
4 | a=1&b%3D2=spam%26bletch
5 |
--------------------------------------------------------------------------------
/xmlsh/test/internal/out/internal_xvalidate.xsh.out:
--------------------------------------------------------------------------------
1 | Validating with DTD
2 | Validating with xsd
3 | validate -rng ../../samples/data/books.rng ../../samples/data/books.xml
4 | Following should fail
5 | Successfully trapped invalid schema
6 | Schematron validation
7 | Matching Items: 6
8 | Matching Items: 6
9 | RNG Validation
10 |
--------------------------------------------------------------------------------
/xmlsh/test/java/java_jnew.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of jnew
3 | #
4 |
5 | # Integer
6 | i=jnew(java.lang.Integer 1)
7 | xtype $i
8 | echo $i
9 |
10 | # Date
11 | date=jnew(java.util.Date)
12 | xtype $date
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/xmlsh/test/java/out/java_jnew.xsh.out:
--------------------------------------------------------------------------------
1 | java.lang.Integer
2 | 1
3 | java.util.Date
4 |
--------------------------------------------------------------------------------
/xmlsh/test/java/out/java_types.xsh.out:
--------------------------------------------------------------------------------
1 | TestTypes()
2 | TestTypes(String)
3 | TestTypes(Object)
4 | TestTypes(Integer)
5 | TestTypes(Integer,String)
6 | TestTypes(Long,String)
7 | String
8 | java.lang.String
9 |
--------------------------------------------------------------------------------
/xmlsh/test/json/json_array.xsh:
--------------------------------------------------------------------------------
1 | # test json:array
2 | import commands json=json
3 | echo json:array()
4 | echo json:array( 1 json:number(2.5) \
5 | json:object( x hi y json:array( json:null() json:boolean(true) "text" ) ) )
6 |
--------------------------------------------------------------------------------
/xmlsh/test/json/json_boolean.xsh:
--------------------------------------------------------------------------------
1 | # test json:boolean
2 | import commands json=json
3 |
4 | echo json:boolean( 1 )
5 | echo json:boolean( true )
6 | echo json:boolean( 0 )
7 | echo json:boolean( false )
8 | echo json:boolean( <[ fn:true() ]> )
9 | echo json:boolean( <[ fn:false() ]> )
10 | echo json:object( a json:boolean( false ) )
11 |
12 |
--------------------------------------------------------------------------------
/xmlsh/test/json/json_json.xsh:
--------------------------------------------------------------------------------
1 | import commands json=json
2 | echo json:json( '{ "a" : 1.5 , "b" : [ 1 , true , null , "xyz" ] }' )
3 |
--------------------------------------------------------------------------------
/xmlsh/test/json/json_null.xsh:
--------------------------------------------------------------------------------
1 | # test json:null
2 | import commands json=json
3 | echo json:null()
4 | echo json:object( a json:null() b json:array( 1 json:null() hi) )
5 |
--------------------------------------------------------------------------------
/xmlsh/test/json/json_number.xsh:
--------------------------------------------------------------------------------
1 | # test json:boolean
2 | import commands json=json
3 |
4 | echo json:number( 1 )
5 | echo json:number( 1.5 )
6 | echo json:number( -1 )
7 | echo json:object( a json:number( 2 ) c json:number( 3.5 ) )
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/xmlsh/test/json/json_object.xsh:
--------------------------------------------------------------------------------
1 | import commands json=json
2 | echo json:object()
3 | echo json:object( x hi y json:array( json:null() json:boolean(true) "text" ) )
4 |
--------------------------------------------------------------------------------
/xmlsh/test/json/json_path.xsh:
--------------------------------------------------------------------------------
1 | import commands json=json
2 | o=json:object( x hi y json:array( json:null() json:boolean(true) "text" ) )
3 | echo json:path( $o y )
4 |
--------------------------------------------------------------------------------
/xmlsh/test/json/json_path2.xsh:
--------------------------------------------------------------------------------
1 | import commands json=json
2 |
3 | txt=$(<../../samples/data/log.json)
4 | j=json:json( {$txt} )
5 | echo json:path( {$j} Message ) >{xt}
6 | xread -parse x <{xt}
7 | echo <[ $x//title ]>
8 |
--------------------------------------------------------------------------------
/xmlsh/test/json/json_value.xsh:
--------------------------------------------------------------------------------
1 | # test json:boolean
2 | import commands json=json
3 |
4 | echo json:value( 1 )
5 | echo json:value( <[ 1 ]> )
6 | xtype json:value( <[ 1 ]> )
7 | xtype json:value( <[ 1.5 ]> )
8 | xtype json:value( text )
9 | xtype json:value()
10 |
11 |
--------------------------------------------------------------------------------
/xmlsh/test/json/out/json_array.xsh.out:
--------------------------------------------------------------------------------
1 | []
2 | ["1",2.5,{"x":"hi","y":[null,true,"text"]}]
3 |
--------------------------------------------------------------------------------
/xmlsh/test/json/out/json_boolean.xsh.out:
--------------------------------------------------------------------------------
1 | true
2 | true
3 | false
4 | false
5 | true
6 | false
7 | {"a":false}
8 |
--------------------------------------------------------------------------------
/xmlsh/test/json/out/json_json.xsh.out:
--------------------------------------------------------------------------------
1 | {"a":1.5,"b":[1,true,null,"xyz"]}
2 |
--------------------------------------------------------------------------------
/xmlsh/test/json/out/json_null.xsh.out:
--------------------------------------------------------------------------------
1 |
2 | {"a":null,"b":["1",null,"hi"]}
3 |
--------------------------------------------------------------------------------
/xmlsh/test/json/out/json_number.xsh.out:
--------------------------------------------------------------------------------
1 | 1
2 | 1.5
3 | -1
4 | {"a":2,"c":3.5}
5 |
--------------------------------------------------------------------------------
/xmlsh/test/json/out/json_object.xsh.out:
--------------------------------------------------------------------------------
1 | {}
2 | {"x":"hi","y":[null,true,"text"]}
3 |
--------------------------------------------------------------------------------
/xmlsh/test/json/out/json_path.xsh.out:
--------------------------------------------------------------------------------
1 | [null, true, text]
2 |
--------------------------------------------------------------------------------
/xmlsh/test/json/out/json_path2.xsh.xml:
--------------------------------------------------------------------------------
1 | Test
2 |
--------------------------------------------------------------------------------
/xmlsh/test/json/out/json_value.xsh.out:
--------------------------------------------------------------------------------
1 | 1
2 | 1
3 | java.lang.Long
4 | java.math.BigDecimal
5 | java.lang.String
6 | null
7 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/out/posix_base64.xsh.out:
--------------------------------------------------------------------------------
1 | Hello Word
2 |
3 |
6 |
7 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/out/posix_cat.xsh.out:
--------------------------------------------------------------------------------
1 | Success
2 | Success
3 | Success
4 | Success
5 | Success compare differs
6 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/out/posix_cp.xsh.out:
--------------------------------------------------------------------------------
1 | Success
2 | Success
3 | Success
4 | Success
5 | Success
6 | Success
7 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/out/posix_cp2.xsh.out:
--------------------------------------------------------------------------------
1 | Success
2 | Success
3 | Success
4 | Success
5 | Success
6 | Success
7 | Success
8 | Success
9 | Success
10 | Success
11 | Success
12 | Success
13 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/out/posix_mkdir.xsh.out:
--------------------------------------------------------------------------------
1 | Success
2 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/out/posix_mv.xsh.out:
--------------------------------------------------------------------------------
1 | Success f2
2 | Success f3
3 | Success f4
4 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/out/posix_rm.xsh.out:
--------------------------------------------------------------------------------
1 | Success f1 deleted
2 | Success f2 deleted
3 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/posix_base64.xsh:
--------------------------------------------------------------------------------
1 | # Test base command
2 | import package posix=org.xmlsh.commands.posix
3 |
4 | rm -rf $TMPDIR/_xmlsh
5 | mkdir $TMPDIR/_xmlsh
6 |
7 |
8 | # Test 1 simple base64 encode and decode of "Hello World"
9 |
10 | echo "Hello Word" | posix:base64 | posix:base64 -d
11 |
12 | # Use a known binary file for testing
13 | posix:cp ../../lib/saxon9he.jar $TMPDIR/_xmlsh/binary.dat
14 | cd $TMPDIR/_xmlsh
15 | xmd5sum binary.dat
16 | posix:base64 -w binary.dat > binary.b64
17 | posix:base64 -d binary.b64 > b2.dat
18 | xmd5sum b2.dat
19 |
20 | cd ..
21 | rm -rf $TMPDIR/_xmlsh
22 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/posix_cat.xsh:
--------------------------------------------------------------------------------
1 | # Test cat command
2 | import package posix=org.xmlsh.commands.posix
3 |
4 | rm -rf $TMPDIR/_xmlsh
5 | mkdir $TMPDIR/_xmlsh
6 |
7 | # Create initial file
8 | posix:cat < ../../samples/data/books.xml > $TMPDIR/_xmlsh/f1
9 |
10 | cd $TMPDIR/_xmlsh
11 |
12 |
13 | # test from stdin
14 | posix:cat < f1 > f2
15 | xcmp f1 f2 && echo Success
16 |
17 | # test in pipe
18 | posix:cat < f1 | posix:cat | posix:cat > f2
19 | xcmp f1 f2 && echo Success
20 |
21 | # test from 1 file
22 | posix:cat f1 > f2
23 | xcmp f1 f2 && echo Success
24 |
25 |
26 | posix:cat f1 >>f2
27 | posix:cat f1 >>f2
28 | posix:cat f1 f1 f1 > f3
29 |
30 |
31 | xcmp f2 f3 && echo Success
32 | posix:cat f1 >>f2
33 |
34 | xcmp -n f2 f3 || echo Success compare differs
35 |
36 | posix:rm f1 f2 f3
37 | cd ..
38 | rm -rf $TMPDIR/_xmlsh
39 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/posix_cp.xsh:
--------------------------------------------------------------------------------
1 | # Test cat command
2 | import package posix=org.xmlsh.commands.posix
3 |
4 | posix:rm -rf $TMPDIR/_xmlsh
5 | posix:mkdir $TMPDIR/_xmlsh
6 |
7 | # Create initial file
8 | posix:cat < ../../samples/data/books.xml > $TMPDIR/_xmlsh/f1
9 |
10 | cd $TMPDIR/_xmlsh
11 |
12 | posix:cp f1 f2
13 | xcmp f1 f2 && echo Success
14 |
15 | posix:mkdir dir
16 | posix:cp f1 dir
17 | xcmp f1 dir/f1 && echo Success
18 |
19 | posix:mkdir dir2
20 | posix:cp f1 f3
21 | posix:cp f1 f4
22 |
23 | # test copy many to dir
24 | posix:cp f1 f2 f3 f4 dir2
25 | xcmp f1 dir2/f1 && echo Success
26 | xcmp f1 dir2/f2 && echo Success
27 | xcmp f1 dir2/f3 && echo Success
28 | xcmp f1 dir2/f4 && echo Success
29 |
30 | cd ..
31 | posix:rm -rf $TMPDIR/_xmlsh
32 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/posix_mkdir.xsh:
--------------------------------------------------------------------------------
1 | # Test mkdir command
2 | import package posix=org.xmlsh.commands.posix
3 |
4 | posix:rm -rf $TMPDIR/_xmlsh
5 | posix:mkdir $TMPDIR/_xmlsh
6 | [ -d $TMPDIR/_xmlsh ] || echo Failed to make _xmlsh
7 |
8 | posix:mkdir $TMPDIR/_xmlsh/dir1
9 | posix:mkdir -p $TMPDIR/_xmlsh/dir2/dir3/dir4/dir5
10 | #xls $TMPDIR/_xmlsh
11 | echo Success
12 | posix:rm -rf $TMPDIR/_xmlsh
13 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/posix_rm.xsh:
--------------------------------------------------------------------------------
1 | # Test rm
2 | import package posix=org.xmlsh.commands.posix
3 |
4 | posix:rm -rf $TMPDIR/_xmlsh
5 | posix:mkdir $TMPDIR/_xmlsh
6 |
7 | # Create initial file
8 | posix:cat < ../../samples/data/books.xml > $TMPDIR/_xmlsh/f1
9 |
10 | cd $TMPDIR/_xmlsh
11 |
12 | posix:cp f1 f2
13 |
14 | [ -f f1 -a -f f2 ] || echo Fail invalid start condition
15 | posix:rm f1
16 | [ -f f1 ] || echo Success f1 deleted
17 | posix:rm f2
18 | [ -f f2 ]|| echo Success f2 deleted
19 |
20 | cd ..
21 | posix:rm -rf $TMPDIR/_xmlsh
22 |
--------------------------------------------------------------------------------
/xmlsh/test/posix/posix_tee.xsh:
--------------------------------------------------------------------------------
1 | # test of tee
2 | [ -d $TMPDIR/_xmlsh ] && rm -rf $TMPDIR/_xmlsh
3 | mkdir $TMPDIR/_xmlsh
4 | tee $TMPDIR/_xmlsh/a.xml $TMPDIR/_xmlsh/b.xml < ../../samples/data/books.xml
5 |
6 | xcmp ../../samples/data/books.xml $TMPDIR/_xmlsh/a.xml || { echo compare failed ; exit 1 ; }
7 |
8 | xcmp ../../samples/data/books.xml $TMPDIR/_xmlsh/b.xml || { echo compare failed ; exit 1 ; }
9 |
10 | rm -rf $TMPDIR/_xmlsh
--------------------------------------------------------------------------------
/xmlsh/test/stax/out/stax_writer1.xsh.xml:
--------------------------------------------------------------------------------
1 | Some Characters
--------------------------------------------------------------------------------
/xmlsh/test/stax/out/stax_writer2.xsh.xml:
--------------------------------------------------------------------------------
1 | Some CharactersThis is CData
--------------------------------------------------------------------------------
/xmlsh/test/stax/out/stax_writer3.xsh.xml:
--------------------------------------------------------------------------------
1 |
2 | spam
3 | Characters
4 |
--------------------------------------------------------------------------------
/xmlsh/test/stax/stax_stax1.xsh:
--------------------------------------------------------------------------------
1 | import commands stax=stax
2 |
3 |
4 | r=stax:newEventReader(../../samples/data/books.xml)
5 |
6 |
7 | while [ stax:hasNext($r) ]
8 | do
9 |
10 | e=stax:nextEvent($r)
11 | type=stax:getEventType($e)
12 | echo event type $type
13 |
14 | case $type in
15 | START_ELEMENT ) echo " " stax:getName($e) ;
16 | if [ stax:getName($e) = "ITEM" ] ; then
17 | a=stax:getAttribute($e "CAT")
18 | xtype $a
19 | echo CAT is a.getValue()
20 | fi
21 | ;;
22 | CHARACTERS ) echo " " stax:getData($e) ;;
23 | esac
24 |
25 | done
26 |
27 | stax:closeReader $r
28 |
29 |
30 |
--------------------------------------------------------------------------------
/xmlsh/test/stax/stax_stax2.xsh:
--------------------------------------------------------------------------------
1 | import commands stax=stax
2 |
3 |
4 | r=stax:newEventReader(../../samples/data/books.xml)
5 |
6 | while [ stax:hasNext($r START_ELEMENT) ]
7 | do
8 |
9 | e=stax:nextEvent($r)
10 | type=stax:getEventType($e)
11 | echo event type $type
12 | echo stax:getName($e)
13 |
14 |
15 | done
16 |
17 |
18 | stax:closeReader $r
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/xmlsh/test/stax/stax_writer1.xsh:
--------------------------------------------------------------------------------
1 | import commands stax=stax
2 |
3 |
4 | w=stax:newStreamWriter()
5 | stax:writeStartDocument $w
6 | stax:writeStartElement $w foo
7 | stax:writeAttribute $w a1 value1
8 | stax:writeCharacters $w "Some Characters"
9 | stax:writeEndElement $w
10 | stax:writeEndDocument $w
11 |
12 |
13 | stax:closeWriter $w
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/xmlsh/test/stax/stax_writer2.xsh:
--------------------------------------------------------------------------------
1 | import commands stax=stax
2 |
3 |
4 |
5 | w=stax:newStreamWriter()
6 | stax:writeStartDocument $w
7 | stax:writeStartElement $w QName( xmlsh http://www.xmlsh.org/test1 test )
8 | stax:writeNamespace $w xmlsh2 http://www.xmlsh.org/test2
9 | stax:writeAttribute $w QName( xmlsh2 http://www.xmlsh.org/test2 a1) value1
10 | stax:writeCharacters $w "Some Characters"
11 | stax:writeComment $w "This is a comment"
12 | stax:writeStartElement $w inner
13 | stax:writeCData $w "This is CData"
14 | stax:writeEndElement $w
15 | stax:writeEndElement $w
16 | stax:writeEndDocument $w
17 |
18 |
19 | stax:closeWriter $w
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/xmlsh/test/stax/stax_writer3.xsh:
--------------------------------------------------------------------------------
1 | # Test stax writing XML values
2 |
3 | import commands stax=stax
4 |
5 |
6 | w=stax:newStreamWriter()
7 | stax:writeStartDocument $w
8 | stax:writeStartElement $w foo
9 | stax:write $w <[ spam ]>
10 | stax:writeStartElement $w test
11 | stax:write $w Characters
12 | stax:writeEndElement $w
13 | stax:writeEndElement $w
14 | stax:writeEndDocument $w
15 |
16 |
17 | stax:closeWriter $w
18 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/out/xs_attribute.xsh.out:
--------------------------------------------------------------------------------
1 | attribute()
2 | bar
3 |
4 |
5 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/out/xs_decimal.xsh.out:
--------------------------------------------------------------------------------
1 | xs:decimal
2 | 25.2
3 | xs:decimal
4 | 2.54
5 | xs:decimal
6 | 0.001
7 | xs:decimal
8 | 1
9 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/out/xs_document.xsh.out:
--------------------------------------------------------------------------------
1 | document-node()
2 |
3 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/out/xs_element.xsh.out:
--------------------------------------------------------------------------------
1 | element()
2 |
3 | bar
4 | Text
5 |
6 | Text
7 | Text
8 | Text
9 |
10 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/out/xs_integer.xsh.out:
--------------------------------------------------------------------------------
1 | xs:integer
2 | 25
3 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/out/xs_string.xsh.out:
--------------------------------------------------------------------------------
1 | xs:string
2 | Hi There
3 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/xs_attribute.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of xs:integer
3 | import commands xs=xs
4 | a=xs:attribute(foo bar)
5 | xtype $a
6 | echo $a
7 | echo <[ element { "elem" } { $a } ]>
8 |
9 | b=xs:attribute( QName( foo http://uri bar ) spam )
10 | echo <[ element { "elem" } { $b } ]>
11 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/xs_decimal.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of xs:integer
3 | # Test of xs:integer
4 |
5 | import commands xs=xs
6 |
7 | d=xs:decimal( 25.2 )
8 | xtype $d
9 | echo $d
10 |
11 | d=xs:decimal( <[ xs:decimal( 2.54 ) ]> )
12 | xtype $d
13 | echo $d
14 |
15 | d=xs:decimal( xs:string(.001) )
16 | xtype $d
17 | echo $d
18 |
19 |
20 | d=xs:decimal( xs:integer(1) )
21 | xtype $d
22 | echo $d
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/xs_document.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of xs:element
3 | import commands xs=xs
4 |
5 | # Simple document with a root element
6 |
7 | d=xs:document( xs:element( root ) )
8 |
9 | xtype $d
10 | xecho $d
11 |
12 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/xs_element.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of xs:element
3 | import commands xs=xs
4 | # Simple element
5 | a=xs:element( foo )
6 | xtype $a
7 | xecho $a
8 |
9 | # Element with text values
10 | b=xs:element( foo bar )
11 | xecho $b
12 |
13 | # Element with namespaces
14 | c=xs:element( QName(foo http://uri bar) xs:attribute( QName( foo http://uri a1 ) value ) Text )
15 | xecho $c
16 |
17 | # Nested element with top level namespace
18 | xecho xs:element( QName(foo http://uri root) $c $c $c )
19 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/xs_integer.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of xs:integer
3 | import commands xs=xs
4 |
5 | int=xs:integer(25)
6 | xtype $int
7 | echo $int
8 |
9 |
--------------------------------------------------------------------------------
/xmlsh/test/xs/xs_string.xsh:
--------------------------------------------------------------------------------
1 | #
2 | # Test of xs:integer
3 | import commands xs=xs
4 | s=xs:string(Hi There)
5 | xtype $s
6 | echo $s
--------------------------------------------------------------------------------
/xmlsh/unix/.gitattributes:
--------------------------------------------------------------------------------
1 | xmlsh eol=lf
2 | xmlshui eol=lf
3 |
--------------------------------------------------------------------------------
/xmlsh/unix/xmlsh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | [ -d "$XMLSH" ] || { echo "xmlsh requires environment variable XMLSH set" 1>&2 ; exit 1 ; }
3 | CP="$XMLSH/bin/*:$XMLSH/lib/*"
4 | [ -z "$XMLSH_JVMOPTS" ] && XMLSH_JVMOPTS="-XX:+UseConcMarkSweepGC -Xmx1024m -Xms256m"
5 | _JVMDEFS=-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
6 | java $_JVMDEFS -cp "$CP" $XMLSH_JVMOPTS org.xmlsh.sh.shell.Shell "$@"
7 |
--------------------------------------------------------------------------------
/xmlsh/unix/xmlshui:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | [ -d "$XMLSH" ] || { echo "xmlsh requires environment variable XMLSH set" 1>&2 ; exit 1 ; }
3 | CP="$XMLSH/bin/*:$XMLSH/lib/*"
4 | [ -z "$XMLSH_JVMOPTS" ] && XMLSH_JVMOPTS="-XX:+UseConcMarkSweepGC -Xmx1024m -Xms256m"
5 | _JVMDEFS=-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
6 | java $_JVMDEFS -cp "$CP" $XMLSH_JVMOPTS org.xmlsh.sh.ui.XShell "$@"
7 |
8 |
--------------------------------------------------------------------------------
/xmlsh/win32/xmlsh.bat:
--------------------------------------------------------------------------------
1 | @setlocal
2 | @echo off
3 | IF NOT DEFINED XMLSH GOTO NOX
4 | SET CP=%XMLSH%\bin\*;%XMLSH%\lib\*
5 | SET _JVMDEFS=-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
6 | IF NOT DEFINED XMLSH_JVMOPTS SET XMLSH_JVMOPTS=-XX:+UseConcMarkSweepGC -Xmx1024m -Xms256m
7 | java %_JVMDEFS% -cp %CP% %XMLSH_JVMOPTS% org.xmlsh.sh.shell.Shell %*
8 | exit /b 0
9 |
10 | :NOX
11 | echo XMLSH not defined
12 | exit /b 1
--------------------------------------------------------------------------------
/xmlsh/win32/xmlshui.bat:
--------------------------------------------------------------------------------
1 | @setlocal
2 | @echo off
3 | IF NOT DEFINED XMLSH GOTO NOX
4 | SET CP=%XMLSH%\bin\*;%XMLSH%\lib\*
5 | SET _JVMDEFS=-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
6 | IF NOT DEFINED XMLSH_JVMOPTS SET XMLSH_JVMOPTS=-XX:+UseConcMarkSweepGC -Xmx1024m -Xms256m
7 | @start javaw %_JVMDEFS% -cp %CP% %XMLSH_JVMOPTS% org.xmlsh.sh.ui.XShell %*
8 | exit /b 0
9 |
10 | :NOX
11 | echo XMLSH not defined
12 | exit /b 1
--------------------------------------------------------------------------------