Aldwoni
Aldwoni

Reputation: 1158

(WCF) elementFormDefault="qualified" and attributeFormDefault="qualified" possible

Situation: I need to build a webservice based on an XSD.

It is possible to make an WCF webservice when the XSD says:

elementFormDefault="qualified" attributeFormDefault="qualified"

OR

elementFormDefault="unqualified" attributeFormDefault="unqualified"

I could not find any clear answer on Stackoverflow or Google. Is one of these possible or both?

If it is possible, Is it combinable with MessageContracts and DataContracts?

based on Microsoft It looks not possible:

attributeFormDefault Ignored.

elementFormDefault Must be qualified. All elements must be qualified for a schema to be supported by DataContractSerializer. This can be accomplished by either setting xs:schema/@elementFormDefault to "qualified" or by setting xs:element/@form to "qualified" on each individual element declaration.

I also found this which doesn't like it:

In general, because of the potential confusion and odd syntax that can arise from a mix of global and local elements in a single document, along with issues that can arise with the default namespace, it is advised to stick with elementFormDefault=”qualified”. It may be more verbose, but it is also much clearer which namespace/schema owns a given element. The XML document author can always rely on the “default namespace” if they want to reduce the amount of prefixes. In addition, attributeFormDefault should be unqualified due to the potential conflict when using a default namespace.

Upvotes: 5

Views: 955

Answers (0)

Related Questions