Can I set a specific xmlns value for one single element in an XSD?
-
10 martie 2012 01:41
Hello,
Can someone tell me if I can set an xmlns value for one specfic element in my xsd?
Here is a snippet of what is being returned from the endpoint when I issue the webservice request.
....<GetFacilityInfoResult><Facility xmlns="http://cameron.ca"> ....
My XSD is expecting something like:
....<GetFacilityInfoResult><Facility xmlns=http://tempuri.org> .....
Is there some way I can change my xsd so that it expects the "cameron.ca", rather than "tempuri.org" value?
I am a little new at this, so if I am asking a foolish question.................
Thanks
Cameron Conacher
Toate mesajele
-
10 martie 2012 10:49Do you want us to tell you where and how to edit your schema(s)? In that case we need to see the relevant code of the schema(s). Generally schemas work per namespace so with your sample XML using at least two namespaces I would expect you to have at least two schemas.
MVP Data Platform Development My blog
-
10 martie 2012 23:38
Thanks Martin,
These files are fairly large. Can I send them somewhere?
Cameron Conacher
-
11 martie 2012 11:20
These files are fairly large. Can I send them somewhere?
We should be able to solve that by exchanging the relevant parts here in the forum.
For instance if you currently have one schema with
targetNamespace="http://cameron.ca"
and a second one with
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ca="http://cameron.ca">
<xs:import namespace="http://cameron.ca" schemaLocation="schema1.xsd"/>
which somewhere does
<xs:element name="GetFacilityInfoResult">
<xs:complexType>
<xs:sequence>
<xs:element ref="ca:Facility"/>
then you would need to change the targetNamespace of the first schema to say
targetNamespace="http://tempuri.org"
and of course change the import in the second schema as well
<xs:import namespace="http://tempuri.org" schemaLocation="schema1.xsd"/>
If the xs:import does not have a namespace attribute then it is easier, you only have to change the targetNamespace in the first schema.
MVP Data Platform Development My blog
- Marcat ca răspuns de Cameron_C 13 martie 2012 14:43
-
11 martie 2012 18:17Thanks Martin, I will try this.
Cameron Conacher