XML xsi types with the XML Path Reader

Support/help with CloverETL (4.9) and CloverDX (5.0 or newer) implementation problems

Mike
Posts: 26
Joined: Thu Dec 06, 2007 7:39 am

XML xsi types with the XML Path Reader

Postby Mike » Thu Jun 04, 2009 7:42 am

Hi,

Are XSI types supported within the XML Path Reader?

Thanks

Mike

jausperger
Posts: 19
Joined: Wed Apr 04, 2007 2:44 pm

Re: XML xsi types with the XML Path Reader

Postby jausperger » Thu Jun 04, 2009 11:47 am

Hi, namespaces are supported by the XML Path Reader.

An examaple:

<xml xmlns:xsi="http://www.xxx.org/p/">
<test xsi:type="a:IntlAddress">test data</test>
</xml>

<Context xpath="/xml" outPort="0" namespacePaths="xsi='http://www.xxx.org/p/'">
<Mapping xpath="test/@xsi:type" cloverField="xsiData"/>
</Context>

Mike
Posts: 26
Joined: Thu Dec 06, 2007 7:39 am

Re: XML xsi types with the XML Path Reader

Postby Mike » Thu Jun 04, 2009 1:52 pm

Thanks for your answer.

I am having problems getting this example to work.

I am using...

<OLife xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Party xsi:type="Person">
<ID>Person_0</ID>
</Party>
</OLife>

with...

<Context xpath="/OLife" namespacePaths="xmlns='http://stanlib.com/services/1.0/'">
<Context xpath="Party/@xsi:type=Person" outPort="0">
<Mapping nodeName="ID" cloverField="id" />
</Context>
</Context>

But get the following error ...


Reason: net.sf.saxon.trans.StaticError: XPath syntax error at char 15 in {Party/@xsi:type=Person}:
Prefix xsi has not been declared
XML_XPATH_READER0 ...FAILED !

Any ideas what I am doing wrong. Thanks for your help.

Mike
Posts: 26
Joined: Thu Dec 06, 2007 7:39 am

Re: XML xsi types with the XML Path Reader

Postby Mike » Thu Jun 04, 2009 1:56 pm

Sorry had a moment there.

Notice I havent specified the namespaces.

Mike
Posts: 26
Joined: Thu Dec 06, 2007 7:39 am

Re: XML xsi types with the XML Path Reader

Postby Mike » Fri Jun 05, 2009 7:20 am

Hi,

I am still seem to be having a few problems getting this to work.

Can you spot anything I am doing wrong?

<OLife xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://Mike.com/services/1.0/">
<Party xsi:type="Person">
<ID>Person_0</ID>
</Party>
</OLife>



<Context xpath="/OLife" outPort="0" namespacePaths="xsi='http://www.w3.org/2001/XMLSchema-instance';xsd='http://www.w3.org/2001/XMLSchema';xmlns='http://mike.com/services/1.0/'">
<Mapping xpath="/Party/@xsi:type=Person/ID" cloverField="id"/>
<Context xpath="Party/@xsi:type=Person" outPort="1" SequenceField="id">
<Mapping xpath="ID" cloverField="id"/>
</Context>
</Context>


Thanks for your help.

Mike
Posts: 26
Joined: Thu Dec 06, 2007 7:39 am

Re: XML xsi types with the XML Path Reader

Postby Mike » Fri Jun 05, 2009 9:11 am

Hi,

This mapping will work...

<Context xpath="/OLife" outPort="0" namespacePaths="xsi='http://www.w3.org/2001/XMLSchema-instance';xsd='http://www.w3.org/2001/XMLSchema';xmlns='http://Mike.com/services/1.0/'">
<Context xpath="Party" outPort="1" namespacePaths="xsi='http://www.w3.org/2001/XMLSchema-instance';xsd='http://www.w3.org/2001/XMLSchema';xmlns='http://Mike.com/services/1.0/'">
<Mapping xpath="ID" cloverField="id"/>
</Context>
</Context>

with this xml...

<OLife>
<Party>
<ID>Person_2</ID>
</Party>
</OLife>

but when I use this...

<Context xpath="/OLife" outPort="0" namespacePaths="xsi='http://www.w3.org/2001/XMLSchema-instance';xsd='http://www.w3.org/2001/XMLSchema';xmlns='http://mike.com/services/1.0/'">
<Context xpath="Party/@xsi:type" outPort="1" namespacePaths="xsi='http://www.w3.org/2001/XMLSchema-instance';xsd='http://www.w3.org/2001/XMLSchema';xmlns='http://mike.com/services/1.0/'">
<Mapping xpath="ID" cloverField="id"/>
</Context>
</Context>

with this xml...

<OLife xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://mike.com/services/1.0/">
<Party xsi:type="Person">
<ID>Person_0</ID>
</Party>
</OLife>

It doesnt seem to work with the xsi type.

Any ideas?

jausperger
Posts: 19
Joined: Wed Apr 04, 2007 2:44 pm

Re: XML xsi types with the XML Path Reader

Postby jausperger » Fri Jun 05, 2009 9:38 am

Try this:

<Context xpath="/OLife" outPort="0" namespacePaths="'http://mike.com/services/1.0/';xsi='http://www.w3.org/2001/XMLSchema-instance';xsd='http://www.w3.org/2001/XMLSchema'">
<Context xpath="Party" outPort="1">
<Mapping xpath="ID" cloverField="id"/>
<Mapping xpath="matches(@xsi:type,'Person')" cloverField="isPerson"/>
</Context>
</Context>

Two points:
1) The context may not return true/false. But it would be nice feature..
2) Key sensitive is important for 'http://mike.com/services/1.0/'

Mike
Posts: 26
Joined: Thu Dec 06, 2007 7:39 am

Re: XML xsi types with the XML Path Reader

Postby Mike » Fri Jun 05, 2009 10:55 am

Thanks. That last one worked.

Thanks for your help.

M