how to assign xml perfix with xml attributes?

  • Thread starter Thread starter AA
  • Start date Start date
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
 
It's called namespace, not prefix. And you set it by using Namespace
property of XmlElementAttribute attribute (in your case).

Jerry
 
Back
Top