Target audience: jInfer users. Anyone who needs to use jInfer to create DTD, XSD or another schema from existing XML documents, schemas (again: DTD, XSD, ...) or queries (such as XPath).
Note: we use the term inference for the act of creation of schema throughout this and other jInfer documents.
Do this if you don't have any NetBeans installed. If you have an older version than 6.9, jInfer will not run - please update it first.
- Go to http://netbeans.org/.
- Download NetBeans 6.9+, whichever bundle will do.
- Follow installation instructions.
Do this if you have the correct version of NetBeans installed. Note that jInfer features automatic update - you don't need to follow these steps each time new version comes out.
- Go to https://sourceforge.net/projects/jinfer/files/.
- Download the latest jInfer binaries (jInfer-X.Y-bin.zip).
- Unpack the ZIP, you'll get a few NBM files.
- Start NetBeans, open Tools > Plugins from the main menu.
- Switch to Downloaded tab.
- Click Add Plugins....
- Select all the unpacked NBM files.
- Click Install and follow the instructions.
- Restart NetBeans.
This section assumes you have NetBeans and jInfer installed. After the first run, a jInfer Welcome window will appear, guiding you through basically the same steps that will be covered here. You might want to follow them instead.
Let's assume that you have one or more XML files, and you want to create XSD schema from them.
Create a new jInfer project.
- File > New Project or New Project icon from the toolbar or right-click the area in Projects window > New Project.
- Select jInfer category, jInfer Project.
- Click Next.
- Choose a name (for example MyInference) and location of your project.
- Click Next.
- In the Schema Generator combo box select Basic XSD Exporter.
- Click Finish.
- Add input XML files to this project.
- Right click the newly created project in Projects window.
- Select Add files.
- Select XML files you want to use for schema inference.
- If you now open the XML folder in your project, you will see the added files.
- Run inference.
- Run Project in the toolbar (green play icon) or right click the project, select Run.
- Generated schema will open in a new Editor window. It will also appear in the Output folder.
- You will find the file with the schema in your project (location from step 1d, folder output).
This section assumes you have successfully inferred at least one schema.
- To add input files to a specific folder (XML documents, schemas, queries) without relying on jInfer to guess the folder from the extension, right click the folder and select Add XYZ files.
- Note that input folders are virtual - files in them still reside at their original locations. You can't actually delete them from disk from within jInfer, just remove them from these virtual folders by selecting Delete from their context menu.
- Output folder is, on the other hand, a faithful representation of the folder output inside your jInfer project (step 1d). If you delete a schema here, it will be deleted from the disk too.
- You might want to see a diff between two input documents, or old and inferred schema - just select both files at once, right-click and select Tools > Diff from their context menu.
Setting up jInfer
This section assumes that you have successfully inferred at least one schema and know how to manipulate input and output files in a project.
To change jInfer settings, you have to first realize whether it is a change affecting a single project at a time (for example, changing the output language from XSD to DTD) or whole jInfer at once (whether schema should open in Editor window after the inference finishes).
- First type of settings is found in so called Project Preferences. You can access them from the respective jInfer project's context menu: right click the project and select Properties.
- Second type is called jInfer Options and can be found among NetBeans' options: open them (Windows, Linux: Tools > Preferences..., Mac: NetBeans > Preferences...) and switch to jInfer tab.
This section assumes that you have successfully inferred a few schemas and would like to play with the process, interfere with it.
Default simplifier that jInfer uses is non-interactive: after it is run, it will work for a while and then display the generated schema. However, jInfer bundles also a way to guide the inference process interactively, by selecting states in an automaton that should be merged together and selecting which state should be removed while converting an automaton to a regular expression. For more information on this, see the documentation of TwoStep simplifier. To try out interactive inference, do the following with your jInfer project:
- Open Project Preferences.
- Navigate to Simplifiers > TwoStep > Automaton Merging State.
- In the Automaton simplifier combobox select User Interactive.
- Navigate to State Removal.
- In the State Removal orderer combobox select User Interactive.
- Save the preferences by clicking OK.
- Run the inference again.
- A new window will appear, which will require you to select states to be merged in each step of simplification. After selecting these states, proceed by clicking Continue.