Extracting schema structures

I have the following question:

How do I get access to a schema stored in Tamino at run time?

The scenario is that I want to create a generic method of taking a schema and then creating an XML instance that is a subset of a large XML document by navigating through the smaller schema to identify which values from the big schema are needed for the smaller XML document:

EG, if the biger schema contained “FirstName”, “Initial”, “LastName”, and there was a schema that contained only “FirstName” and “LastName”.

If I wanted to dynamically identify the nodes that I need to extract values from in the big XML document, I could do this by navigating through the smaller SCHEMA, and generating an XQuery dynamically as I identify the nodes in the smaller schema.

Another option is to generate a blank XML instance. How can I do this dynamically at run time?

How would I do this?

Stuart King

you can query on the XML Schemas in Tamino: doctype is “ino:collection”, doctype is “xs:schema”. You can do anything you do with XQuery.

regards,

Timm

sorry, typo!

you can query on the XML Schemas in Tamino: Collection is “ino:collection”, doctype is “xs:schema”. You can do anything you do with XQuery.

regards,

Timm

Hi Timm

We seem to struggle with this. Can you kindly give us an example of how to query a schema from Tamino

Hello Frikkie

Is a Xquery sample which does what you want:

declare namespace xs=“http://www.w3.org/2001/XMLSchema"
for $s in input()/xs:schema[//@name=”"]
return $s

You have to execute this XQuery in the “ino:collection” collection

Best regards,

Ludovic

Hi !
I’m wrestling with this query

[color=“green”]

declare namespace tf = “http://namespaces.softwareag.com/tamino/TaminoFunction
declare namespace xs=“http://www.w3.org/2001/XMLSchema
declare namespace ino=“http://namespaces.softwareag.com/tamino/response2
(
for $s in input()/xs:schema
where ( ! tf:containsText ( $s/@ino:docname, “ino”) )
return
$s
)
[position() >= 1 and position() <= 3][/color]

Doesn’t works :oops: … what I need to display the current schemas with a xquery ? (I mean non-system schemas)
Regards

Joe

Hi,

try
for $i in input()/xs:schema
where not (starts-with(xs:string(tf:getDocname(root($i))),“ino:”))
return $i

Regards

harald

sorry, this was for Tamio 4.4. For earlier versions, you have to declare the namespaces as well