471,594 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Change element "AnyType

Hi all,

i'm serializing an arraylist like the following with an "Role" object as
it's item.


ArrayList ar = new ArrayList();
ar.Add( new Role( "Admin" ) );
ar.Add( new Role( "Test" ) );

StringWriter writer = new StringWriter();
XmlSerializer serializer = new XmlSerializer( typeof( ArrayList), null, new
Type[] { typeof(Role) }, new XmlRootAttribute( "roles" ), null );
serializer.Serialize( writer, ar );

<?xml version="1.0" encoding="utf-16"?>
<roles xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<anyType xsi:type="Role" name="Admin" />
<anyType xsi:type="Role" name="Test" />


is there anyway of getting "<anyType>" to appear as "<role>" ?
the "Role class" has the XmlRootAttribute specified as "role".

Nov 12 '05 #1
0 998

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Igor Akkerman | last post: by
3 posts views Thread by Razvan | last post: by
reply views Thread by Sonna Nach | last post: by
1 post views Thread by Brett Gerhardi | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.