how to assign xml perfix with xml attributes?

A

AA

hi! :)
How can I assign xml prefix using attributes?

For example:

I have this class

Public Class Employee
Public Name as String = ""
Public LastName as String = ""
End Class

When I serialize this object the result is
<Employee>
<Name/>
<LastName/>
</Employee>

But I want that the result be...
<com:Employee>
<Name/>
<LastName/>
</com:Employee>

How can I do that using attributes like

<XmlSomeAttributeLikePrefix("com")> _
Public Class Employee
Public Name as String = ""
Public LastName as String = ""
End Class


Thanks a lot

AA
 
J

Jerry Pisk

It's called namespace, not prefix. And you set it by using Namespace
property of XmlElementAttribute attribute (in your case).

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top