├── .gitignore ├── README.md ├── build ├── .project ├── build.xml ├── common.xml └── common_ext.xml ├── extensions ├── .gitignore ├── aws │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── .gitignore │ │ └── sf.eclipse.javacc.prefs │ ├── README.txt │ ├── bin │ │ └── module.xml │ ├── build.xml │ ├── license.txt │ ├── notices │ │ ├── aws │ │ │ ├── LICENSE.txt │ │ │ └── NOTICE.txt │ │ ├── commons-codec │ │ │ └── LICENSE.txt │ │ ├── commons-httpclient │ │ │ └── LICENSE.txt │ │ ├── commons-logging │ │ │ ├── LICENSE.txt │ │ │ └── NOTICE.txt │ │ ├── jackson-core-asl │ │ │ └── LICENSE.txt │ │ ├── java-mail │ │ │ └── LICENSE.txt │ │ ├── stax-api │ │ │ └── LICENSE.txt │ │ └── stax-ri │ │ │ └── LICENSE.txt │ ├── src │ │ ├── WEB-INF │ │ │ └── MANIFEST.MF │ │ └── org │ │ │ └── xmlsh │ │ │ └── aws │ │ │ ├── asDescribeGroups.java │ │ │ ├── asExecutePolicy.java │ │ │ ├── asTerminateInstance.java │ │ │ ├── cfnCreateStack.java │ │ │ ├── cfnDescribeStacks.java │ │ │ ├── cfnGetTemplate.java │ │ │ ├── cfnUpdateStack.java │ │ │ ├── cfnValidateTemplate.java │ │ │ ├── commands.xml │ │ │ ├── ddbAttrNameExpr.java │ │ │ ├── ddbAttrNameExprs.java │ │ │ ├── ddbAttrValueExpr.java │ │ │ ├── ddbAttrValueExprs.java │ │ │ ├── ddbAttribute.java │ │ │ ├── ddbAttributes.java │ │ │ ├── ddbCreateTable.java │ │ │ ├── ddbDeleteItem.java │ │ │ ├── ddbDescribeTable.java │ │ │ ├── ddbGetItem.java │ │ │ ├── ddbKey.java │ │ │ ├── ddbListTables.java │ │ │ ├── ddbPutItem.java │ │ │ ├── ddbQuery.java │ │ │ ├── ddbScan.java │ │ │ ├── ddbUpdateItem.java │ │ │ ├── ddbValue.java │ │ │ ├── ddbValues.java │ │ │ ├── ec2AssociateAddress.java │ │ │ ├── ec2AttachVolume.java │ │ │ ├── ec2CopyImage.java │ │ │ ├── ec2CreateImage.java │ │ │ ├── ec2CreateTags.java │ │ │ ├── ec2CreateVolume.java │ │ │ ├── ec2DeleteTags.java │ │ │ ├── ec2DeleteVolumes.java │ │ │ ├── ec2DeregisterImage.java │ │ │ ├── ec2DescribeAddresses.java │ │ │ ├── ec2DescribeImageAttribute.java │ │ │ ├── ec2DescribeImages.java │ │ │ ├── ec2DescribeInstances.java │ │ │ ├── ec2DescribeVolumes.java │ │ │ ├── ec2DisassociateAddress.java │ │ │ ├── ec2ModifyImageAttribute.java │ │ │ ├── ec2RebootInstances.java │ │ │ ├── ec2RunInstances.java │ │ │ ├── ec2StartInstances.java │ │ │ ├── ec2StopInstances.java │ │ │ ├── ec2TerminateInstances.java │ │ │ ├── elbDeregister.java │ │ │ ├── elbList.java │ │ │ ├── elbRegister.java │ │ │ ├── glacierGetJobOutput.java │ │ │ ├── glacierInventoryVault.java │ │ │ ├── glacierListVaults.java │ │ │ ├── glacierPutArchive.java │ │ │ ├── monListMetrics.java │ │ │ ├── monPutData.java │ │ │ ├── s3CreateBucket.java │ │ │ ├── s3Delete.java │ │ │ ├── s3DeleteBucket.java │ │ │ ├── s3GeneratePresignedUrl.java │ │ │ ├── s3GetObjectMetadata.java │ │ │ ├── s3SetObjectAcl.java │ │ │ ├── s3cp.java │ │ │ ├── s3get.java │ │ │ ├── s3ls.java │ │ │ ├── s3put.java │ │ │ ├── sdbCreateDomain.java │ │ │ ├── sdbDeleteAttributes.java │ │ │ ├── sdbDeleteDomain.java │ │ │ ├── sdbGetAttributes.java │ │ │ ├── sdbListDomains.java │ │ │ ├── sdbPutAttributes.java │ │ │ ├── sdbQuery.java │ │ │ ├── snsCreateTopic.java │ │ │ ├── snsDeleteTopic.java │ │ │ ├── snsListSubscriptions.java │ │ │ ├── snsListTopics.java │ │ │ ├── snsPublish.java │ │ │ ├── sqsChangeMessageVisibility.java │ │ │ ├── sqsCreateQueue.java │ │ │ ├── sqsDeleteMessage.java │ │ │ ├── sqsDeleteQueue.java │ │ │ ├── sqsGetQueueAttributes.java │ │ │ ├── sqsListQueues.java │ │ │ ├── sqsReceiveMessages.java │ │ │ ├── sqsSendMessage.java │ │ │ ├── sqsSetQueueAttributes.java │ │ │ └── util │ │ │ ├── AWSASCommand.java │ │ │ ├── AWSCFNCommand.java │ │ │ ├── AWSCommand.java │ │ │ ├── AWSCommandCredentialsProviderChain.java │ │ │ ├── AWSDDBCommand.java │ │ │ ├── AWSEC2Command.java │ │ │ ├── AWSELBCommand.java │ │ │ ├── AWSEnvCredentialsProvider.java │ │ │ ├── AWSGlacierCommand.java │ │ │ ├── AWSMonCommand.java │ │ │ ├── AWSOptionsCredentialsProvider.java │ │ │ ├── AWSS3Command.java │ │ │ ├── AWSSDBCommand.java │ │ │ ├── AWSSNSCommand.java │ │ │ ├── AWSSQSCommand.java │ │ │ ├── AWSUtil.java │ │ │ ├── DDBTypes.java │ │ │ ├── INameAttrExpr.java │ │ │ ├── S3Path.java │ │ │ └── SafeXMLStreamWriter.java │ └── test │ │ ├── init.xsh │ │ ├── run_test.xsh │ │ ├── run_tests.xsh │ │ └── s3 │ │ ├── out │ │ ├── s3_createbucket.xsh.out │ │ ├── s3_put.xsh.out │ │ ├── s3_put2.xsh.xml │ │ └── s3_put3.xsh.out │ │ ├── s3_createbucket.xsh │ │ ├── s3_put.xsh │ │ ├── s3_put2.xsh │ │ └── s3_put3.xsh ├── calabash │ ├── .classpath │ ├── .project │ ├── README.txt │ ├── bin │ │ └── module.xml │ ├── build.xml │ ├── license.txt │ ├── src │ │ └── org │ │ │ └── xmlsh │ │ │ └── calabash │ │ │ ├── commands.xml │ │ │ └── xproc.java │ └── test │ │ ├── _title.xml │ │ ├── runsuite.xsh │ │ ├── runtest.xsh │ │ └── test-suite.xml ├── exist_ext │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── sf.eclipse.javacc.prefs │ ├── README.txt │ ├── bin │ │ └── module.xml │ ├── build.xml │ ├── license.txt │ ├── src │ │ ├── WEB-INF │ │ │ └── MANIFEST.MF │ │ └── org │ │ │ └── xmlsh │ │ │ └── exist │ │ │ ├── commands.xml │ │ │ ├── del.java │ │ │ ├── get.java │ │ │ ├── invoke.java │ │ │ ├── list.xsh │ │ │ ├── put.java │ │ │ ├── query.java │ │ │ ├── resources │ │ │ └── result.xquery │ │ │ └── util │ │ │ ├── ExistCommand.java │ │ │ └── ExistConnection.java │ └── test │ │ ├── core │ │ ├── _err.txt │ │ ├── _out.txt │ │ ├── core_del.xsh │ │ ├── core_get.xsh │ │ ├── core_invoke.xsh │ │ ├── core_put.xsh │ │ ├── core_query.xsh │ │ └── out │ │ │ ├── core_del.xsh.out │ │ │ ├── core_get.xsh.out │ │ │ ├── core_invoke.xsh.out │ │ │ ├── core_put.xsh.out │ │ │ └── core_query.xsh.out │ │ ├── init.xsh │ │ ├── run_test.xsh │ │ └── run_tests.xsh ├── jmx │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── sf.eclipse.javacc.prefs │ ├── README.txt │ ├── bin │ │ └── module.xml │ ├── build.xml │ ├── license.txt │ ├── src │ │ ├── WEB-INF │ │ │ └── MANIFEST.MF │ │ └── org │ │ │ └── xmlsh │ │ │ └── jmx │ │ │ ├── commands.xml │ │ │ ├── list.java │ │ │ ├── listen.java │ │ │ ├── query.java │ │ │ └── util │ │ │ └── JMXCommand.java │ └── test │ │ ├── init.xsh │ │ ├── run_test.xsh │ │ └── run_tests.xsh ├── json │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── sf.eclipse.javacc.prefs │ ├── README.txt │ ├── bin │ │ └── module.xml │ ├── build.xml │ ├── license.txt │ ├── samples │ │ ├── README.txt │ │ ├── books.xml │ │ ├── books.xsd │ │ ├── books1.xsd │ │ ├── books2.xsd │ │ ├── books3.xsd │ │ ├── books4.xsd │ │ ├── books_none.xsd │ │ ├── jxml.xml │ │ ├── jxml_none.xsd │ │ └── jxml_simple.xsd │ ├── schemas │ │ ├── jxml.xsd │ │ └── jxon.xsd │ ├── src │ │ ├── WEB-INF │ │ │ └── MANIFEST.MF │ │ └── org │ │ │ └── xmlsh │ │ │ └── json │ │ │ ├── NoDocXMLEventReader.java │ │ │ ├── commands.xml │ │ │ ├── jcmp.xsh │ │ │ ├── jxon.java │ │ │ ├── patterns │ │ │ ├── common.xquery │ │ │ ├── create_json.xquery │ │ │ ├── create_xml.xquery │ │ │ └── patterns.xml │ │ │ └── xsdcomment.java │ └── test │ │ ├── books │ │ ├── books1.xsh │ │ ├── books1_json.xsh │ │ ├── books2.xsh │ │ ├── books2_json.xsh │ │ ├── books3.xsh │ │ ├── books3_json.xsh │ │ ├── books4.xsh │ │ ├── books4_json.xsh │ │ ├── books_none.xsh │ │ ├── books_none_json.xsh │ │ └── out │ │ │ ├── books1.out │ │ │ ├── books1_json.json │ │ │ ├── books2.out │ │ │ ├── books2_json.json │ │ │ ├── books3.out │ │ │ ├── books3_json.json │ │ │ ├── books4.out │ │ │ ├── books4_json.json │ │ │ ├── books_none.out │ │ │ └── books_none_json.json │ │ ├── jxml │ │ ├── jxml_none.xsh │ │ ├── jxml_none_json.xsh │ │ ├── jxml_simple.xsh │ │ └── out │ │ │ ├── jxml_none.out │ │ │ ├── jxml_none_json.json │ │ │ └── jxml_simple.out │ │ ├── run_test.xsh │ │ └── run_tests.xsh ├── marklogic │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ └── sf.eclipse.javacc.prefs │ ├── README.txt │ ├── bin │ │ └── module.xml │ ├── build.xml │ ├── license.txt │ ├── src │ │ ├── WEB-INF │ │ │ └── MANIFEST.MF │ │ └── org │ │ │ └── xmlsh │ │ │ └── marklogic │ │ │ ├── commands.xml │ │ │ ├── createdir.xsh │ │ │ ├── del.xsh │ │ │ ├── deldir.xsh │ │ │ ├── direxists.xsh │ │ │ ├── documentMoveForest.xsh │ │ │ ├── exists.xsh │ │ │ ├── get.java │ │ │ ├── getPermissions.xsh │ │ │ ├── invoke.java │ │ │ ├── list.xsh │ │ │ ├── listCollections.xsh │ │ │ ├── listdir.xsh │ │ │ ├── ls.xsh │ │ │ ├── mlui.java │ │ │ ├── put.java │ │ │ ├── query.java │ │ │ ├── rename.xsh │ │ │ ├── resources │ │ │ ├── common.xsh │ │ │ ├── document-move-forest.xquery │ │ │ └── rename.xquery │ │ │ ├── restGet.xsh │ │ │ ├── restUri.xsh │ │ │ ├── setPermissions.xsh │ │ │ ├── ui │ │ │ ├── ExplorerOptions.java │ │ │ ├── ExplorerShell.java │ │ │ ├── LazyTreeModel.java │ │ │ ├── LazyTreeNode.java │ │ │ ├── MLCreateDirectoryRequest.java │ │ │ ├── MLDeleteRequest.java │ │ │ ├── MLGetRequest.java │ │ │ ├── MLListDirectoryRequest.java │ │ │ ├── MLMultiRequest.java │ │ │ ├── MLPutRequest.java │ │ │ ├── MLQueryRequest.java │ │ │ ├── MLRequest.java │ │ │ ├── MLRequestThread.java │ │ │ ├── MLTreeModel.java │ │ │ ├── OptionsDialog.java │ │ │ ├── PropertiesDialog.java │ │ │ ├── QueryCache.java │ │ │ ├── TreeTransferHandler.java │ │ │ ├── createDirectory.xquery │ │ │ ├── documentDelete.xquery │ │ │ ├── getPermissions.xquery │ │ │ ├── listDatabases.xquery │ │ │ ├── listDirectory.xquery │ │ │ ├── listDirectoryRecurse.xquery │ │ │ └── listRootDirectory.xquery │ │ │ └── util │ │ │ ├── MLCommand.java │ │ │ └── MLUtil.java │ └── test │ │ ├── core │ │ ├── core_createdir.xsh │ │ ├── core_del.xsh │ │ ├── core_deldir.xsh │ │ ├── core_get-permissions.xsh │ │ ├── core_get.xsh │ │ ├── core_get2.xsh │ │ ├── core_invoke.xsh │ │ ├── core_invoke2.xsh │ │ ├── core_listdir.xsh │ │ ├── core_listdir_ssl.xsh │ │ ├── core_put.xsh │ │ ├── core_put2.xsh │ │ ├── core_put3.xsh │ │ ├── core_put4.xsh │ │ ├── core_put5.xsh │ │ ├── core_put6.xsh │ │ ├── core_put_ssl.xsh │ │ ├── core_query.xsh │ │ ├── core_rename.xsh │ │ ├── core_set-permissions.xsh │ │ └── out │ │ │ ├── core_createdir.xsh.out │ │ │ ├── core_del.xsh.out │ │ │ ├── core_deldir.xsh.out │ │ │ ├── core_get-permissions.xsh.xml │ │ │ ├── core_get.xsh.xml │ │ │ ├── core_get2.xsh.out │ │ │ ├── core_invoke.xsh.out │ │ │ ├── core_invoke2.xsh.xml │ │ │ ├── core_listdir.xsh.out │ │ │ ├── core_listdir_ssl.xsh.out │ │ │ ├── core_put.xsh.out │ │ │ ├── core_put2.xsh.out │ │ │ ├── core_put3.xsh.out │ │ │ ├── core_put4.xsh.out │ │ │ ├── core_put5.xsh.out │ │ │ ├── core_put6.xsh.out │ │ │ ├── core_put_ssl.xsh.out │ │ │ ├── core_query.xsh.out │ │ │ ├── core_rename.xsh.xml │ │ │ └── core_set-permissions.xsh.xml │ │ ├── init.xsh │ │ ├── run_test.xsh │ │ └── run_tests.xsh ├── twitter │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── sf.eclipse.javacc.prefs │ ├── README.txt │ ├── bin │ │ └── module.xml │ ├── build.xml │ ├── license.txt │ ├── src │ │ ├── WEB-INF │ │ │ └── MANIFEST.MF │ │ └── org │ │ │ └── xmlsh │ │ │ └── twitter │ │ │ ├── commands.xml │ │ │ ├── search.java │ │ │ ├── stream.java │ │ │ └── util │ │ │ ├── TwitterCommand.java │ │ │ └── TwitterWriter.java │ └── test │ │ ├── init.xsh │ │ ├── run_test.xsh │ │ └── run_tests.xsh └── xproc │ ├── .classpath │ ├── .project │ ├── bin │ ├── post_xproc.xsh │ ├── results.xml │ ├── runsuite.xsh │ └── runtest.xsh │ ├── schemas │ ├── pipeline-library.xml │ ├── testreport.xml │ ├── testreport.xsd │ ├── xmlsh-test-report.xml │ ├── xproc.dtd │ ├── xproc.xml │ └── xproc_relaxng.xml │ ├── src │ └── org │ │ └── xmlsh │ │ └── xproc │ │ ├── compiler │ │ ├── AbstractData.java │ │ ├── AbstractStep.java │ │ ├── AtomicStep.java │ │ ├── Binding.java │ │ ├── BindingList.java │ │ ├── Catch.java │ │ ├── Choose.java │ │ ├── Data.java │ │ ├── DeclareStep.java │ │ ├── Document.java │ │ ├── Empty.java │ │ ├── Environment.java │ │ ├── ForEach.java │ │ ├── Group.java │ │ ├── Import.java │ │ ├── Inline.java │ │ ├── Input.java │ │ ├── InputList.java │ │ ├── IterationSource.java │ │ ├── Library.java │ │ ├── Log.java │ │ ├── Names.java │ │ ├── Namespace.java │ │ ├── Namespaces.java │ │ ├── Option.java │ │ ├── Otherwise.java │ │ ├── Output.java │ │ ├── OutputContext.java │ │ ├── OutputList.java │ │ ├── OutputOrLog.java │ │ ├── Pipe.java │ │ ├── Pipeline.java │ │ ├── ReadablePort.java │ │ ├── Serialization.java │ │ ├── StaticError.java │ │ ├── SubPipeline.java │ │ ├── Try.java │ │ ├── Variable.java │ │ ├── Viewport.java │ │ ├── When.java │ │ ├── WithOption.java │ │ ├── WithParam.java │ │ ├── XPathContext.java │ │ ├── XPathExpression.java │ │ ├── XProcCompiler.java │ │ ├── XProcUtil.java │ │ └── pipeline-library.xml │ │ ├── steps │ │ ├── add-attribute.xsh │ │ ├── add-xml-base.xsh │ │ ├── delete.xsh │ │ ├── escape-markup.xsh │ │ ├── identity.xsh │ │ └── string-replace.xsh │ │ ├── test │ │ └── Test.java │ │ ├── util │ │ ├── XPathFunctions.java │ │ └── XProcException.java │ │ ├── xproc.xsh │ │ └── xproc2xmlsh.java │ └── test-suite.xml └── xmlsh ├── .classpath ├── .gitignore ├── .project ├── .settings └── org.eclipse.core.resources.prefs ├── .xmlshrc ├── README.txt ├── build-lib └── README.txt ├── build.xml ├── cygwin ├── .gitattributes ├── xmlsh └── xmlshui ├── javadoc.xml ├── lib └── Libraries.txt ├── license.txt ├── notices ├── Notices.txt ├── httpclient │ ├── LICENSE.txt │ ├── NOTICE.txt │ └── README.txt ├── jing │ └── copying.html ├── jline │ └── LICENSE.txt ├── json │ └── License.txt ├── jsonpath │ └── LICENSE ├── log4j │ └── LICENSE.txt ├── saxon │ ├── APACHE.txt │ ├── CERN.txt │ ├── FRIJTERS.txt │ ├── JAMESCLARK.txt │ ├── LICENSE.txt │ ├── THAI.txt │ └── UNICODE.txt ├── stax-utils │ ├── COPYRIGHT.TXT │ └── LICENSE ├── woodstox │ ├── LICENSE │ └── NOTICE ├── xerces │ ├── LICENSE │ └── NOTICE ├── xmlsh │ └── license.txt └── xom │ └── LICENSE.txt ├── samples ├── README.txt ├── data │ ├── REC-xml-20060816.xml │ ├── REC-xml.xsl │ ├── books.csv │ ├── books.dtd │ ├── books.json │ ├── books.jxml │ ├── books.mysql │ ├── books.rng │ ├── books.sch │ ├── books.xml │ ├── books.xsd │ ├── diffspec.xsl │ ├── employee.txt │ ├── intl.xml │ ├── log.json │ ├── othello.xml │ ├── play.dtd │ ├── xi_doc1.xml │ ├── xi_sub1.xml │ ├── xml-base-chap.xml │ ├── xml-base-test.xml │ ├── xmlspec.dtd │ └── xmlspec.xsl ├── demo │ ├── demo.bat │ ├── demo.sh │ ├── demo.xsh │ ├── interest │ │ ├── menu.xml │ │ ├── seq_elem.xsh │ │ ├── seq_num.xsh │ │ ├── xml_here.xsh │ │ └── xml_math.xsh │ ├── menu.xml │ ├── tools │ │ ├── index.xml │ │ ├── menu.xml │ │ ├── tool_pipe.xsh │ │ ├── tool_xpath.xsh │ │ ├── tool_xquery.xsh │ │ └── tool_xslt.xsh │ ├── unix │ │ ├── menu.xml │ │ ├── unix_case.xsh │ │ ├── unix_for.xsh │ │ ├── unix_if.xsh │ │ ├── unix_string.xsh │ │ └── unix_while.xsh │ └── xml │ │ ├── menu.xml │ │ ├── xml_doc.xsh │ │ ├── xml_elem.xsh │ │ ├── xml_here.xsh │ │ └── xml_proc.xsh ├── query │ ├── books-to-html.xquery │ ├── books.xquery │ └── tour.xquery └── styles │ ├── bible.xsl │ ├── books-csv.xsl │ ├── books-sa.xsl │ ├── books-sql.xsl │ ├── books-tle.xsl │ ├── books.xsl │ ├── compare.xsl │ ├── identity.xsl │ ├── play.xsl │ ├── total.xsl │ └── tour.xsl ├── schemas ├── jxml.xsd ├── module.rnc └── xsh_types.xsd ├── src ├── 3rdparty │ └── org │ │ └── json │ │ ├── JSONArray.java │ │ ├── JSONException.java │ │ ├── JSONObject.java │ │ ├── JSONString.java │ │ ├── JSONStringer.java │ │ ├── JSONTokener.java │ │ └── JSONWriter.java ├── WEB-INF │ └── MANIFEST.MF ├── commands │ └── org │ │ └── xmlsh │ │ ├── commands │ │ ├── builtin │ │ │ ├── colon.java │ │ │ ├── declare.java │ │ │ ├── echo.java │ │ │ ├── eval.java │ │ │ ├── exit.java │ │ │ ├── jobs.java │ │ │ ├── jset.java │ │ │ ├── jsonread.java │ │ │ ├── log.java │ │ │ ├── printvar.java │ │ │ ├── read.java │ │ │ ├── require.java │ │ │ ├── set.java │ │ │ ├── shift.java │ │ │ ├── source.java │ │ │ ├── test.java │ │ │ ├── tie.java │ │ │ ├── trap.java │ │ │ ├── unset.java │ │ │ ├── wait.java │ │ │ ├── xbreak.java │ │ │ ├── xcd.java │ │ │ ├── xcontinue.java │ │ │ ├── xecho.java │ │ │ ├── xfalse.java │ │ │ ├── ximport.java │ │ │ ├── xmkpipe.java │ │ │ ├── xmlsh.java │ │ │ ├── xmlshui.java │ │ │ ├── xread.java │ │ │ ├── xthrow.java │ │ │ ├── xtrue.java │ │ │ ├── xtype.java │ │ │ ├── xversion.java │ │ │ └── xwhich.java │ │ ├── experimental │ │ │ ├── commands.xml │ │ │ ├── tagsoup.xsh │ │ │ ├── xobsufcate.java │ │ │ └── xsysinfo.java │ │ ├── internal │ │ │ ├── QName.java │ │ │ ├── csv2xml.java │ │ │ ├── fixed2xml.java │ │ │ ├── help.java │ │ │ ├── http.java │ │ │ ├── httpserver.java │ │ │ ├── httpsession.java │ │ │ ├── jcall.java │ │ │ ├── jnew.java │ │ │ ├── json2xml.java │ │ │ ├── jsoncat.xsh │ │ │ ├── jsonpath.java │ │ │ ├── quote.java │ │ │ ├── rngconvert.java │ │ │ ├── rngvalidate.java │ │ │ ├── schematron.xsh │ │ │ ├── time.xsh │ │ │ ├── validate.java │ │ │ ├── xaddattribute.xsh │ │ │ ├── xaddbase.java │ │ │ ├── xbase.java │ │ │ ├── xcat.java │ │ │ ├── xcmp.java │ │ │ ├── xdelattribute.java │ │ │ ├── xdelete.xsh │ │ │ ├── xed.java │ │ │ ├── xfile.java │ │ │ ├── xgetopts.java │ │ │ ├── xgrep.xsh │ │ │ ├── xgunzip.java │ │ │ ├── xgzip.java │ │ │ ├── xidentity.java │ │ │ ├── xinclude.java │ │ │ ├── xlocation.java │ │ │ ├── xls.java │ │ │ ├── xmd5sum.java │ │ │ ├── xml2csv.java │ │ │ ├── xml2json.java │ │ │ ├── xmove.java │ │ │ ├── xpath.java │ │ │ ├── xproperties.java │ │ │ ├── xpwd.java │ │ │ ├── xquery.java │ │ │ ├── xquote.java │ │ │ ├── xsdvalidate.java │ │ │ ├── xslt.java │ │ │ ├── xslt1.java │ │ │ ├── xsplit.java │ │ │ ├── xsql.java │ │ │ ├── xstacktrace.java │ │ │ ├── xtee.java │ │ │ ├── xunquote.java │ │ │ ├── xunzip.java │ │ │ ├── xuri.java │ │ │ ├── xurldecode.java │ │ │ ├── xurlencode.java │ │ │ ├── xvalidate.java │ │ │ ├── xwc.java │ │ │ └── xzip.java │ │ ├── json │ │ │ ├── _boolean.java │ │ │ ├── _null.java │ │ │ ├── array.java │ │ │ ├── commands.xml │ │ │ ├── json.java │ │ │ ├── number.java │ │ │ ├── object.java │ │ │ ├── path.java │ │ │ ├── string.java │ │ │ └── value.java │ │ ├── posix │ │ │ ├── base64.java │ │ │ ├── cat.java │ │ │ ├── chmod.java │ │ │ ├── commands.xml │ │ │ ├── cp.java │ │ │ ├── ls.java │ │ │ ├── mkdir.java │ │ │ ├── mktemp.java │ │ │ ├── more.java │ │ │ ├── mv.java │ │ │ ├── pwd.xsh │ │ │ ├── rm.java │ │ │ ├── rmdir.java │ │ │ ├── sleep.java │ │ │ ├── tee.java │ │ │ ├── touch.java │ │ │ └── wc.java │ │ ├── stax │ │ │ ├── closeReader.java │ │ │ ├── closeWriter.java │ │ │ ├── commands.xml │ │ │ ├── getAttribute.java │ │ │ ├── getData.java │ │ │ ├── getEventType.java │ │ │ ├── getName.java │ │ │ ├── getNamespace.java │ │ │ ├── hasNext.java │ │ │ ├── newEventReader.java │ │ │ ├── newStreamWriter.java │ │ │ ├── nextEvent.java │ │ │ ├── write.java │ │ │ ├── writeAttribute.java │ │ │ ├── writeCData.java │ │ │ ├── writeCharacters.java │ │ │ ├── writeComment.java │ │ │ ├── writeDefaultNamespace.java │ │ │ ├── writeEndDocument.java │ │ │ ├── writeEndElement.java │ │ │ ├── writeNamespace.java │ │ │ ├── writeStartDocument.java │ │ │ └── writeStartElement.java │ │ ├── string │ │ │ ├── concat.java │ │ │ ├── contains.java │ │ │ ├── endsWith.java │ │ │ ├── isBlank.java │ │ │ ├── isEmpty.java │ │ │ ├── isEqual.java │ │ │ ├── isOneOf.java │ │ │ ├── join.java │ │ │ ├── length.java │ │ │ ├── matches.java │ │ │ ├── replace.java │ │ │ ├── startsWith.java │ │ │ ├── substring.java │ │ │ ├── substringAfter.java │ │ │ ├── substringBefore.java │ │ │ ├── tokenize.java │ │ │ └── trim.java │ │ ├── test │ │ │ └── xevent.java │ │ ├── util │ │ │ ├── CSVFormatter.java │ │ │ ├── CSVParser.java │ │ │ ├── CSVRecord.java │ │ │ ├── Checksum.java │ │ │ └── FixedParser.java │ │ └── xs │ │ │ ├── attribute.java │ │ │ ├── commands.xml │ │ │ ├── decimal.java │ │ │ ├── document.java │ │ │ ├── element.java │ │ │ ├── integer.java │ │ │ └── string.java │ │ └── resources │ │ ├── help │ │ ├── commands.xml │ │ ├── commands.xquery │ │ ├── help.xquery │ │ └── usage.xquery │ │ └── schematron │ │ ├── iso_abstract_expand.xsl │ │ ├── iso_dsdl_include.xsl │ │ ├── iso_schematron_message_xslt2.xsl │ │ ├── iso_schematron_skeleton_for_saxon.xsl │ │ └── iso_svrl_for_xslt2.xsl ├── core │ └── org │ │ └── xmlsh │ │ ├── annotations │ │ ├── Command.java │ │ └── Options.java │ │ ├── core │ │ ├── AbstractCommand.java │ │ ├── AbstractXdmItemOutputStream.java │ │ ├── BuiltinCommand.java │ │ ├── BuiltinFunctionCommand.java │ │ ├── CommandFactory.java │ │ ├── CoreException.java │ │ ├── DestinationXdmValueOutputStream.java │ │ ├── ExitOnErrorException.java │ │ ├── ExternalCommand.java │ │ ├── FileInputPort.java │ │ ├── FileOutputPort.java │ │ ├── FunctionCommand.java │ │ ├── ICommand.java │ │ ├── IFunction.java │ │ ├── IPort.java │ │ ├── IXValueInputStream.java │ │ ├── IXValueOutputStream.java │ │ ├── IXdmItemInputStream.java │ │ ├── IXdmItemOutputStream.java │ │ ├── IXdmItemReader.java │ │ ├── IXdmItemWriter.java │ │ ├── InputPort.java │ │ ├── InvalidArgumentException.java │ │ ├── NamedPort.java │ │ ├── Namespaces.java │ │ ├── OmittingXMLEventWriter.java │ │ ├── OmittingXMLStreamWriter.java │ │ ├── Options.java │ │ ├── OutputPort.java │ │ ├── Path.java │ │ ├── PortList.java │ │ ├── ScriptCommand.java │ │ ├── ScriptFunctionCommand.java │ │ ├── StreamInputPort.java │ │ ├── StreamOutputPort.java │ │ ├── ThrowException.java │ │ ├── UnexpectedException.java │ │ ├── UnimplementedException.java │ │ ├── UnknownOption.java │ │ ├── ValueXdmItemInputStream.java │ │ ├── VariableInputPort.java │ │ ├── VariableOutputPort.java │ │ ├── Variables.java │ │ ├── XClassLoader.java │ │ ├── XCommand.java │ │ ├── XDynamicVariable.java │ │ ├── XEnvironment.java │ │ ├── XIOEnvironment.java │ │ ├── XMLEventInputPort.java │ │ ├── XMLEventOutputPort.java │ │ ├── XValue.java │ │ ├── XValueVariableResolver.java │ │ ├── XVariable.java │ │ ├── XdmItemPipe.java │ │ ├── XdmItemSubsequence.java │ │ ├── XdmStreamInputPort.java │ │ └── XdmStreamOutputPort.java │ │ ├── schema │ │ └── Schema.java │ │ ├── types │ │ ├── XFile.java │ │ └── XSerializable.java │ │ ├── util │ │ ├── AutoReleasePool.java │ │ ├── Base64.java │ │ ├── Base64Coder.java │ │ ├── DTDValidator.java │ │ ├── HelpUsage.java │ │ ├── IManagedObject.java │ │ ├── JavaUtils.java │ │ ├── JsonUtils.java │ │ ├── ManagedObject.java │ │ ├── MutableInteger.java │ │ ├── NameValue.java │ │ ├── NameValueList.java │ │ ├── NameValueMap.java │ │ ├── NullInputStream.java │ │ ├── NullOutputStream.java │ │ ├── PipedPort.java │ │ ├── PipedStreamPort.java │ │ ├── PipedXDMPort.java │ │ ├── PipedXEventPort.java │ │ ├── PortCopier.java │ │ ├── S9Util.java │ │ ├── SessionEnvironment.java │ │ ├── StAXUtils.java │ │ ├── StreamCopier.java │ │ ├── StringPair.java │ │ ├── SynchronizedInputStream.java │ │ ├── SynchronizedOutputStream.java │ │ ├── Util.java │ │ ├── XMLEventInputStream.java │ │ ├── XMLEventStreamReader.java │ │ ├── XMLEventWriterBuffer.java │ │ ├── XMLEventWriterToContentHandler.java │ │ ├── XMLException.java │ │ ├── XMLStreamWriterToContentHandler.java │ │ └── XSDValidator.java │ │ └── xpath │ │ ├── EvalDefinition.java │ │ ├── EvalFunctionCall.java │ │ └── ShellContext.java ├── generated │ └── org │ │ └── xmlsh │ │ └── sh │ │ └── grammar │ │ └── .gitignore └── shell │ └── org │ └── xmlsh │ ├── ant │ └── XmlshTask.java │ ├── protocols │ ├── port │ │ ├── Handler.java │ │ └── PortURLConnection.java │ └── var │ │ ├── Handler.java │ │ └── VarURLConnection.java │ ├── resources │ └── modules │ │ └── functx.xquery │ ├── servlet │ ├── ManagedHttpSession.java │ └── XmlshServlet.java │ └── sh │ ├── core │ ├── AndOr.java │ ├── Assign.java │ ├── BinaryOpCommand.java │ ├── BraceGroup.java │ ├── CaseClause.java │ ├── CaseItem.java │ ├── CaseList.java │ ├── Command.java │ ├── CommandFileWord.java │ ├── CommandList.java │ ├── CommandPrefix.java │ ├── CommandSuffix.java │ ├── CommandWord.java │ ├── CompoundCommand.java │ ├── EvalScriptCommand.java │ ├── ForClause.java │ ├── FunctionCallWord.java │ ├── FunctionDeclaration.java │ ├── IOFile.java │ ├── IOHere.java │ ├── IORedirect.java │ ├── IORedirectList.java │ ├── IfClause.java │ ├── MethodCallWord.java │ ├── NullCommand.java │ ├── Pipeline.java │ ├── ReturnStatement.java │ ├── SimpleCommand.java │ ├── SourceLocation.java │ ├── StringList.java │ ├── StringWord.java │ ├── SubShell.java │ ├── TryCatchFinally.java │ ├── UntilClause.java │ ├── WhileClause.java │ ├── Word.java │ └── WordList.java │ ├── grammar │ ├── ShellParser.jj │ └── ShellParserReader.java │ ├── shell │ ├── .gitignore │ ├── ControlLoop.java │ ├── Expander.java │ ├── FunctionDefinitions.java │ ├── Logging.java │ ├── Module.java │ ├── Modules.java │ ├── SerializeOpts.java │ ├── Shell.java │ ├── ShellModuleURIResolver.java │ ├── ShellOpts.java │ ├── ShellThread.java │ ├── ShellURIResolver.java │ ├── ShellURLFactory.java │ ├── SystemEnvironment.java │ ├── SystemProperties.java │ ├── Version.java │ ├── XmlshErrorListener.java │ ├── XmlshSerializerFactory.java │ └── XmlshXMLIndenter.java │ └── ui │ ├── LogFrame.java │ ├── ShellAppender.java │ ├── ShellThread.java │ ├── TextAreaOutputStream.java │ ├── TextAreaPopupMenu.java │ └── XShell.java ├── test ├── ant │ ├── build.xml │ └── test.xsh ├── builtin │ ├── builtin_colon.xsh │ ├── builtin_echo.xsh │ ├── builtin_eval.xsh │ ├── builtin_exit.xsh │ ├── builtin_jset.xsh │ ├── builtin_jsonread.xsh │ ├── builtin_log.xsh │ ├── builtin_read.xsh │ ├── builtin_require.xsh │ ├── builtin_set.xsh │ ├── builtin_shift.xsh │ ├── builtin_source.xsh │ ├── builtin_test.xsh │ ├── builtin_xecho.xsh │ ├── builtin_xmkpipe.xsh │ ├── builtin_xmlsh.xsh │ ├── builtin_xread.xsh │ ├── builtin_xtype.xsh │ ├── builtin_xwhich.xsh │ └── out │ │ ├── builtin_colon.xsh.out │ │ ├── builtin_echo.xsh.out │ │ ├── builtin_eval.xsh.out │ │ ├── builtin_exit.xsh.out │ │ ├── builtin_jset.xsh.out │ │ ├── builtin_jsonread.xsh.out │ │ ├── builtin_log.xsh.out │ │ ├── builtin_read.xsh.out │ │ ├── builtin_require.xsh.err │ │ ├── builtin_require.xsh.out │ │ ├── builtin_set.xsh.out │ │ ├── builtin_shift.xsh.out │ │ ├── builtin_source.xsh.out │ │ ├── builtin_test.xsh.err │ │ ├── builtin_test.xsh.out │ │ ├── builtin_xecho.xsh.out │ │ ├── builtin_xmkpipe.xsh.out │ │ ├── builtin_xmlsh.xsh.out │ │ ├── builtin_xread.xsh.out │ │ ├── builtin_xtype.xsh.out │ │ └── builtin_xwhich.xsh.out ├── core │ ├── core_andor.xsh │ ├── core_args.xsh │ ├── core_array.xsh │ ├── core_brace.xsh │ ├── core_brace2.xsh │ ├── core_case.xsh │ ├── core_case2.xsh │ ├── core_case3.xsh │ ├── core_exfunctions.xsh │ ├── core_expandsub.xsh │ ├── core_for.xsh │ ├── core_for2.xsh │ ├── core_for3.xsh │ ├── core_function.xsh │ ├── core_function2.xsh │ ├── core_function3.xsh │ ├── core_here.xsh │ ├── core_here2.xsh │ ├── core_if.xsh │ ├── core_if2.xsh │ ├── core_iffor.xsh │ ├── core_io.xsh │ ├── core_namespaces.xsh │ ├── core_nest.xsh │ ├── core_ports.xsh │ ├── core_quotes.xsh │ ├── core_random.xsh │ ├── core_seqass.xsh │ ├── core_serialize.xsh │ ├── core_subshell.xsh │ ├── core_subshell2.xsh │ ├── core_throwerror1.xsh │ ├── core_throwerror2.xsh │ ├── core_tie.xsh │ ├── core_try1.xsh │ ├── core_try2.xsh │ ├── core_try3.xsh │ ├── core_unicode.xsh │ ├── core_vars.xsh │ ├── core_vars2.xsh │ ├── core_varseq.xsh │ ├── core_while.xsh │ ├── core_xexpr.xsh │ ├── core_xpipe.xsh │ └── out │ │ ├── core_andor.xsh.out │ │ ├── core_args.xsh.out │ │ ├── core_array.xsh.out │ │ ├── core_brace.xsh.out │ │ ├── core_brace2.xsh.out │ │ ├── core_case.xsh.out │ │ ├── core_case2.xsh.out │ │ ├── core_case3.xsh.out │ │ ├── core_exfunctions.xsh.out │ │ ├── core_expandsub.xsh.out │ │ ├── core_for.xsh.out │ │ ├── core_for2.xsh.out │ │ ├── core_for3.xsh.out │ │ ├── core_function.xsh.out │ │ ├── core_function2.xsh.out │ │ ├── core_function3.xsh.out │ │ ├── core_here.xsh.out │ │ ├── core_here2.xsh.out │ │ ├── core_if.xsh.out │ │ ├── core_if2.xsh.out │ │ ├── core_iffor.xsh.out │ │ ├── core_io.xsh.out │ │ ├── core_namespaces.xsh.out │ │ ├── core_nest.xsh.out │ │ ├── core_ports.xsh.out │ │ ├── core_quotes.xsh.out │ │ ├── core_random.xsh.out │ │ ├── core_seqass.xsh.out │ │ ├── core_serialize.xsh.out │ │ ├── core_subshell.xsh.out │ │ ├── core_subshell2.xsh.out │ │ ├── core_throwerror1.xsh.out │ │ ├── core_throwerror2.xsh.out │ │ ├── core_tie.xsh.out │ │ ├── core_try1.xsh.out │ │ ├── core_try2.xsh.out │ │ ├── core_try3.xsh.out │ │ ├── core_unicode.xsh.out │ │ ├── core_vars.xsh │ │ ├── core_vars.xsh.out │ │ ├── core_vars2.xsh.err │ │ ├── core_vars2.xsh.out │ │ ├── core_varseq.xsh.out │ │ ├── core_while.xsh.out │ │ ├── core_xexpr.xsh.out │ │ └── core_xpipe.xsh.out ├── extra │ ├── out │ │ ├── xsql_csvjdbc.xsh.xml │ │ ├── xsql_mysql.xsh.xml │ │ ├── xsql_mysql2.xsh.xml │ │ ├── xsql_sqlite.xsh.xml │ │ ├── xsql_sqlite2.xsh.xml │ │ └── xsql_sqlite3.xsh.xml │ ├── xsql_csvjdbc.xsh │ ├── xsql_mysql.xsh │ ├── xsql_mysql2.xsh │ ├── xsql_sqlite.xsh │ ├── xsql_sqlite2.xsh │ └── xsql_sqlite3.xsh ├── internal │ ├── internal_csv2xml.xsh │ ├── internal_csv2xml2.xsh │ ├── internal_csv2xml3.xsh │ ├── internal_csv2xml4.xsh │ ├── internal_fixed2xml.xsh │ ├── internal_jcall.xsh │ ├── internal_jset.xsh │ ├── internal_json2xml.xsh │ ├── internal_jsonpath.xsh │ ├── internal_qname.xsh │ ├── internal_quote.xsh │ ├── internal_rngvalidate.xsh │ ├── internal_schematron.xsh │ ├── internal_time.xsh │ ├── internal_xaddbase.xsh │ ├── internal_xbase.xsh │ ├── internal_xcat.xsh │ ├── internal_xcmp.xsh │ ├── internal_xdelattribute.xsh │ ├── internal_xdelattribute2.xsh │ ├── internal_xed.xsh │ ├── internal_xfile.xsh │ ├── internal_xgetopts.xsh │ ├── internal_xgetopts2.xsh │ ├── internal_xgrep1.xsh │ ├── internal_xgrep2.xsh │ ├── internal_xgrep3.xsh │ ├── internal_xidentity.xsh │ ├── internal_xinclude.xsh │ ├── internal_xls.xsh │ ├── internal_xmd5sum.xsh │ ├── internal_xmd5sum2.xsh │ ├── internal_xml2csv.xsh │ ├── internal_xml2csv2.xsh │ ├── internal_xml2json.xsh │ ├── internal_xmove.xsh │ ├── internal_xpath.xsh │ ├── internal_xproperties.xsh │ ├── internal_xpwd.xsh │ ├── internal_xquery.xsh │ ├── internal_xquote.xsh │ ├── internal_xsdvalidate.xsh │ ├── internal_xslt.xsh │ ├── internal_xslt1.xsh │ ├── internal_xsplit.xsh │ ├── internal_xsplit2.xsh │ ├── internal_xsplit3.xsh │ ├── internal_xtee.xsh │ ├── internal_xunquote.xsh │ ├── internal_xuri.xsh │ ├── internal_xurlencode.xsh │ ├── internal_xvalidate.xsh │ └── out │ │ ├── internal_csv2xml.xsh.xml │ │ ├── internal_csv2xml2.xsh.xml │ │ ├── internal_csv2xml3.xsh.xml │ │ ├── internal_csv2xml4.xsh.xml │ │ ├── internal_fixed2xml.xsh.xml │ │ ├── internal_jcall.xsh.out │ │ ├── internal_jset.xsh.out │ │ ├── internal_json2xml.xsh.out │ │ ├── internal_json2xml.xsh.xml │ │ ├── internal_jsonpath.xsh.out │ │ ├── internal_qname.xsh.out │ │ ├── internal_quote.xsh.out │ │ ├── internal_rngvalidate.xsh.out │ │ ├── internal_schematron.xsh.out │ │ ├── internal_time.xsh.out │ │ ├── internal_xaddbase.xsh.out │ │ ├── internal_xbase.xsh.out │ │ ├── internal_xcat.xsh.out │ │ ├── internal_xcmp.xsh.out │ │ ├── internal_xdelattribute.xsh.xml │ │ ├── internal_xdelattribute2.xsh.xml │ │ ├── internal_xed.xsh.out │ │ ├── internal_xfile.xsh.out │ │ ├── internal_xgetopts.xsh.xml │ │ ├── internal_xgetopts2.xsh.out │ │ ├── internal_xgrep1.xsh.xml │ │ ├── internal_xgrep2.xsh.out │ │ ├── internal_xgrep3.xsh.xml │ │ ├── internal_xidentity.xsh.xml │ │ ├── internal_xinclude.xsh.xml │ │ ├── internal_xls.xsh.out │ │ ├── internal_xmd5sum.xsh.xml │ │ ├── internal_xmd5sum2.xsh.xml │ │ ├── internal_xml2csv.xsh.out │ │ ├── internal_xml2csv2.xsh.out │ │ ├── internal_xml2json.xsh.out │ │ ├── internal_xmove.xsh.xml │ │ ├── internal_xpath.xsh.out │ │ ├── internal_xproperties.xsh.xml │ │ ├── internal_xpwd.xsh.out │ │ ├── internal_xquery.xsh.out │ │ ├── internal_xquote.xsh.out │ │ ├── internal_xsdvalidate.xsh.out │ │ ├── internal_xslt.xsh.out │ │ ├── internal_xslt1.xsh.xml │ │ ├── internal_xsplit.xsh.out │ │ ├── internal_xsplit2.xsh.out │ │ ├── internal_xsplit3.xsh.out │ │ ├── internal_xtee.xsh.xml │ │ ├── internal_xunquote.xsh.out │ │ ├── internal_xuri.xsh.out │ │ ├── internal_xurlencode.xsh.out │ │ └── internal_xvalidate.xsh.out ├── java │ ├── java_jnew.xsh │ ├── java_types.xsh │ └── out │ │ ├── java_jnew.xsh.out │ │ └── java_types.xsh.out ├── json │ ├── json_array.xsh │ ├── json_boolean.xsh │ ├── json_json.xsh │ ├── json_null.xsh │ ├── json_number.xsh │ ├── json_object.xsh │ ├── json_path.xsh │ ├── json_path2.xsh │ ├── json_value.xsh │ └── out │ │ ├── json_array.xsh.out │ │ ├── json_boolean.xsh.out │ │ ├── json_json.xsh.out │ │ ├── json_null.xsh.out │ │ ├── json_number.xsh.out │ │ ├── json_object.xsh.out │ │ ├── json_path.xsh.out │ │ ├── json_path2.xsh.xml │ │ └── json_value.xsh.out ├── posix │ ├── out │ │ ├── posix_base64.xsh.out │ │ ├── posix_cat.xsh.out │ │ ├── posix_cp.xsh.out │ │ ├── posix_cp2.xsh.out │ │ ├── posix_mkdir.xsh.out │ │ ├── posix_mv.xsh.out │ │ ├── posix_rm.xsh.out │ │ └── posix_tee.xsh.xml │ ├── posix_base64.xsh │ ├── posix_cat.xsh │ ├── posix_cp.xsh │ ├── posix_cp2.xsh │ ├── posix_mkdir.xsh │ ├── posix_mv.xsh │ ├── posix_rm.xsh │ └── posix_tee.xsh ├── run_test.xsh ├── run_tests.xsh ├── src │ ├── build.xml │ └── org │ │ └── xmlsh │ │ └── test │ │ └── TestTypes.java ├── stax │ ├── out │ │ ├── stax_stax1.xsh.out │ │ ├── stax_stax2.xsh.out │ │ ├── stax_writer1.xsh.xml │ │ ├── stax_writer2.xsh.xml │ │ └── stax_writer3.xsh.xml │ ├── stax_stax1.xsh │ ├── stax_stax2.xsh │ ├── stax_writer1.xsh │ ├── stax_writer2.xsh │ └── stax_writer3.xsh └── xs │ ├── out │ ├── xs_attribute.xsh.out │ ├── xs_decimal.xsh.out │ ├── xs_document.xsh.out │ ├── xs_element.xsh.out │ ├── xs_integer.xsh.out │ └── xs_string.xsh.out │ ├── xs_attribute.xsh │ ├── xs_decimal.xsh │ ├── xs_document.xsh │ ├── xs_element.xsh │ ├── xs_integer.xsh │ └── xs_string.xsh ├── unix ├── .gitattributes ├── xmlsh └── xmlshui └── win32 ├── xmlsh.bat └── xmlshui.bat /.gitignore: -------------------------------------------------------------------------------- 1 | _out/ 2 | *.class 3 | *.jar 4 | *.bak 5 | _dist/ 6 | *.war 7 | *.tmp/ 8 | test/_out.txt 9 | test/_err.txt 10 | /eclipse_settings 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # xmlsh1_3 2 | A command line shell for XML - Stable release of the 1.3 branch 3 | 4 | This GitHub project hosts the latest stable release of the xmlsh project. 5 | In development, but not ready for producion, is xmlsh 2.0 "A command line shell for the new N(ot)O(nly) XML generation" 6 | https://github.com/DALDEI/xmlsh 7 | 8 | 9 | See the project web stite at http://www.xmlsh.org for documentation and details 10 | 11 | * Binaries for the latest 1.3.x release (1.3.1) go to http://xmlsh-org-downloads.s3-website-us-east-1.amazonaws.com/archives/release-1_3_1/ 12 | -------------------------------------------------------------------------------- /build/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | build 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /build/common_ext.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /extensions/.gitignore: -------------------------------------------------------------------------------- 1 | /_out/ 2 | -------------------------------------------------------------------------------- /extensions/aws/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /extensions/aws/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | aws_ext 4 | JavaCC Nature 5 | 6 | 7 | 8 | 9 | sf.eclipse.javacc.javaccbuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | sf.eclipse.javacc.javaccnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /extensions/aws/.settings/.gitignore: -------------------------------------------------------------------------------- 1 | *.eclipse.ltk.core.refactoring.prefs 2 | -------------------------------------------------------------------------------- /extensions/aws/.settings/sf.eclipse.javacc.prefs: -------------------------------------------------------------------------------- 1 | CLEAR_CONSOLE=true 2 | JAVACC_OPTIONS= 3 | JJDOC_OPTIONS= 4 | JJTREE_OPTIONS= 5 | JJ_NATURE=true 6 | JTB_OPTIONS=-ia -jd -tk 7 | KEEP_DEL_FILES_IN_HISTORY=false 8 | MARK_GEN_FILES_AS_DERIVED=true 9 | RUNTIME_JAR= 10 | RUNTIME_JJJAR= 11 | RUNTIME_JTBJAR= 12 | RUNTIME_JVMOPTIONS= 13 | SHOW_CONSOLE=true 14 | SUPPRESS_WARNINGS=false 15 | eclipse.preferences.version=1 16 | -------------------------------------------------------------------------------- /extensions/aws/README.txt: -------------------------------------------------------------------------------- 1 | This is an extension module to xmlsh 2 | This version requires xmlsh version 1.2.3 or greater 3 | 4 | To run this module you must include the supplied aws_ext.jar 5 | as well as the libraries in the lib directory of this extension module. 6 | 7 | 8 | 9 | 10 | Installation and getting started instructions for XMLSH are available at 11 | 12 | http://www.xmlsh.org 13 | 14 | The "Quick Start" has directions on how to get up and running 15 | 16 | http://www.xmlsh.org/QuickStart 17 | 18 | -------------------------------------------------------------------------------- /extensions/aws/bin/module.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /extensions/aws/notices/aws/NOTICE.txt: -------------------------------------------------------------------------------- 1 | AWS SDK for Java 2 | Copyright 2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | 4 | This product includes software developed by 5 | Amazon Technologies, Inc (http://www.amazon.com/). 6 | 7 | ********************** 8 | THIRD PARTY COMPONENTS 9 | ********************** 10 | This software includes third party software subject to the following copyrights: 11 | - XML parsing and utility functions from JetS3t - Copyright 2006-2009 James Murty. 12 | - JSON parsing and utility functions from JSON.org - Copyright 2002 JSON.org. 13 | 14 | The licenses for these third party components are included in LICENSE.txt 15 | -------------------------------------------------------------------------------- /extensions/aws/notices/commons-logging/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Commons Logging 2 | Copyright 2003-2007 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | -------------------------------------------------------------------------------- /extensions/aws/notices/java-mail/LICENSE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/extensions/aws/notices/java-mail/LICENSE.txt -------------------------------------------------------------------------------- /extensions/aws/src/WEB-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: 1.6.0 (Sun Microsystems Inc.) 3 | -------------------------------------------------------------------------------- /extensions/aws/src/org/xmlsh/aws/ddbAttrNameExprs.java: -------------------------------------------------------------------------------- 1 | package org.xmlsh.aws; 2 | 3 | import java.util.List; 4 | 5 | import org.xmlsh.aws.util.DDBTypes; 6 | import org.xmlsh.aws.util.DDBTypes.AttrNameExpr; 7 | import org.xmlsh.aws.util.DDBTypes.IAttrNameExpr; 8 | import org.xmlsh.core.BuiltinFunctionCommand; 9 | import org.xmlsh.core.XValue; 10 | import org.xmlsh.sh.shell.Shell; 11 | 12 | public class ddbAttrNameExprs extends BuiltinFunctionCommand { 13 | 14 | public ddbAttrNameExprs() { 15 | super("ddb-attr-name-exprs"); 16 | } 17 | 18 | @Override 19 | public XValue run(Shell shell, List args) throws Exception { 20 | IAttrNameExpr attrs = new AttrNameExpr(); 21 | for (XValue arg : args) { 22 | attrs.putAll(DDBTypes.parseAttrNameExpr(arg)); 23 | } 24 | return new XValue(DDBTypes.addNamePrefix(attrs)); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /extensions/aws/src/org/xmlsh/aws/ddbAttributes.java: -------------------------------------------------------------------------------- 1 | package org.xmlsh.aws; 2 | 3 | import java.util.List; 4 | 5 | import org.xmlsh.aws.util.DDBTypes; 6 | import org.xmlsh.aws.util.DDBTypes.INameAttrValueMap; 7 | import org.xmlsh.aws.util.DDBTypes.NameAttrValueMap; 8 | import org.xmlsh.core.BuiltinFunctionCommand; 9 | import org.xmlsh.core.XValue; 10 | import org.xmlsh.sh.shell.Shell; 11 | 12 | public class ddbAttributes extends BuiltinFunctionCommand { 13 | 14 | public ddbAttributes() { 15 | super("ddb-attributes"); 16 | } 17 | 18 | @Override 19 | public XValue run(Shell shell, List args) throws Exception { 20 | INameAttrValueMap attrs = new NameAttrValueMap(); 21 | for (XValue arg : args) { 22 | attrs.putAll(DDBTypes.parseAttrNameValue(arg)); 23 | } 24 | return new XValue( attrs ); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /extensions/aws/src/org/xmlsh/aws/ddbValues.java: -------------------------------------------------------------------------------- 1 | package org.xmlsh.aws; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.xmlsh.aws.util.DDBTypes; 7 | import org.xmlsh.core.BuiltinFunctionCommand; 8 | import org.xmlsh.core.XValue; 9 | import org.xmlsh.sh.shell.Shell; 10 | 11 | public class ddbValues extends BuiltinFunctionCommand { 12 | 13 | public ddbValues() { 14 | super("ddb-values"); 15 | } 16 | 17 | @Override 18 | public XValue run(Shell shell, List args) throws Exception { 19 | List list = new ArrayList(args.size()); 20 | for( XValue arg : args ){ 21 | list.add( new XValue( DDBTypes.parseAttrValue( arg ))); 22 | } 23 | return new XValue(list) ; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /extensions/aws/src/org/xmlsh/aws/util/INameAttrExpr.java: -------------------------------------------------------------------------------- 1 | package org.xmlsh.aws.util; 2 | 3 | public interface INameAttrExpr { 4 | 5 | } -------------------------------------------------------------------------------- /extensions/aws/test/init.xsh: -------------------------------------------------------------------------------- 1 | 2 | echo "importing module aws" 3 | 4 | import module aws=aws 5 | -------------------------------------------------------------------------------- /extensions/aws/test/s3/out/s3_createbucket.xsh.out: -------------------------------------------------------------------------------- 1 | success 2 | -------------------------------------------------------------------------------- /extensions/aws/test/s3/out/s3_put.xsh.out: -------------------------------------------------------------------------------- 1 | Step 1 Success compared Success 2 | Step 2-f1 Success compared Success 3 | Step 2-f2 Success compared Success 4 | Step 3-f1 Success compared Success 5 | Step 3-f2 Success compared Success 6 | Step 3-f3 Success compared Success 7 | -------------------------------------------------------------------------------- /extensions/aws/test/s3/out/s3_put3.xsh.out: -------------------------------------------------------------------------------- 1 | Step 1 Success compared Success 2 | -------------------------------------------------------------------------------- /extensions/aws/test/s3/s3_createbucket.xsh: -------------------------------------------------------------------------------- 1 | # Test of s3 CreateBucket 2 | 3 | import module aws=aws 4 | 5 | #foo has name of bucket just created 6 | 7 | bucket=xmlsh-org-test-$RANDOM 8 | aws:s3-create-bucket $bucket 9 | 10 | #verify that new bucket exists 11 | 12 | aws:s3ls | xpath -q '//bucket[@name eq concat($bar, "")]' -v bar $bucket > /dev/null 13 | 14 | if [ $? -eq 0 ] ; then 15 | echo success 16 | aws:s3-delete-bucket $bucket 17 | exit 0 18 | fi 19 | 20 | aws:s3-delete-bucket $bucket 21 | 22 | exit 1 -------------------------------------------------------------------------------- /extensions/aws/test/s3/s3_put2.xsh: -------------------------------------------------------------------------------- 1 | # Test of s3 CreateBucket 2 | 3 | import module aws=aws 4 | import commands posix 5 | 6 | #foo has name of bucket just created 7 | 8 | 9 | bucket=xmlsh-org-test-$RANDOM 10 | aws:s3-create-bucket $bucket 11 | foo=s3://$bucket 12 | 13 | lib=$(xfile $PWD/../../lib) 14 | 15 | rm -rf $TMPDIR/awss3 16 | mkdir $TMPDIR/awss3 17 | cd $TMPDIR/awss3 18 | 19 | # make some files 20 | 21 | cat > f1 < f2 < f3 < f1 < 2 | 3 | calabash_ext 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /extensions/calabash/bin/module.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /extensions/calabash/test/_title.xml: -------------------------------------------------------------------------------- 1 | required 2 | -------------------------------------------------------------------------------- /extensions/exist_ext/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /extensions/exist_ext/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | exist_ext 4 | JavaCC Nature 5 | 6 | 7 | 8 | 9 | sf.eclipse.javacc.javaccbuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | sf.eclipse.javacc.javaccnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /extensions/exist_ext/.settings/sf.eclipse.javacc.prefs: -------------------------------------------------------------------------------- 1 | #Mon Apr 06 16:29:11 EDT 2009 2 | CLEAR_CONSOLE=true 3 | JAVACC_OPTIONS= 4 | JJDOC_OPTIONS= 5 | JJTREE_OPTIONS= 6 | JJ_NATURE=true 7 | JTB_OPTIONS= 8 | RUNTIME_JAR= 9 | SHOW_CONSOLE=true 10 | SUPPRESS_WARNINGS=false 11 | eclipse.preferences.version=1 12 | -------------------------------------------------------------------------------- /extensions/exist_ext/README.txt: -------------------------------------------------------------------------------- 1 | This is an extension module to xmlsh 2 | This version requires xmlsh version 1.6 or greater 3 | 4 | Full documentation on using the Exist extension module is at 5 | 6 | http://www.xmlsh.org/ModuleExist 7 | 8 | 9 | Installation and getting started instructions for XMLSH are available at 10 | 11 | http://www.xmlsh.org 12 | 13 | The "Quick Start" has directions on how to get up and running 14 | 15 | http://www.xmlsh.org/QuickStart 16 | 17 | -------------------------------------------------------------------------------- /extensions/exist_ext/bin/module.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /extensions/exist_ext/src/WEB-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: 1.6.0 (Sun Microsystems Inc.) 3 | -------------------------------------------------------------------------------- /extensions/exist_ext/src/org/xmlsh/exist/list.xsh: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | :query -q 'for $d in collection() return document-uri($d)' -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/_err.txt: -------------------------------------------------------------------------------- 1 | [C:\Work\DEI\xmlsh\extensions\exist\test\core\core_query.xsh line: 2] 2 | Exception running: e:query 3 | java.net.ConnectException: Connection timed out: connect 4 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/_out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/extensions/exist_ext/test/core/_out.txt -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/core_del.xsh: -------------------------------------------------------------------------------- 1 | # 2 | . ../init 3 | 4 | e:del $_TESTDIR 5 | 6 | e:put -uri $_TESTDIR/test.xml <[ ]> 7 | e:get $_TESTDIR | xquery -q '//*:resource/@name/string()' 8 | echo 9 | 10 | if e:get $_TESTDIR/test.xml ; then 11 | echo Successfully deleted test file $_TESTDIR/test.xml 12 | else 13 | echo Failed to delete $_TESTDIR/test.xml 14 | fi 15 | 16 | e:del $_TESTDIR 17 | 18 | e:get $_TESTDIR || 19 | { 20 | echo Successfully deleted test directory $_TESTDIR 21 | } 22 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/core_get.xsh: -------------------------------------------------------------------------------- 1 | # 2 | XMODPATH=/usr/local/xmlsh 3 | . ../init 4 | 5 | 6 | e:del $_TESTDIR 7 | 8 | 9 | e:put -uri $_TESTDIR/test.xml <[ ]> 10 | e:get $_TESTDIR/test.xml 11 | echo 12 | echo "Hello World" | e:put -uri $_TESTDIR/test.txt 13 | e:get $_TESTDIR/test.txt 14 | 15 | e:del $_TESTDIR 16 | 17 | 18 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 19 | mkdir $TMPDIR/_mltest 20 | cd $TMPDIR/_mltest 21 | 22 | for j in <[ 1 to 10 ]> ; do 23 | xecho <[ {$j} ]> > ${j}.xml 24 | done 25 | 26 | 27 | e:put -baseuri $_TESTDIR *.xml 28 | e:get $_TESTDIR | xquery -q 'for $n in //*:resource/@name/string() order by $n return $n' 29 | e:del $_TESTDIR 30 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/core_invoke.xsh: -------------------------------------------------------------------------------- 1 | # 2 | . ../init 3 | 4 | echo "1 to 5,'hi'," | e:put -uri $_TESTDIR/run.xquery -q 5 | e:invoke $_TESTDIR/run.xquery 6 | e:del $_TESTDIR 7 | 8 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/core_put.xsh: -------------------------------------------------------------------------------- 1 | # basic test of get. More exaustive tets are run in the core_put test 2 | # 3 | . ../init 4 | 5 | 6 | e:del $_TESTDIR 7 | 8 | 9 | e:put -uri $_TESTDIR/test.xml <[ ]> 10 | 11 | e:get $_TESTDIR/test.xml 12 | echo 13 | e:get $_TESTDIR | xquery -q '//*:resource/@name/string()' 14 | e:del $_TESTDIR 15 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/core_query.xsh: -------------------------------------------------------------------------------- 1 | import module e=../../bin/module.xml 2 | e:query -q <{{ 3 | declare variable $x := "hi" ; 4 | {$x} 5 | }}> 6 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/out/core_del.xsh.out: -------------------------------------------------------------------------------- 1 | test.xml 2 | 3 | Successfully deleted test file /db/_test/test.xml 4 | Successfully deleted test directory /db/_test 5 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/out/core_get.xsh.out: -------------------------------------------------------------------------------- 1 | 1.xml 2 | 10.xml 3 | 2.xml 4 | 3.xml 5 | 4.xml 6 | 5.xml 7 | 6.xml 8 | 7.xml 9 | 8.xml 10 | 9.xml 11 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/out/core_invoke.xsh.out: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | hi 7 | 8 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/out/core_put.xsh.out: -------------------------------------------------------------------------------- 1 | 2 | test.xml 3 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/core/out/core_query.xsh.out: -------------------------------------------------------------------------------- 1 | hi 2 | -------------------------------------------------------------------------------- /extensions/exist_ext/test/init.xsh: -------------------------------------------------------------------------------- 1 | # Initialize MarkLogic connection properties 2 | # This user must have full access to a TEST database which is OK to fully delete for purposes of this test. 3 | # WARNING : DO NOT SET THIS TO A LIVE DATABASE YOU WILL LOSE EVERYTHING 4 | 5 | EXIST_CONNECT="http://home:8080/exist/rest" 6 | import module e=exist 7 | _TESTDIR=/db/_test -------------------------------------------------------------------------------- /extensions/jmx/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /extensions/jmx/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jmx_ext 4 | JavaCC Nature 5 | 6 | 7 | 8 | 9 | sf.eclipse.javacc.javaccbuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | sf.eclipse.javacc.javaccnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /extensions/jmx/.settings/sf.eclipse.javacc.prefs: -------------------------------------------------------------------------------- 1 | #Mon Apr 06 16:29:11 EDT 2009 2 | CLEAR_CONSOLE=true 3 | JAVACC_OPTIONS= 4 | JJDOC_OPTIONS= 5 | JJTREE_OPTIONS= 6 | JJ_NATURE=true 7 | JTB_OPTIONS= 8 | RUNTIME_JAR= 9 | SHOW_CONSOLE=true 10 | SUPPRESS_WARNINGS=false 11 | eclipse.preferences.version=1 12 | -------------------------------------------------------------------------------- /extensions/jmx/bin/module.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /extensions/jmx/src/WEB-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: 1.6.0 (Sun Microsystems Inc.) 3 | -------------------------------------------------------------------------------- /extensions/jmx/src/org/xmlsh/jmx/commands.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lists the objects in the JMX broker 5 | 6 | list [options] 7 | 8 | 9 | 10 | 11 | 12 | Listen for a JMX event 13 | 14 | listen [options] 15 | 16 | 17 | 18 | 19 | Query the values of one or more JMX objects 20 | 21 | query [options] 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /extensions/jmx/test/init.xsh: -------------------------------------------------------------------------------- 1 | # 2 | # Init script for running jmx tests -------------------------------------------------------------------------------- /extensions/json/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /extensions/json/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | json_ext 4 | JavaCC Nature 5 | 6 | 7 | 8 | 9 | sf.eclipse.javacc.javaccbuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | sf.eclipse.javacc.javaccnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /extensions/json/.settings/sf.eclipse.javacc.prefs: -------------------------------------------------------------------------------- 1 | #Mon Apr 06 16:29:11 EDT 2009 2 | CLEAR_CONSOLE=true 3 | JAVACC_OPTIONS= 4 | JJDOC_OPTIONS= 5 | JJTREE_OPTIONS= 6 | JJ_NATURE=true 7 | JTB_OPTIONS= 8 | RUNTIME_JAR= 9 | SHOW_CONSOLE=true 10 | SUPPRESS_WARNINGS=false 11 | eclipse.preferences.version=1 12 | -------------------------------------------------------------------------------- /extensions/json/README.txt: -------------------------------------------------------------------------------- 1 | This is an extension module to xmlsh 2 | This version requires xmlsh version 1.1.1 or greater 3 | 4 | Installation and getting started instructions for XMLSH are available at 5 | 6 | http://www.xmlsh.org 7 | 8 | The "Quick Start" has directions on how to get up and running 9 | 10 | http://www.xmlsh.org/QuickStart 11 | -------------------------------------------------------------------------------- /extensions/json/bin/module.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /extensions/json/samples/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains samples and test data. 2 | A copy of it can be found at 3 | 4 | http://test.xmlsh.org 5 | -------------------------------------------------------------------------------- /extensions/json/samples/jxml.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | 1.23 7 | 8 | 9 | spam 10 | 11 | 12 | string1 13 | string2 14 | string3 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /extensions/json/src/WEB-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: 1.6.0 (Sun Microsystems Inc.) 3 | -------------------------------------------------------------------------------- /extensions/json/src/org/xmlsh/json/commands.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JXON processor 5 | 6 | 7 | Semantically compare 2 json files 8 | 9 | 10 | Convert XSD comments into JXON annotations 11 | 12 | -------------------------------------------------------------------------------- /extensions/json/src/org/xmlsh/json/jcmp.xsh: -------------------------------------------------------------------------------- 1 | # compare 2 JSON files 2 | if [ $# -ne 2 ] ; then 3 | echo Usage: jcmp file1.json file2.json 4 | exit 1; 5 | fi 6 | 7 | T1=$(mktemp -suffix .xml) 8 | T2=$(mktemp -suffix .xml) 9 | 10 | json2xml < $1 > $T1 11 | json2xml < $2 > $T2 12 | 13 | xcmp -x -b $T1 $T2 14 | _RET=$? 15 | 16 | rm -f $T1 $T2 17 | exit $_RET -------------------------------------------------------------------------------- /extensions/json/test/books/books1.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books1.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml > $OUT/books.json 12 | 13 | json2xml < $OUT/books.json | xtee $OUT/temp.jxon | xslt -f $OUT/toxml.xsl > $OUT/temp.xml 14 | 15 | # cat $OUT/temp.xml 16 | 17 | if xcmp -x -b books.xml $OUT/temp.xml ; then 18 | echo Round trip succeeded 19 | else 20 | echo Round trip not valid 21 | fi 22 | 23 | # echo $OUT 24 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/books1_json.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books1.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml 12 | 13 | 14 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/books2.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books2.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml > $OUT/books.json 12 | 13 | json2xml < $OUT/books.json | xtee $OUT/temp.jxon | xslt -f $OUT/toxml.xsl > $OUT/temp.xml 14 | 15 | # cat $OUT/temp.xml 16 | 17 | if xcmp -x -b books.xml $OUT/temp.xml ; then 18 | echo Round trip succeeded 19 | else 20 | echo Round trip not valid 21 | fi 22 | 23 | # echo $OUT 24 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/books2_json.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books2.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml 12 | 13 | 14 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/books3.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books3.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml > $OUT/books.json 12 | 13 | json2xml < $OUT/books.json | xtee $OUT/temp.jxon | xslt -f $OUT/toxml.xsl > $OUT/temp.xml 14 | 15 | # cat $OUT/temp.xml 16 | 17 | if xcmp -x -b books.xml $OUT/temp.xml ; then 18 | echo Round trip succeeded 19 | else 20 | echo Round trip not valid 21 | fi 22 | 23 | # echo $OUT 24 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/books3_json.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books3.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml 12 | 13 | 14 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/books4.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books4.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml > $OUT/books.json 12 | 13 | json2xml < $OUT/books.json | xtee $OUT/temp.jxon | xslt -f $OUT/toxml.xsl > $OUT/temp.xml 14 | 15 | # cat $OUT/temp.xml 16 | 17 | if xcmp -x -b books.xml $OUT/temp.xml ; then 18 | echo Round trip succeeded 19 | else 20 | echo Round trip not valid 21 | fi 22 | 23 | # echo $OUT 24 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/books4_json.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books4.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml 12 | 13 | 14 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/books_none.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books_none.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml > $OUT/books.json 12 | 13 | json2xml < $OUT/books.json | xtee $OUT/temp.jxon | xslt -f $OUT/toxml.xsl > $OUT/temp.xml 14 | 15 | # cat $OUT/temp.xml 16 | 17 | if xcmp -x -b books.xml $OUT/temp.xml ; then 18 | echo Round trip succeeded 19 | else 20 | echo Round trip not valid 21 | fi 22 | 23 | #echo $OUT 24 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/books_none_json.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd books_none.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < books.xml > $OUT/books.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/books.jxml && xml2json -p < $OUT/books.jxml 12 | #echo $OUT 13 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/books/out/books1.out: -------------------------------------------------------------------------------- 1 | Round trip succeeded 2 | -------------------------------------------------------------------------------- /extensions/json/test/books/out/books2.out: -------------------------------------------------------------------------------- 1 | Round trip succeeded 2 | -------------------------------------------------------------------------------- /extensions/json/test/books/out/books3.out: -------------------------------------------------------------------------------- 1 | Round trip succeeded 2 | -------------------------------------------------------------------------------- /extensions/json/test/books/out/books4.out: -------------------------------------------------------------------------------- 1 | Round trip succeeded 2 | -------------------------------------------------------------------------------- /extensions/json/test/books/out/books_none.out: -------------------------------------------------------------------------------- 1 | Round trip succeeded 2 | -------------------------------------------------------------------------------- /extensions/json/test/jxml/jxml_none.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd jxml_none.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < jxml.xml > $OUT/jxml.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/jxml.jxml && xml2json -p < $OUT/jxml.jxml > $OUT/jxml.json 12 | 13 | json2xml < $OUT/jxml.json | xtee $OUT/temp.jxon | xslt -f $OUT/toxml.xsl > $OUT/temp.xml 14 | 15 | # cat $OUT/temp.xml 16 | 17 | if xcmp -x -b jxml.xml $OUT/temp.xml ; then 18 | echo Round trip succeeded 19 | else 20 | echo Round trip not valid 21 | fi 22 | 23 | #echo $OUT 24 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/jxml/jxml_none_json.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd jxml_none.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < jxml.xml > $OUT/jxml.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/jxml.jxml && xml2json -p < $OUT/jxml.jxml 12 | #echo $OUT 13 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/jxml/jxml_simple.xsh: -------------------------------------------------------------------------------- 1 | import commands posix 2 | import module j=json 3 | 4 | OUT=$(mktemp -d) 5 | # echo $OUT 1>&2 6 | cd ../../samples 7 | 8 | 9 | j:jxon -o $OUT -v -xsd jxml_simple.xsd > $OUT/all.xml 10 | xslt -f $OUT/tojson.xsl < jxml.xml > $OUT/jxml.jxml 11 | xsdvalidate "http://www.xmlsh.org/jxml ../schemas/jxml.xsd" $OUT/jxml.jxml && xml2json -p < $OUT/jxml.jxml > $OUT/jxml.json 12 | 13 | json2xml < $OUT/jxml.json | xtee $OUT/temp.jxon | xslt -f $OUT/toxml.xsl > $OUT/temp.xml 14 | 15 | # cat $OUT/temp.xml 16 | 17 | if xcmp -x -b jxml.xml $OUT/temp.xml ; then 18 | echo Round trip succeeded 19 | else 20 | echo Round trip not valid 21 | fi 22 | 23 | #echo $OUT 24 | rm -r -f $OUT -------------------------------------------------------------------------------- /extensions/json/test/jxml/out/jxml_none.out: -------------------------------------------------------------------------------- 1 | Round trip succeeded 2 | -------------------------------------------------------------------------------- /extensions/json/test/jxml/out/jxml_simple.out: -------------------------------------------------------------------------------- 1 | Round trip succeeded 2 | -------------------------------------------------------------------------------- /extensions/marklogic/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /extensions/marklogic/.gitignore: -------------------------------------------------------------------------------- 1 | /_out/ 2 | -------------------------------------------------------------------------------- /extensions/marklogic/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | marklogic_ext 4 | JavaCC Nature 5 | 6 | 7 | 8 | 9 | sf.eclipse.javacc.javaccbuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | sf.eclipse.javacc.javaccnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /extensions/marklogic/.settings/sf.eclipse.javacc.prefs: -------------------------------------------------------------------------------- 1 | #Mon Apr 06 16:29:11 EDT 2009 2 | CLEAR_CONSOLE=true 3 | JAVACC_OPTIONS= 4 | JJDOC_OPTIONS= 5 | JJTREE_OPTIONS= 6 | JJ_NATURE=true 7 | JTB_OPTIONS= 8 | RUNTIME_JAR= 9 | SHOW_CONSOLE=true 10 | SUPPRESS_WARNINGS=false 11 | eclipse.preferences.version=1 12 | -------------------------------------------------------------------------------- /extensions/marklogic/bin/module.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /extensions/marklogic/src/WEB-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: 1.6.0 (Sun Microsystems Inc.) 3 | -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/createdir.xsh: -------------------------------------------------------------------------------- 1 | # create uri ... 2 | _opts=$<(xgetopts -a -p "c=connect:,t=text" -ps -- "$@") 3 | 4 | shift $? 5 | 6 | for uri ; do 7 | :query $_opts -q <{{ 8 | xquery version "1.0-ml"; 9 | declare variable $uri as xs:string external ; 10 | xdmp:directory-create($uri) 11 | }}> -v uri $uri 12 | done -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/del.xsh: -------------------------------------------------------------------------------- 1 | # delete uri ... 2 | _opts=$<(xgetopts -a -p "c=connect:,t=text" -ps -- "$@") 3 | shift $? 4 | 5 | 6 | 7 | for uri ; do 8 | :query $_opts -q <{{ 9 | xquery version "1.0-ml"; 10 | declare variable $uri as xs:string external ; 11 | xdmp:document-delete($uri) 12 | }}> -v uri $uri 13 | done 14 | 15 | -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/deldir.xsh: -------------------------------------------------------------------------------- 1 | # create uri ... 2 | _opts=$<(xgetopts -a -p "c=connect:,t=text" -ps -- "$@") 3 | shift $? 4 | 5 | 6 | 7 | for uri ; do 8 | :query $_opts -q <{{ 9 | xquery version "1.0-ml"; 10 | declare variable $uri as xs:string external ; 11 | xdmp:directory-delete($uri) 12 | }}> -v uri $uri 13 | done 14 | -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/direxists.xsh: -------------------------------------------------------------------------------- 1 | # return true if diretory exists else return false 2 | _opts=$<(xgetopts -a -p "c=connect:" -ps -- "$@") 3 | shift $? 4 | 5 | :query $_opts -b -q <{{ 6 | xquery version "1.0-ml"; 7 | declare variable $uri external ; 8 | exists(xdmp:document-properties($uri)//prop:directory) 9 | }}> -v uri $1 -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/documentMoveForest.xsh: -------------------------------------------------------------------------------- 1 | # Move documents to a new forest 2 | XQ=$(xuri -r /org/xmlsh/marklogic/resources/document-move-forest.xquery) 3 | 4 | for uri in $* ; do 5 | echo moving $uri 6 | :query -f $XQ -v uri "$uri" 7 | done -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/exists.xsh: -------------------------------------------------------------------------------- 1 | # return true if document exists else return false 2 | _opts=$<(xgetopts -a -p "c=connect:" -ps -- "$@") 3 | shift $? 4 | 5 | :query $_opts -b -q <{{ 6 | xquery version "1.0-ml"; 7 | declare variable $uri external ; 8 | exists(doc($uri)) 9 | }}> -v uri $1 -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/listCollections.xsh: -------------------------------------------------------------------------------- 1 | # list 2 | _opts=$<(xgetopts -i "c=connect:" -s -o "r=recurse" -- "$@") 3 | _popts=$<(xgetopts -a -p "c=connect:" -ps -i "r=recurse" -- "$@") 4 | shift $? 5 | 6 | 7 | :query -q <{{ 8 | xquery version "1.0-ml"; 9 | let $collections := cts:collections() return 10 | 11 | { 12 | for $collection in $collections 13 | return 14 | 15 | { $collection } 16 | { fn:count(fn:collection($collection)) } 17 | 18 | } 19 | 20 | }}> -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/listdir.xsh: -------------------------------------------------------------------------------- 1 | # list 2 | 3 | 4 | _opts=$<(xgetopts -a -p "c=connect:" -ps -- "$@") 5 | shift $? 6 | 7 | 8 | declare namespace prop="http://marklogic.com/xdmp/property"; 9 | if [ $# -eq 0 ] ; then 10 | :query $_opts -q <{{ 11 | xquery version "1.0-ml"; 12 | for $d in 13 | xdmp:document-properties()//prop:directory/base-uri() 14 | order by $d 15 | return $d 16 | 17 | }}> 18 | else 19 | for dir in $* ; do 20 | :query $_opts -q <{{ 21 | xquery version "1.0-ml"; 22 | declare variable $dir external; 23 | for $d in 24 | xdmp:directory-properties($dir)//prop:directory/base-uri() 25 | order by $d 26 | return $d 27 | }}> -v dir $dir 28 | done 29 | fi -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/ls.xsh: -------------------------------------------------------------------------------- 1 | # ls 2 | 3 | _opts=$<(xgetopts -a -p "c=connect:" -ps -- "$@") 4 | shift $? 5 | 6 | :query -v $_opts -q <{{ 7 | declare variable $root external := ""; 8 | for $p in 9 | fn:distinct-values( 10 | for $d in cts:uris($root,"document", 11 | if( $root eq "" ) then () else cts:directory-query($root,"infinity")) 12 | let $p := substring-after( $d , $root ) 13 | where $d ne $root 14 | return 15 | if( contains($p,"/") ) then $root || substring-before( $p , "/" ) || "/" 16 | else 17 | $root || $p 18 | ) 19 | where $p eq "" or $p ne $root 20 | return $p 21 | }}> root "$1" -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/rename.xsh: -------------------------------------------------------------------------------- 1 | # rename a marklogic document 2 | XQ=$(xuri -r /org/xmlsh/marklogic/resources/rename.xquery) 3 | 4 | :query -f $XQ -v src $1 target $2 -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/resources/common.xsh: -------------------------------------------------------------------------------- 1 | # getopt( $_options optname global default ). 2 | function getopt() 3 | { 4 | 5 | local _opts=$1 6 | local _optname=$2 7 | local _glob=$3 8 | local _def=$4 9 | return <[ ($_opts//option[@name eq $_optname]/string(),$_glob,$_def)[1] ]> 10 | 11 | } -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/restGet.xsh: -------------------------------------------------------------------------------- 1 | # rest-get [-user] [-port] [-password] url query-params 2 | . $(xuri -r /org/xmlsh/marklogic/resources/common.xsh) 3 | _opts=$<(xgetopts -i "host:,port:,scheme:,uri:,path:" -s -o "u=user:,p=password:" -- $@) 4 | _popts=$<(xgetopts -a -p "host:,port:,scheme:,uri:,path:" -ps -i "u=user:,p=password:" -- $@) 5 | shift $? 6 | uri=$(:rest-uri $_popts $@) 7 | 8 | MLUSER=getopt($_opts u $MLUSER) 9 | MLPASSWORD=getopt($_opts p $MLPASSWORD) 10 | 11 | [ -n "$MLUSER" ] && _up=(-user $MLUSER) 12 | [ -n "$MLPASSWORD" ] && _up=($_up -password $MLPASSWORD) 13 | 14 | 15 | 16 | 17 | 18 | http $_up -get "$uri" -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/restUri.xsh: -------------------------------------------------------------------------------- 1 | # rest-uri 2 | . $(xuri -r /org/xmlsh/marklogic/resources/common.xsh) 3 | 4 | _opts=$<(xgetopts -o "host:,port:,scheme:,uri:,path:" -a -noargs -- "$@") 5 | shift $? 6 | 7 | if [ $# -gt 0 ] ; then 8 | QUERY=$(xurlencode -q "$@") 9 | fi 10 | 11 | 12 | MLURI=getopt( $_opts uri $MLURI ) 13 | if [ -n "$MLURI" ] ; then 14 | MLPORT=$(xuri -port $MLURI) 15 | MLSCHEME=$(xuri -scheme $MLURI) 16 | MLHOST=$(xuri -host $MLURI) 17 | MLPATH=$(xuri -path $MLURI) 18 | fi 19 | 20 | 21 | 22 | 23 | MLPORT=getopt( $_opts port $MLPORT ) 24 | MLPATH=getopt( $_opts path $MLPATH /) 25 | MLHOST=getopt( $_opts host $MLHOST localhost) 26 | MLSCHEME=getopt( $_opts scheme $MLSCHEME http) 27 | 28 | 29 | xuri -Q "$MLSCHEME" "" "$MLHOST" "$MLPORT" "$MLPATH" "$QUERY" "" 30 | 31 | 32 | -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/ui/createDirectory.xquery: -------------------------------------------------------------------------------- 1 | declare variable $url external ; 2 | if( ends-with( $url , '/' ) ) then 3 | xdmp:directory-create($url) 4 | else 5 | () -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/ui/documentDelete.xquery: -------------------------------------------------------------------------------- 1 | declare variable $url external ; 2 | if( ends-with( $url , '/' ) ) then 3 | xdmp:directory-delete($url) 4 | else 5 | xdmp:document-delete($url) 6 | -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/ui/getPermissions.xquery: -------------------------------------------------------------------------------- 1 | import module namespace sec="http://marklogic.com/xdmp/security" at 2 | "/MarkLogic/security.xqy"; 3 | import module namespace hof="http://marklogic.com/higher-order" 4 | at "/MarkLogic/appservices/utils/higher-order.xqy"; 5 | declare namespace s="http://marklogic.com/xdmp/security" ; 6 | declare variable $url as xs:string external ; 7 | declare variable $secid := xdmp:security-database(xdmp:database()); 8 | 9 | for $p in xdmp:document-get-permissions($url) 10 | return hof:apply-in($secid, 11 | function () { 12 | sec:get-role-names($p//s:role-id) 13 | }) || ":" || $p//s:capability 14 | -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/ui/listDatabases.xquery: -------------------------------------------------------------------------------- 1 | xdmp:database-name(xdmp:database()), 2 | for $d in xdmp:databases() 3 | let $n := xdmp:database-name($d) 4 | order by $n 5 | return $n -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/ui/listDirectoryRecurse.xquery: -------------------------------------------------------------------------------- 1 | declare variable $root external := ""; 2 | declare variable $urimatch external := "" ; 3 | 4 | declare function local:uri-query() 5 | { 6 | if( $root eq "" ) 7 | then () 8 | else 9 | cts:directory-query($root,"infinity") 10 | 11 | 12 | }; 13 | 14 | for $d in cts:uris($root,"document", local:uri-query() ) 15 | let $p := substring-after( $d , $root ) 16 | where ($urimatch eq "" or contains( $p , $urimatch ) ) 17 | return $d 18 | -------------------------------------------------------------------------------- /extensions/marklogic/src/org/xmlsh/marklogic/ui/listRootDirectory.xquery: -------------------------------------------------------------------------------- 1 | declare variable $start external := 1 ; 2 | declare variable $end external := 1000; 3 | declare variable $urimatch external := "" ; 4 | 5 | 6 | fn:distinct-values( 7 | for $d in cts:uris("","any" ) 8 | where ($urimatch eq "" or contains( $d , $urimatch ) ) 9 | 10 | return 11 | if( matches( $d , "^[a-zA-Z]+://" ) ) then 12 | replace( $d , "(^[a-zA-Z]+://[a-zA-Z0-9_.-]+/).*","$1" ) 13 | else 14 | if( contains( $d , "/" ) ) then 15 | substring-before( $d , "/" ) || "/" 16 | else 17 | $d 18 | 19 | )[ $start to $end ] -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_createdir.xsh: -------------------------------------------------------------------------------- 1 | # test creating directories 2 | . ../init 3 | ml:createdir /test/dir1/ /test/dir2/ /test/dir3/ 4 | ml:listdir /test/ 5 | ml:deldir /test/ 6 | 7 | 8 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_del.xsh: -------------------------------------------------------------------------------- 1 | # test deleting individual files 2 | . ../init 3 | ml:createdir /test/ 4 | ml:put -uri /test/test1.xml <[ ]> 5 | ml:put -uri /test/test2.xml <[ ]> 6 | echo Created 2 files 7 | ml:list /test/ 8 | ml:del /test/test1.xml /test/test2.xml 9 | echo after deleting 10 | ml:list /test/ 11 | ml:deldir /test/ 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_deldir.xsh: -------------------------------------------------------------------------------- 1 | # test deleting individual files 2 | . ../init 3 | ml:createdir /test/ /test/dir1/ /test/dir2/ /test/dir3/ 4 | 5 | ml:put -uri /test/dir1/test1.xml <[ ]> 6 | ml:put -uri /test/dir2/test2.xml <[ ]> 7 | echo Created 2 files 3 dirs 8 | ml:listdir /test/ 9 | ml:list -r /test/ 10 | ml:deldir /test/dir1/ 11 | echo Deleted dir1 12 | ml:list -r /test/ 13 | ml:direxists /test/ || echo Fail - directory /test/ should exist 14 | ml:deldir /test/ 15 | ml:listdir / 16 | echo Success 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_get-permissions.xsh: -------------------------------------------------------------------------------- 1 | # test get permissions 2 | 3 | ml:put -uri /test1.xml <[ ]> 4 | ml:set-permissions -x test -u test -r test /test1.xml 5 | ml:get-permissions /test1.xml 6 | ml:del /test1.xml 7 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_get.xsh: -------------------------------------------------------------------------------- 1 | # test of get 2 | 3 | ml:put -uri /test.xml <[ 4 | 5 | string 6 | 7 | ]> 8 | 9 | ml:get /test.xml 10 | ml:del /test.xml -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_get2.xsh: -------------------------------------------------------------------------------- 1 | # test of get recursive 2 | 3 | P=$PWD 4 | 5 | # Setup a recursive set of files to get 6 | # 7 | 8 | for i in <[ 1 to 10 ]> ; do 9 | for j in <[ 1 to 100 ]> ; do 10 | ml:put -uri /test/xml/$i/${j}.xml <[ {$i,$j} ]> 11 | done 12 | done 13 | 14 | 15 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 16 | mkdir $TMPDIR/_mltest 17 | cd $TMPDIR/_mltest 18 | 19 | 20 | ml:get -r -baseuri /test/ -maxfiles 4 -maxthreads 5 -d . xml/ 21 | 22 | ls -R . 23 | 24 | ml:deldir /test/ 25 | 26 | cd $P 27 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 28 | 29 | 30 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_invoke.xsh: -------------------------------------------------------------------------------- 1 | # invoke test 2 | 3 | # Create a simple xquery file in /Modules/test.xquery 4 | . ../init 5 | echo '1+1' | ml:put -t -uri /Modules/test.xquery 6 | # ml:set-permissions -x $ML_ROLE -u $ML_ROLE -r $ML_ROLE /Modules/test.xquery 7 | echo 1+1 is $(ml:invoke test.xquery) 8 | ml:deldir /Modules/ 9 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_invoke2.xsh: -------------------------------------------------------------------------------- 1 | # invoke test 2 | 3 | # Create a simple xquery file in /Modules/test.xquery 4 | . ../init 5 | ml:put -t -uri /Modules/test2.xquery <{$id} 8 | 9 | EOF 10 | 11 | # ml:set-permissions -x $ML_ROLE -u $ML_ROLE -r $ML_ROLE /Modules/test.xquery 12 | ml:invoke -v test2.xquery id test 13 | ml:deldir /Modules/ 14 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_listdir.xsh: -------------------------------------------------------------------------------- 1 | # test listing directories 2 | . ../init 3 | ml:createdir /test/dir1/ /test/dir2/ /test/dir3/ 4 | ml:listdir /test/ 5 | ml:deldir /test/ 6 | 7 | 8 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_listdir_ssl.xsh: -------------------------------------------------------------------------------- 1 | # test listing directories 2 | . ../init 3 | MLCONNECT=$MLCONNECT_SSL 4 | echo Using SSL connection $MLCONNECT 5 | ml:createdir /test/dir1/ /test/dir2/ /test/dir3/ 6 | ml:listdir /test/ 7 | ml:deldir /test/ 8 | 9 | 10 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_put.xsh: -------------------------------------------------------------------------------- 1 | # Create a simple xquery file in /Modules/test.xquery 2 | . ../init 3 | ml:put -uri /test1.xml <[ bar ]> 4 | ml:get /test1.xml 5 | 6 | P=$PWD 7 | 8 | # Test recursive put 9 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 10 | mkdir $TMPDIR/_mltest 11 | cd $TMPDIR/_mltest 12 | 13 | for i in <[ 1 to 5 ]> ; do 14 | mkdir $i 15 | for j in <[ 1 to 10 ]> ; do 16 | xecho <[ {$j} ]> > $i/${j}.xml 17 | done 18 | done 19 | 20 | ml:put -r -baseuri /test/ -m 20 -maxthreads 5 * 21 | ml:list -r /test/ 22 | ml:deldir /test/ 23 | 24 | echo text | ml:put -t -uri /test.txt 25 | ml:get -t /test.txt 26 | ml:del /test.txt 27 | 28 | 29 | cd $P 30 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 31 | 32 | 33 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_put3.xsh: -------------------------------------------------------------------------------- 1 | # 2 | # Test various options 3 | # Note: this is a minimum test to make sure that atleast the options dont break anything 4 | 5 | . ../init 6 | ml:put -quality 10 -uri /test1.xml <[ ]> 7 | ml:put +resolve -uri /test2.xml <[ " ]> 8 | ml:put -buffer 10 -uri /test3.xml <[ ]> 9 | ml:put -language en -uri /test3.xml <[ ]> 10 | ml:put -locale en_US -uri /test3.xml <[ ]> 11 | 12 | 13 | # Should be 10 14 | ml:query -q <{{ 15 | xquery version "1.0-ml"; 16 | xdmp:document-get-quality('/test1.xml') 17 | }}> 18 | # ML BUG 19 | # ml:get -t /test2.xml 20 | 21 | ml:deldir / 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_put4.xsh: -------------------------------------------------------------------------------- 1 | # Create a simple xquery file in /Modules/test.xquery 2 | . ../init 3 | ml:put -uri /test1.xml <[ bar ]> 4 | ml:get /test1.xml 5 | 6 | P=$PWD 7 | 8 | # Test recursive put 9 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 10 | mkdir $TMPDIR/_mltest 11 | cd $TMPDIR/_mltest 12 | 13 | for i in <[ 1 to 5 ]> ; do 14 | mkdir $i 15 | for j in <[ 1 to 10 ]> ; do 16 | f=$i/${j}.xml 17 | xecho <[ {$j} ]> > $f 18 | echo $f 19 | done 20 | done | 21 | 22 | ml:put -r -baseuri /test/ -m 3 -maxthreads 2 -f - 23 | ml:list -r /test/ 24 | ml:deldir /test/ 25 | 26 | 27 | cd $P 28 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 29 | 30 | 31 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_put5.xsh: -------------------------------------------------------------------------------- 1 | # Create a simple xquery file in /Modules/test.xquery 2 | . ../init 3 | 4 | 5 | P=$PWD 6 | 7 | # Test recursive put 8 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 9 | mkdir $TMPDIR/_mltest 10 | cd $TMPDIR/_mltest 11 | 12 | for j in <[ 1 to 10 ]> ; do 13 | f=${j}.xml 14 | xecho <[ {$j} ]> > $f 15 | echo $f 16 | done | 17 | ml:put -r -baseuri /test/ -m 3 -maxthreads 2 -delete -f - 18 | 19 | ml:deldir /test/ 20 | xls . 21 | 22 | cd $P 23 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 24 | 25 | 26 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_put6.xsh: -------------------------------------------------------------------------------- 1 | # Test streaming 2 | . ../init 3 | 4 | 5 | P=$PWD 6 | 7 | # Test recursive put 8 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 9 | mkdir $TMPDIR/_mltest 10 | cd $TMPDIR/_mltest 11 | 12 | 13 | xmkpipe -xml x 14 | 15 | ml:put -r -baseuri /test/ -m 3 -maxthreads 2 -uri 'test{seq}.xml' -stream x & 16 | 17 | for j in <[ 1 to 10 ]> ; do 18 | 19 | xecho <[ {$j} ]> 20 | 21 | done >(x) 22 | 23 | xmkpipe -close x; 24 | 25 | wait ; 26 | 27 | ml:list /test/ 28 | 29 | ml:deldir /test/ 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_put_ssl.xsh: -------------------------------------------------------------------------------- 1 | # Create a simple xquery file in /Modules/test.xquery 2 | . ../init 3 | MLCONNECT=$MLCONNECT_SSL 4 | echo Using SSL connection $MLCONNECT 5 | 6 | P=$PWD 7 | 8 | ml:put -uri /test1.xml <[ bar ]> 9 | ml:get /test1.xml 10 | 11 | # Test recursive put 12 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 13 | mkdir $TMPDIR/_mltest 14 | cd $TMPDIR/_mltest 15 | 16 | for i in <[ 1 to 5 ]> ; do 17 | mkdir $i 18 | for j in <[ 1 to 10 ]> ; do 19 | xecho <[ {$j} ]> > $i/${j}.xml 20 | done 21 | done 22 | 23 | ml:put -r -baseuri /test/ -m 20 -maxthreads 5 * 24 | ml:list -r /test/ 25 | ml:deldir /test/ 26 | 27 | echo text | ml:put -t -uri /test.txt 28 | ml:get -t /test.txt 29 | ml:del /test.txt 30 | 31 | 32 | 33 | cd $P 34 | [ -d $TMPDIR/_mltest ] && rm -rf $TMPDIR/_mltest 35 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_query.xsh: -------------------------------------------------------------------------------- 1 | # test basic query 2 | . ../init 3 | 4 | xecho <[ 5 | 6 | data a 7 | data b 8 | data c 9 | 10 | ]> | ml:put -uri /test_query.xml 11 | 12 | ml:query -q <{{ 13 | declare variable $name external ; 14 | doc("/test_query.xml")//elem[@name=$name] 15 | }}> -v name "b" 16 | 17 | # Test exists 18 | ml:exists /test_query.xml || echo FAIL /test_query.xml does not exist 19 | 20 | ml:del /test_query.xml 21 | 22 | 23 | # Test boolean exit 24 | ml:query -b 'fn:true()' && echo Success fn:true 25 | ml:query -b 'fn:false()' || echo Success fn:false 26 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_rename.xsh: -------------------------------------------------------------------------------- 1 | # test of get 2 | 3 | ml:put -uri /test.xml <[ 4 | 5 | string 6 | 7 | ]> 8 | 9 | ml:rename /test.xml /foo.xml 10 | ml:get /foo.xml 11 | ml:del /foo.xml -------------------------------------------------------------------------------- /extensions/marklogic/test/core/core_set-permissions.xsh: -------------------------------------------------------------------------------- 1 | # test get permissions 2 | . ../init 3 | ml:put -uri /test1.xml <[ ]> 4 | ml:set-permissions -x test -u test -r test -i test /test1.xml 5 | ml:get-permissions /test1.xml 6 | ml:del /test1.xml 7 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_createdir.xsh.out: -------------------------------------------------------------------------------- 1 | /test/dir1/ 2 | /test/dir2/ 3 | /test/dir3/ 4 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_del.xsh.out: -------------------------------------------------------------------------------- 1 | Created 2 files 2 | /test/test1.xml 3 | /test/test2.xml 4 | after deleting 5 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_deldir.xsh.out: -------------------------------------------------------------------------------- 1 | Created 2 files 3 dirs 2 | /test/dir1/ 3 | /test/dir2/ 4 | /test/dir3/ 5 | /test/dir1/test1.xml 6 | /test/dir2/test2.xml 7 | Deleted dir1 8 | /test/dir2/test2.xml 9 | Success 10 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_get-permissions.xsh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_get.xsh.xml: -------------------------------------------------------------------------------- 1 | 2 | string 3 | 4 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_invoke.xsh.out: -------------------------------------------------------------------------------- 1 | 1+1 is 2 2 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_invoke2.xsh.xml: -------------------------------------------------------------------------------- 1 | test -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_listdir.xsh.out: -------------------------------------------------------------------------------- 1 | /test/dir1/ 2 | /test/dir2/ 3 | /test/dir3/ 4 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_listdir_ssl.xsh.out: -------------------------------------------------------------------------------- 1 | Using SSL connection xccs://test:test@home:8021 2 | /test/dir1/ 3 | /test/dir2/ 4 | /test/dir3/ 5 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_put2.xsh.out: -------------------------------------------------------------------------------- 1 | foo,bar 2 | /test1.xml 3 | /test2.xml 4 | /test3.xml 5 | foo 6 | /test1.xml 7 | /test2.xml 8 | bar 9 | /test1.xml 10 | /test3.xml 11 | none 12 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_put3.xsh.out: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_put5.xsh.out: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_put6.xsh.out: -------------------------------------------------------------------------------- 1 | /test/test1.xml 2 | /test/test10.xml 3 | /test/test2.xml 4 | /test/test3.xml 5 | /test/test4.xml 6 | /test/test5.xml 7 | /test/test6.xml 8 | /test/test7.xml 9 | /test/test8.xml 10 | /test/test9.xml 11 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_query.xsh.out: -------------------------------------------------------------------------------- 1 | data b 2 | Success fn:true 3 | Success fn:false 4 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_rename.xsh.xml: -------------------------------------------------------------------------------- 1 | 2 | string 3 | 4 | -------------------------------------------------------------------------------- /extensions/marklogic/test/core/out/core_set-permissions.xsh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /extensions/marklogic/test/init.xsh: -------------------------------------------------------------------------------- 1 | # Initialize MarkLogic connection properties 2 | # This user must have full access to a TEST database which is OK to fully delete for purposes of this test. 3 | # WARNING : DO NOT SET THIS TO A LIVE DATABASE YOU WILL LOSE EVERYTHING 4 | 5 | MLCONNECT="xcc://test:test@home:8020" 6 | MLCONNECT_SSL="xccs://test:test@home:8021" 7 | ML_ROLE="test" 8 | import module ml=marklogic -------------------------------------------------------------------------------- /extensions/twitter/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | twitter_ext 4 | JavaCC Nature 5 | 6 | 7 | 8 | 9 | sf.eclipse.javacc.javaccbuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | sf.eclipse.javacc.javaccnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /extensions/twitter/.settings/sf.eclipse.javacc.prefs: -------------------------------------------------------------------------------- 1 | #Mon Apr 06 16:29:11 EDT 2009 2 | CLEAR_CONSOLE=true 3 | JAVACC_OPTIONS= 4 | JJDOC_OPTIONS= 5 | JJTREE_OPTIONS= 6 | JJ_NATURE=true 7 | JTB_OPTIONS= 8 | RUNTIME_JAR= 9 | SHOW_CONSOLE=true 10 | SUPPRESS_WARNINGS=false 11 | eclipse.preferences.version=1 12 | -------------------------------------------------------------------------------- /extensions/twitter/README.txt: -------------------------------------------------------------------------------- 1 | This is an extension module to xmlsh 2 | This version requires xmlsh version 1.1.9 or greater 3 | 4 | 5 | Import the twitter extension in xmlsh with an "import module" statement. 6 | 7 | e.g. 8 | XMODPATH=/usr/local/xmlsh/ext 9 | import module twitter 10 | 11 | or 12 | import module /usr/local/xmlsh/ext/twitter/module.xml 13 | 14 | 15 | 16 | Full documentation on using the Twitter extension module is at 17 | 18 | http://www.xmlsh.org/ModuleTwitter 19 | 20 | 21 | 22 | Installation and getting started instructions for XMLSH are available at 23 | 24 | http://www.xmlsh.org 25 | 26 | The "Quick Start" has directions on how to get up and running 27 | 28 | http://www.xmlsh.org/QuickStart 29 | 30 | -------------------------------------------------------------------------------- /extensions/twitter/bin/module.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /extensions/twitter/src/WEB-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: 1.6.0 (Sun Microsystems Inc.) 3 | -------------------------------------------------------------------------------- /extensions/twitter/src/org/xmlsh/twitter/commands.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lists the objects in the JMX broker 5 | 6 | list [options] 7 | 8 | 9 | 10 | 11 | 12 | Listen for a JMX event 13 | 14 | listen [options] 15 | 16 | 17 | 18 | 19 | Query the values of one or more JMX objects 20 | 21 | query [options] 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /extensions/twitter/test/init.xsh: -------------------------------------------------------------------------------- 1 | # 2 | # Init script for running jmx tests -------------------------------------------------------------------------------- /extensions/xproc/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | xproc_ext 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /extensions/xproc/bin/post_xproc.xsh: -------------------------------------------------------------------------------- 1 | wget --post-file=xmlsh-test-report.xml --user=xmlsh --password=m@ple66 http://tests.xproc.org/results/submit/report 2 | -------------------------------------------------------------------------------- /extensions/xproc/bin/results.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/extensions/xproc/bin/results.xml -------------------------------------------------------------------------------- /extensions/xproc/src/org/xmlsh/xproc/compiler/StaticError.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/extensions/xproc/src/org/xmlsh/xproc/compiler/StaticError.java -------------------------------------------------------------------------------- /extensions/xproc/src/org/xmlsh/xproc/steps/add-attribute.xsh: -------------------------------------------------------------------------------- 1 | # add-attribute 2 | # 3 | # 4 | # 5 | # 6 | # 7 | # 8 | # 9 | 10 | _OPTS=$<(xgetopts match:,attribute-name:,attribute-value: $*) 11 | 12 | xed -a <[ attribute { $_OPTS//option[@name="attribute-name"]/value[1] } 13 | { $_OPTS//option[@name="attribute-value"]/value[1] } ]> -matches <[ $_OPTS//option[@name="match"]/string() ]> 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /extensions/xproc/src/org/xmlsh/xproc/steps/add-xml-base.xsh: -------------------------------------------------------------------------------- 1 | # add-xml-base 2 | # 3 | # 4 | # 5 | # 6 | # 7 | # 8 | 9 | _OPTS=$<(xgetopts relative:,all: $*) 10 | _R=<[ if( $_OPTS//option[@name="relative"]/value = 'false' ) then "" else "-r" ]> 11 | _A=<[ if( $_OPTS//option[@name="all"]/value = 'true' ) then "-a" else ""]> 12 | 13 | eval xaddbase $_R $_A 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /extensions/xproc/src/org/xmlsh/xproc/steps/delete.xsh: -------------------------------------------------------------------------------- 1 | #p:delete 2 | # 3 | # 4 | # 5 | # 6 | # 7 | 8 | _OPTS=$<(xgetopts match: $*) 9 | 10 | xed -d -matches <[ $_OPTS//option[@name="match"]/string() ]> 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /extensions/xproc/src/org/xmlsh/xproc/steps/identity.xsh: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # 4 | # 5 | xidentity 6 | -------------------------------------------------------------------------------- /extensions/xproc/src/org/xmlsh/xproc/steps/string-replace.xsh: -------------------------------------------------------------------------------- 1 | #p:string-replacef 2 | # 3 | # 4 | # 5 | # 6 | # 7 | # 8 | 9 | _OPTS=$<(xgetopts match:,replace: $*) 10 | 11 | xed -rx <[ $_OPTS//option[@name="replace"]/string() ]> -matches <[ $_OPTS//option[@name="match"]/string() ]> 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /extensions/xproc/src/org/xmlsh/xproc/util/XPathFunctions.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/extensions/xproc/src/org/xmlsh/xproc/util/XPathFunctions.java -------------------------------------------------------------------------------- /extensions/xproc/src/org/xmlsh/xproc/xproc.xsh: -------------------------------------------------------------------------------- 1 | # xproc command 2 | eval $(xproc2xmlsh $*) -------------------------------------------------------------------------------- /xmlsh/.gitignore: -------------------------------------------------------------------------------- 1 | /_out/ 2 | *.log 3 | -------------------------------------------------------------------------------- /xmlsh/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | xmlsh 4 | JavaCC Nature 5 | 6 | 7 | 8 | 9 | sf.eclipse.javacc.javaccbuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | sf.eclipse.javacc.javaccnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /xmlsh/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | #Thu May 31 21:02:10 EDT 2012 2 | eclipse.preferences.version=1 3 | encoding//test/core/core_unicode.xsh=UTF-8 4 | -------------------------------------------------------------------------------- /xmlsh/.xmlshrc: -------------------------------------------------------------------------------- 1 | echo In my .xmlshrc 2 | -------------------------------------------------------------------------------- /xmlsh/README.txt: -------------------------------------------------------------------------------- 1 | Installation and getting started instructions are available at 2 | 3 | http://www.xmlsh.org 4 | 5 | The "Quick Start" has directions on how to get up and running 6 | 7 | http://www.xmlsh.org/QuickStart 8 | 9 | -------------------------------------------------------------------------------- /xmlsh/build-lib/README.txt: -------------------------------------------------------------------------------- 1 | To build xmlsh you need the following files not included with the distribution 2 | 3 | ant.jar 4 | From apache-ant 1.7.1 or greater 5 | http://ant.apache.org 6 | 7 | servlet-api.jar 8 | From Tomcat 6 9 | 10 | -------------------------------------------------------------------------------- /xmlsh/cygwin/.gitattributes: -------------------------------------------------------------------------------- 1 | xmlsh eol=lf 2 | xmlshui eol=lf 3 | -------------------------------------------------------------------------------- /xmlsh/cygwin/xmlsh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ -d "$XMLSH" ] || { echo "xmlsh requires environment variable XMLSH set" 1>&2 ; exit 1 ; } 3 | # cygwin uses ";" separator because java is still a win app. 4 | CP="$XMLSH/bin/*;$XMLSH/lib/*" 5 | [ -z "$XMLSH_JVMOPTS" ] && XMLSH_JVMOPTS="-XX:+UseConcMarkSweepGC -Xmx1024m -Xms256m" 6 | _JVMDEFS=-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl 7 | 8 | java $_JVMDEFS -cp "$CP" $XMLSH_JVMOPTS org.xmlsh.sh.shell.Shell "$@" 9 | -------------------------------------------------------------------------------- /xmlsh/cygwin/xmlshui: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ -d "$XMLSH" ] || { echo "xmlsh requires environment variable XMLSH set" 1>&2 ; exit 1 ; } 3 | # cygwin uses ";" separator because java is still a win app. 4 | CP="$XMLSH/bin/*;$XMLSH/lib/*" 5 | [ -z "$XMLSH_JVMOPTS" ] && XMLSH_JVMOPTS="-XX:+UseConcMarkSweepGC -Xmx1024m -Xms256m" 6 | _JVMDEFS=-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl 7 | 8 | javaw $_JVMDEFS -cp "$CP" $XMLSH_JVMOPTS org.xmlsh.sh.ui.XShell "$@" & 9 | disown 10 | -------------------------------------------------------------------------------- /xmlsh/notices/httpclient/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache HttpComponents Client 2 | Copyright 1999-2012 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | -------------------------------------------------------------------------------- /xmlsh/notices/saxon/APACHE.txt: -------------------------------------------------------------------------------- 1 | Apache Ant 2 | Copyright 1999-2006 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | This product includes also software developed by : 8 | - the W3C consortium (http://www.w3c.org) , 9 | - the SAX project (http://www.saxproject.org) 10 | 11 | The task is based on code Copyright (c) 2002, Landmark 12 | Graphics Corp that has been kindly donated to the Apache Software 13 | Foundation. 14 | -------------------------------------------------------------------------------- /xmlsh/notices/saxon/CERN.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/xmlsh/notices/saxon/CERN.txt -------------------------------------------------------------------------------- /xmlsh/notices/saxon/UNICODE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/xmlsh/notices/saxon/UNICODE.txt -------------------------------------------------------------------------------- /xmlsh/notices/woodstox/LICENSE: -------------------------------------------------------------------------------- 1 | This copy of Woodstox XML processor is licensed under the 2 | Apache (Software) License, version 2.0 ("the License"). 3 | See the License for details about distribution rights, and the 4 | specific rights regarding derivate works. 5 | 6 | You may obtain a copy of the License at: 7 | 8 | http://www.apache.org/licenses/ 9 | 10 | A copy is also included with both the the downloadable source code package 11 | and jar that contains class bytecodes, as file "ASL 2.0". In both cases, 12 | that file should be located next to this file: in source distribution 13 | the location should be "release-notes/asl"; and in jar "META-INF/" 14 | 15 | -------------------------------------------------------------------------------- /xmlsh/notices/woodstox/NOTICE: -------------------------------------------------------------------------------- 1 | This product currently only contains code developed by authors 2 | of specific components, as identified by the source code files. 3 | 4 | Since product implements StAX API, it has dependencies to StAX API 5 | classes. 6 | 7 | For additional credits (generally to people who reported problems) 8 | see CREDITS file. 9 | -------------------------------------------------------------------------------- /xmlsh/samples/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains samples and test data. 2 | A copy of it can be found at 3 | 4 | http://test.xmlsh.org 5 | -------------------------------------------------------------------------------- /xmlsh/samples/data/books.csv: -------------------------------------------------------------------------------- 1 | TITLE,AUTHOR,PUBLISHER,PUB-DATE,LANGUAGE,PRICE,QUANTITY,ISBN,PAGES,DIMENSIONS,WEIGHT 2 | Pride and Prejudice,Jane Austen,Modern Library,12/31/2002,English,4.95,187,679601686,352,8.3 5.7 1.1,6.1 3 | Wuthering Heights,Charlotte Bront,Penguin Classics,12/31/2002,English,6.58,113,141439556,430,1.0 5.2 7.8,11.2 4 | -------------------------------------------------------------------------------- /xmlsh/samples/data/books.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/xmlsh/samples/data/books.json -------------------------------------------------------------------------------- /xmlsh/samples/data/books.sch: -------------------------------------------------------------------------------- 1 | 2 | 6 | Test ISO schematron file. Introduction mode 7 | 8 | 9 | 10 | 11 | 12 | All items have titles 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /xmlsh/samples/data/employee.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmlsh/xmlsh1_3/626d27415ff70552a2e56374b79982f55e00070e/xmlsh/samples/data/employee.txt -------------------------------------------------------------------------------- /xmlsh/samples/data/intl.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | お客様番号 5 | 6 | 7 | 客户编号 8 | 9 | 10 | Codice cliente 11 | 12 | 13 | Número de cliente 14 | 15 | 16 | 통지 고객 번호 17 | 18 | 19 | -------------------------------------------------------------------------------- /xmlsh/samples/data/xi_doc1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

