Sample of XMLValidation Activity
This sample highlights the use of XMLValidation activity. The XML file is validated against schema. The file is valid only if the XML file is an instance of XML schema. Otherwise, the activity throws an error with the details of validation error. The file names used in this sample are specified in module property.
Before you begin
- Import the schema file to the
schemasfolder. To do this, right-click on schemas > import > file system > browse to the data folder and select$TIBCO_HOME/bw/palettes/lx/<version>/samples/LargeXML/data/input/.BW_shipping_costs.xsd - Set the XSD in the Schema field of the General tab.
- Before executing the project, set the module property
LargeXML_Rootto the location of the plug-insamplesfolder. For example, if the plug-in samples are available in$TIBCO_HOME/bw/palettes/lx/<version>/samples, setLargeXML_Rootto $TIBCO_HOME/bw/palettes/lx/<version>/samples. The rest of the input and output paths are configured using this module property.
- Procedure
- In the samples directory, select <TIBCO HOME> bw > palettes > lx > <version> > samples and double-click
tibco.bw.sample.palette.bwlx.LargeXMLPluginSample. - In Project Explorer, expand the
tibco.bw.sample.palette.bwlx.LargeXMLPluginSampleproject. - Set the default ApplicationProfile to match your operating system.
- Fully expand the
Processesdirectory and double-clickXMLValidation.bwp. In Module Descriptors > Components, you can seeXMLValidation.bwp. - Click Run > Debug Configurations.
- In the left tree of the Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
- Click the
Applications tab and then click
Deselect All if you have multiple applications. Select the check box next to
tibco.bw.sample.palette.bwlx.LargeXMLPluginSample.application. - Click Debug. This runs the sample in the Debug mode.
- Click the
Terminate
icon to stop the process.
Result
The Console displays the output as:
21:13:59.535 INFO [Job_Executor0] com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300021: All Application dependencies are resolved for Application [tibco.bw.sample.palette.bwlx.LargeXMLPluginSample.application:1.0] 21:14:18.383 INFO [Job_Executor0] com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300006: Started BW Application [tibco.bw.sample.palette.bwlx.LargeXMLPluginSample.application:1.0] 21:14:18.568 INFO [bwThread:In-Memory STWorkProcessor-1] c.t.b.p.g.L.t.b.s.p.b.L.Valid- -----------Validation Successful------------
Understanding the Configuration
The following activity is used in this sample:
- XMLValidation: The activity validates XML files against XSD.