PC Review


Reply
Thread Tools Rate Thread

how to assign xml perfix with xml attributes?

 
 
AA
Guest
Posts: n/a
 
      30th Apr 2004
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


 
Reply With Quote
 
 
 
 
Jerry Pisk
Guest
Posts: n/a
 
      30th Apr 2004
It's called namespace, not prefix. And you set it by using Namespace
property of XmlElementAttribute attribute (in your case).

Jerry

"AA" <(E-Mail Removed)> wrote in message
news:%23Df$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
AA
Guest
Posts: n/a
 
      30th Apr 2004
Thanks, but can you send a basic example using the classes Employee

thanks again

AA

"Jerry Pisk" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> It's called namespace, not prefix. And you set it by using Namespace
> property of XmlElementAttribute attribute (in your case).
>
> Jerry
>
> "AA" <(E-Mail Removed)> wrote in message
> news:%23Df$(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WebControl.Attributes.Add and custom attributes P4trykx Microsoft ASP .NET 2 31st Jan 2007 04:33 PM
Data value display attributes linked to table attributes MDT at Paragon Home Inspections, LLC Microsoft Excel Charting 0 15th Nov 2006 12:53 AM
Assign attributes to a property at runtime ? Herve Bocuse Microsoft Dot NET Framework 1 21st Feb 2005 07:04 PM
Upgrade W2K -> W2K3, Mangled Attributes, Can't find attributes =?Utf-8?B?Tmljay1NYXJz?= Microsoft Windows 2000 Active Directory 0 10th Feb 2005 10:43 PM
Setting some file attributes doesn't work with FileInfo.Attributes =?Utf-8?B?Sm9obiBSLg==?= Microsoft C# .NET 7 18th Nov 2004 09:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:56 PM.