120 Mz is adequate for an average home user.

4 | 5 | 6 | 7 | 8 |

Fallback OK

9 |
10 | 11 |
-------------------------------------------------------------------------------- /xmlsh/samples/data/xi_sub1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

The opinions represented herein represent those of the individual 4 | and should not be interpreted as official policy endorsed by this 5 | organization.

6 |
-------------------------------------------------------------------------------- /xmlsh/samples/data/xml-base-chap.xml: -------------------------------------------------------------------------------- 1 |
2 |

This has a different base URI: xml-base-chap.xml.

3 | 4 |
5 | -------------------------------------------------------------------------------- /xmlsh/samples/data/xml-base-test.xml: -------------------------------------------------------------------------------- 1 | 3 | ]> 4 | 5 |

This has one base URI: xml-base-test.xml

6 | 7 | &subdoc; 8 |

This has the original base URI.

9 |
10 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/demo.bat: -------------------------------------------------------------------------------- 1 | @REM Requires xmlsh in your PATH 2 | @cls 3 | @xmlsh demo.xsh 4 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/demo.sh: -------------------------------------------------------------------------------- 1 | # Requires xmlsh in your path 2 | clear 3 | xmlsh demo.xsh 4 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/interest/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/interest/seq_elem.xsh: -------------------------------------------------------------------------------- 1 | # Element sequences 2 | 3 | for i in <[1,"text",,text]> ; do 4 | echo $i 5 | done 6 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/interest/seq_num.xsh: -------------------------------------------------------------------------------- 1 | # Create a bunch of numbers using a sequence 2 | 3 | for i in <[1 to 10 ]> ; do 4 | echo number $i 5 | done 6 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/interest/xml_here.xsh: -------------------------------------------------------------------------------- 1 | # XML Complex Here Documents 2 | xread elem < 4 | element 5 | 6 | EOF 7 | 8 | xread elem2 < 10 | element2 11 | 12 | EOF 13 | 14 | doc=<[ 15 | document { 16 | { $elem }{ $elem2 } 17 | } 18 | ]> 19 | 20 | echo Second Element is 21 | echo <[$doc/test/elem[2]]> 22 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/interest/xml_math.xsh: -------------------------------------------------------------------------------- 1 | # Simple math using XQuery 2 | i=<[1]> # Make sure i is xs:integer 3 | i=<[$i + 1 ]> 4 | echo i is $i then times 2 is <[$i * 2]> 5 | 6 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/tools/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/tools/tool_pipe.xsh: -------------------------------------------------------------------------------- 1 | # Complex pipeline 2 | 3 | cd $XMLSH/samples/styles 4 | xslt -f identity.xsl -i ../data/books.xml | 5 | xcat | 6 | xquery '{for $i in //ITEM return $i}' | 7 | xpath '//ITEM[3]/AUTHOR/string()' 8 | 9 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/tools/tool_xpath.xsh: -------------------------------------------------------------------------------- 1 | # XPath demo 2 | BOOK=$XMLSH/samples/data/books.xml 3 | echo The author of The Big Over Easy is 4 | xpath -i $BOOK "//ITEM[TITLE='The Big Over Easy']/AUTHOR/string()" 5 | 6 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/tools/tool_xquery.xsh: -------------------------------------------------------------------------------- 1 | # XQuery sample 2 | echo Book Titles with number of pages 3 | echo 4 | xquery -i $XMLSH/samples/data/books.xml ' 5 | for $item in //ITEM 6 | return ( 7 | , 8 | text{" "} 9 | ) 10 | ' 11 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/tools/tool_xslt.xsh: -------------------------------------------------------------------------------- 1 | # XSLT example 2 | cd $XMLSH/samples/styles 3 | xslt -f books.xsl -i ../data/books.xml 4 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/unix/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/unix/unix_case.xsh: -------------------------------------------------------------------------------- 1 | # Unix case statement 2 | case string in 3 | not) echo not right ;; 4 | *ing) echo got it ! ;; 5 | esac 6 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/unix/unix_for.xsh: -------------------------------------------------------------------------------- 1 | # Simple for command loop 2 | 3 | for var in a b c ; do 4 | echo variable is $var 5 | done 6 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/unix/unix_if.xsh: -------------------------------------------------------------------------------- 1 | # Simple if/else command 2 | 3 | if true ; then 4 | echo true 5 | elif false ; then 6 | echo certianly not 7 | else 8 | echo false 9 | fi 10 | 11 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/unix/unix_string.xsh: -------------------------------------------------------------------------------- 1 | # String variables 2 | 3 | VAR1="hi" 4 | VAR2="there" 5 | echo Simple string variables: $VAR1 $VAR2 6 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/unix/unix_while.xsh: -------------------------------------------------------------------------------- 1 | # Simple while command loop 2 | 3 | 4 | var=a 5 | while [ $var != "aaa" ] ; do 6 | echo var is $var 7 | var=${var}a 8 | done 9 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/xml/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/xml/xml_doc.xsh: -------------------------------------------------------------------------------- 1 | # XML Documents reusable parsed DOM trees 2 | 3 | cd $XMLSH/samples/data 4 | xread doc < books.xml 5 | 6 | echo Number of AUTHORS <[count($doc//AUTHOR)]> 7 | echo The Eyre Affair author is 8 | echo <[$doc//ITEM[TITLE='The Eyre Affair']/AUTHOR/text()]> 9 | 10 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/xml/xml_elem.xsh: -------------------------------------------------------------------------------- 1 | # XML element creation 2 | data="text" 3 | elem=<[{$data}]> 4 | 5 | echo $elem 6 | -------------------------------------------------------------------------------- /xmlsh/samples/demo/xml/xml_here.xsh: -------------------------------------------------------------------------------- 1 | # XML Here document 2 | 3 | xread data < 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 |
    11 | 12 |
  • 13 |
    14 |
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 | 6 | 9 | 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 --------------------------------------------------------------------------------