"Generate Sample XML" add a namespace

Oxygen general issues.
mpbahl
Posts: 3
Joined: Thu Jan 06, 2011 7:09 pm

"Generate Sample XML" add a namespace

Post 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
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: "Generate Sample XML" add a namespace

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply