Page 1 of 1

How to being building a complex validation tool?

Posted: Sun Oct 19, 2014 11:25 pm
by kiai
Hi,
I would like to use oXygen to validate sets of documents. There is no XML creation, but would like to locate errors within a set. The simpler set contains a single XML document and numerous directories with image assets. Data nodes point to the images and sometimes reference elements within the same XML. Each document set is self-contained.

Where do I begin to set up oXygen for this? Should I set up the file sets as projects or use a database? Or does this type of validation need a java-based programming/plug-in?

Thanks.

Re: How to being building a complex validation tool?

Posted: Mon Oct 20, 2014 11:18 pm
by ionela
Hello,

You can validate multiple XML files in oXygen by performing a batch validation.

First you need add your files to project and organize them at Project level. Then, from the Project view, select the folder where you have the files you need to validate and from the contextual menu go to "Validate" submenu then pick one of the available options.

There are two ways of running such a batch validation on multiple files selected in the Project view:
- with the associated validation scenarios or associated schemas(Validate -> Validate). This means that each file will be validated with its associated validation scenario. If no validation scenario is associated then the file will be validated with the default validation engine and the associated schema(if there is one)
- with a specified schema(Validate -> Validate with...). You will browse for the schema that will be used to validate each of the files.

Another way of organizing your files is to create a logical folder (right click on the root of the project and from the contextual menu choose New > Logical Folder) and link there only the files you want to validate (either add the files manually or drag and drop them). Then, you can perform a batch validation on that logical folder.

Let us know if you need further assistance.

Regards,
Ionela

Re: How to being building a complex validation tool?

Posted: Tue Oct 21, 2014 4:11 am
by kiai
Thanks for your reply. However, I am not trying to do a batch validation. I am trying to check one XML document with multiple data nodes pointing to image assets and elements with reference IDs within the same, single XML document.

File structure is like this:
  • XML
  • Directory
    • Subdirectories containing images
The XML validates against the XSD for the project. But what I need is a way to check that paths and other links -- in the XML as data, not attributes -- are pointing correctly to the assets in the subdirectories and to the correct elements. Here is an example of some of the data:

Code: Select all

<object>
<link>images/assets/company/index.html</link>
</object>

Thanks.

Re: How to being building a complex validation tool?

Posted: Tue Oct 21, 2014 6:13 pm
by adrian
Hi,

If you want to check if @hrefs or links correctly point to existing resources, you could use a combination of XSLT 2.0 with Java extensions (java.io.File) and run it with Saxon PE or EE.

e.g.

Code: Select all

<xsl:variable name="myFileExists" xmlns:file="java:java.io.File" select="file:exists(file:new('/path/to/my/file'))"/>
Instead of the string '/path/to/my/file' you could use a variable or XPath that points to your @href/link.

Regards,
Adrian

Re: How to being building a complex validation tool?

Posted: Tue Oct 21, 2014 8:09 pm
by kiai
Thanks! This is helpful.