Re: [basex-talk] Old dog trying to learn some new tricks.

2017-08-29 Thread Alexander Holupirek
> On 28. Aug 2017, at 23:02, Dave Day  wrote:
> 
> Greetings BaseX list,
> 
> I've got some very basic questions I was hoping I could get the answers 
> to on this list.  Questions really break down into two categories.  My 
> background is strictly on IBM mainframes, so please bear with me.
> 
> 1)Some XML schema questions, and
> 
> 2)Questions regarding how to configure/use BaseX for what I want to do.
> 
> XML schema.  I've got a record definition created by IBM that changes 
> somewhat depending upon the release of the system.  I want to create XML 
> schema for each release dependent definition, and then make that definition 
> available to BaseX.  I thought using namespaces was the way to go, but now am 
> not sure.
> 
> What I was hoping to do was to connect to a running BaseX, and send the 
> schema definitions that would be used to validate the XML.  In reading doc, I 
> see it is possible to create namespaces and use them, but the format has to 
> be either a URL or a URN.  Is it possible to create a URN for a namespace on 
> the fly, and then tell the code later on which namespace to use?
> 
> Regards,
> 
> -- Dave Day

Hi Dave,

is it possible to see one of those 'record definitions created by IBM’ as an 
example?

I guess, what you would want to generate given a ‘record definition’ is twofold:

- Multiple XML representations of actual data that corresponds to the ‘record 
definition’.
- A schema definition to validate instances of those XML representions.

Example:

A ‘record definition’:
Mainframe defines an event.
An event has a start and end time as integers.
Each event has an id.

I guess such a definition is probably burried in some kind of specification or 
even source code, but can be extracted somehow. So you finally get something 
from which you would be able to automatically generate a schema definition. 
This generated schema definition could look like this (in RELAX NG [1]):

[mainframe.rng]
```
http://relaxng.org/ns/structure/1.0; 
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes;>


  

 

  

  
 
  



  

  


  
  
  
  



  

  



  

  



  

  



  



  



```

Now events occur on the mainframe and your code produces event XML instances, 
such as:

[event-1.xml]
```

  
  

```

To ‘validate’ those XML instances you use a software such as jing [2]. 

[terminal]
```
$ jing mainframe.rng event-1.xml 
```

No BaseX involved so far.

If you need to store a lot of those XML documents, it may, of course, be handy 
to store them in BaseX.
To validate them against the schema you can use the Validation Module [3].

[validate.xq]
```
validate:rng-report('event-1.xml', 'mainframe.rng')
```

Am I on the right track of what you are trying to achieve?

Kind regards,
  Alex

[1] http://relaxng.org
[2] http://relaxng.org/#validators
[3] http://docs.basex.org/wiki/Validation_Module#RelaxNG_Validation

Re: [basex-talk] Old dog trying to learn some new tricks.

2017-08-28 Thread Liam R. E. Quin
On Mon, 2017-08-28 at 16:02 -0500, Dave Day wrote:
> 
[...]
>  What I was hoping to do was to connect to a running BaseX, and
> send 
> the schema definitions that would be used to validate the XML.  In 
> reading doc, I see it is possible to create namespaces and use them,
> but 
> the format has to be either a URL or a URN.  Is it possible to create
> a 
> URN for a namespace on the fly, and then tell the code later on
> which 
> namespace to use?

I think really you are wanting to validate against a particular schema.
This is entirely unrelated to which namespace URI is used to identify
elements in the document. You can have multiple XML Schema Documents
(xsd) for validating XML documents whose elements are "in" the same
namespace.

A namespace in XML is nothing more or less than a URI used as a name.
They don't actually "do" anything :)

http://docs.basex.org/wiki/Validation_Module#XML_Schema_Validation
has an example that might help.

Liam


-- 
Liam Quin, W3C, http://www.w3.org/People/Quin/
Staff contact for Verifiable Claims WG, XQuery WG

Web slave for http://www.fromoldbooks.org/


Re: [basex-talk] Old dog trying to learn some new tricks.

2017-08-28 Thread Kendall Shaw
Can you elaborate on what you were imagining doing with namespaces? An XML 
namespace is referred to by it’s URI. If you created one, I don’t know what it 
would mean to tell the code later on which to use.

Do you mean a namespace prefix?

Kendall

On 8/28/17, 2:02 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day"  wrote:

Greetings BaseX list,

 I've got some very basic questions I was hoping I could get the 
answers to on this list.  Questions really break down into two 
categories.  My background is strictly on IBM mainframes, so please bear 
with me.

 1)Some XML schema questions, and

 2)Questions regarding how to configure/use BaseX for what I want to do.

 XML schema.  I've got a record definition created by IBM that 
changes somewhat depending upon the release of the system.  I want to 
create XML schema for each release dependent definition, and then make 
that definition available to BaseX.  I thought using namespaces was the 
way to go, but now am not sure.

 What I was hoping to do was to connect to a running BaseX, and send 
the schema definitions that would be used to validate the XML.  In 
reading doc, I see it is possible to create namespaces and use them, but 
the format has to be either a URL or a URN.  Is it possible to create a 
URN for a namespace on the fly, and then tell the code later on which 
namespace to use?

 Regards,

 -- Dave Day





[basex-talk] Old dog trying to learn some new tricks.

2017-08-28 Thread Dave Day

Greetings BaseX list,

    I've got some very basic questions I was hoping I could get the 
answers to on this list.  Questions really break down into two 
categories.  My background is strictly on IBM mainframes, so please bear 
with me.


    1)Some XML schema questions, and

    2)Questions regarding how to configure/use BaseX for what I want to do.

    XML schema.  I've got a record definition created by IBM that 
changes somewhat depending upon the release of the system.  I want to 
create XML schema for each release dependent definition, and then make 
that definition available to BaseX.  I thought using namespaces was the 
way to go, but now am not sure.


    What I was hoping to do was to connect to a running BaseX, and send 
the schema definitions that would be used to validate the XML.  In 
reading doc, I see it is possible to create namespaces and use them, but 
the format has to be either a URL or a URN.  Is it possible to create a 
URN for a namespace on the fly, and then tell the code later on which 
namespace to use?


    Regards,

    -- Dave Day