dev3 |
Newbie |
|
Canada |
|
|
None Specified |
|
Wednesday, February 28, 2018 |
Wednesday, February 28, 2018 5:34:09 AM |
1 [0.01% of all post / 0.00 posts per day] |
|
Hello dear forum members,
We have generated some c# classes from a set of schemas, each using a different namespace. For example below, lets say that FirstName / LastName types have been defined in a different schema with namespace "http://custom.namespace".
Out of the box we get the xml below, which duplicates "http://custom.namespace" URL in each element like below:
<?xml version="1.0" encoding="utf-8"?> <Customer xmlns="http://default.namespace"> <ID>123</ID> <FirstName xmlns="http://custom.namespace">John</FirstName> <LastName xmlns="http://custom.namespace">Doe</LastName> </Customer>
What do we need to do in code in order to get "http://custom.namespace" namespace listed in a root element with some prefix and have FirstName / LastName elements use it, so it would look like this:
<?xml version="1.0" encoding="utf-8"?> <Customer xmlns="http://default.namespace" xmlns:nax="http://custom.namespace"> <ID>123</ID> <nax:FirstName>John</FirstName> <nax:LastName>Doe</LastName> </Customer>
|
|