Page 1 of 1

"Generate Sample XML" add a namespace

Posted: Wed Jan 12, 2011 1:40 am
by mpbahl
I'm using "Generate Sample XML Files..." to generate xml from a schema. when the xml is generated there is no namespace on the nodes.
For example: <person> rather than <ns1:person>
I've set the defaultNamespace and there's only one namespaceMapping.

How can I get the namespace to be added to the elements?

Thanks
Michael

Re: "Generate Sample XML" add a namespace

Posted: Wed Jan 12, 2011 12:46 pm
by adrian
Hello,

What settings are you using in the Namespaces section from the Generate Sample XML Files dialog?

If you picked a namespace(e.g. my.namespace) from the Default Namespace combo then in the generated sample you will find the default namespace declaration on the root(e.g. <root xmlns="my.namespace">).
This makes redundant the prefix declaration for the same namespace, so it is omitted in the samples(it wouldn't be used anyway).

If you want to force a namespace prefix to be used in the generated sample then set the Default Namespace to <NO_NAMESPACE> or if you have several namespaces, a different namespace than the one you want a prefix for.

Regards,
Adrian