how to specify namespace in IS document type in WM6.1

I create a IS document type from the following xml(1.xml)

but the namespace is lost. when create a variable of this document type and put values in each segment, then I use pub.xml:documentToXMLString to convert it. It becomes the following xml(2.xml).

it is incorrect xml in format. what’s the matter, and how to fix it?
Thanks a lot.

1.xml (381 Bytes)
2.xml (353 Bytes)

You should create document types from XML schema files (XSDs) and not from instance documents. When you do , the namespace declaration information is stored with the document type in the document type properties and optionally with the constraints of each element.

To include a namespace declaration in an xmlstring created from a document, name the document using some prefix (e.g. “m:”) and then populate the nsdecls parameter with a prefix of “m” and the desired namespace.