[xsd-users] Polymorphic type as root element

Boris Kolpackov boris at codesynthesis.com
Wed Jun 30 06:21:56 EDT 2010


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.

Boris
   



More information about the xsd-users mailing list