webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Querying XML whose schema imports other schemas

  • 1.  Querying XML whose schema imports other schemas

    Posted Thu March 27, 2003 09:52 PM

    Hi, Forum:

    I successfully created my second Database and loaded several(6) instances.

    Being happy with that, I’ve been trying to query the database, but it doesn’t return right results that I expect.

    When I do this from TII XQuery,

    for $t in input()
    return $t

    it returns 6 objects in the format of
    xq:result/xq:object/TLTransaction

    BUT, when I try this,

    for $t in input()
    return $t/ :cool:TLTransaction:cool:

    it throws “8306:Invalid cursor position”.

    Similar query works for the other database.

    The only difference(that I can think of) of the “TLTransaction” Database is that it imports two other schemas(XMLSignature and XMLEncryption). I had defined both “Signature.tsd” and “Encryption.tsd” before I defined “TLTransaction.tsd”.

    Here’s the beginning of my schema.

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema targetNamespace=“http://www.myCompany.com” xmlns:xs=“XML Schema” xmlns:tsd=“http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:ds=“XML-Signature Syntax and Processing” xmlns:xenc=“XML Encryption Syntax and Processing” xmlns:tl=“http://www.myCompany.com” elementFormDefault=“qualified”>
    xs:annotation
    xs:appinfo
    <tsd:schemaInfo name=“TLTransaction”>
    <tsd:collection name=“TxnCollection”/>
    <tsd:doctype name=“tl:TLTransaction”>
    tsd:logical
    tsd:contentclosed</tsd:content>
    </tsd:logical>
    </tsd:doctype>
    </tsd:schemaInfo>
    </xs:appinfo>
    </xs:annotation>
    <xs:import namespace=“XML-Signature Syntax and Processing” schemaLocation=“Signature”/>
    <xs:import namespace=“XML Encryption Syntax and Processing” schemaLocation=“EncryptedData”/>
    <xs:element name=“TLTransaction”>
    xs:complexType
    xs:sequence
    <xs:element name=“Header” type=“tl:TransactionHeaderType”/>
    <xs:element name=“Body” type=“tl:TransactionBodyType”/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>


    Can somebody help with this?


    Scott Chung


    #API-Management
    #webMethods
    #Tamino


  • 2.  RE: Querying XML whose schema imports other schemas

    Posted Thu March 27, 2003 10:06 PM

    Never mind :smiley:

    I self-solved this by declaring namespace like this.
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    declare namespace tl= “http://www.myCompany.com
    for $q in input()/tl:TLTransaction
    return $q
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    Hmmm… so if there are several namespaces, we have to declare them when we query. I see.

    Well…I am learning.

    Scott


    #webMethods
    #API-Management
    #Tamino