[xsd-users] Polymorphic type as root element
Benjamin Schindler
bschindler at inf.ethz.ch
Wed Jun 30 08:43:33 EDT 2010
Hi
I tried the following too, but to no avail:
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="EnsightReaderSettings_t">
<filePath>somePath</filePath>
<firstSelectedTimeStep>0</firstSelectedTimeStep>
<lastSelectedTimeStep>1</lastSelectedTimeStep>
</settings>
On 06/30/2010 12:21 PM, Boris Kolpackov wrote:
> Hi Benjamin,
>
> Benjamin Schindler <bschindler at inf.ethz.ch> writes:
>
>> Now, I'd like to parse something like this (just that):
>>
>> <settings xsi:type="EnsightReaderSettings_t">
>> <filePath>somePath</filePath>
>> <firstSelectedTimeStep>0</firstSelectedTimeStep>
>> <lastSelectedTimeStep>1</lastSelectedTimeStep>
>> </settings>
>
> Well, this XML document is invalid since there is no declaration for
> the 'xsi' prefix.
>
> There is a way to parse this as a document fragment (as opposed to a
> standalone document) with the DOMLSParse::parseWithContext() function.
> See the Xerces-C++ documentation for details. Also note that this
> function is only available since Xerces-C++ 3.1.0.
>
>
>> I invoked parseBaseSettings(myFstream), but it fails to parse this.
>
> What is parseBaseSettings? Is it one of the generated parsing functions?
> Is it your own function? If it is a generated parsing function then the
> most likely reason is the lack of the namespace declaration mentioned
> above.
Sorry for not mentioning: EnsightReaderSettings_t is a type which
extends BaseSettings, and parseBaseSettings is therefore the parser
function to parse any BaseSettings type and should return a
EnsightReaderSettings object (in form of a BaseSettings
reference/pointer of course)
Cheers
Benjamin
>
> Boris
>
More information about the xsd-users
mailing list