[Xml-compile] Schema interpretation
Kaare Rasmussen
kaare at jasonic.dk
Mon Sep 8 14:41:37 BST 2008
Kaare Rasmussen writes:
> Hi
>
> I'm a bit stuck with this construct. This is from a .NET schema, and I'm
> trying to access the web service as a client.
>
> <xs:element name="GetDetails">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" name="Identifiers" nillable="true"
> type="q3:ArrayOfstring"
> xmlns:q3="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> I would naively think that the call should look like this
>
> ($answer, $trace) = $GetDetails->(Identifiers => [qw/id1 id2/] );
>
> But this responds with an error:
> ARRAY(0x1de0400) is no HASH at
> /usr/local/share/perl/5.8.8/XML/Compile/Translate/Writer.pm line 460.
> error: complex `x0:Identifiers' requires a HASH of input data, not `ARRAY'
> at {...namespace...}GetDetails/Identifiers
>
> This call actually works:
>
> ($answer, $trace) = $GetDetails->(Identifiers => {string => 'id1'} );
>
> And it responds with details for id1. But is not very useful if I want
> more ids.
>
> So my question is, what interpretation is right? .NET or XML::Compile?
I failed to include the definition of ArrayOfString. It is in another xsd
file, but it looks OK to me.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified"
targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<xs:complexType name="ArrayOfstring">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="string"
nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfstring" nillable="true" type="tns:ArrayOfstring"/>
</xs:schema>
More information about the Xml-compile
mailing list