473,657 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change element "AnyType

Hi all,

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

-----------------------------------------------------

----[code]
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 XmlRootAttribut e( "roles" ), null );
serializer.Seri alize( writer, ar );

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

-----------------------------------------------------

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

thanks,
Nov 12 '05 #1
0 1060

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8066
by: Igor Akkerman | last post by:
Hi, why does <xs:element name="any" type="xs:anyType" /> not validate <any><foo><bar>blah</bar></foo></any> ?
3
2092
by: Y.S. | last post by:
Hello All, I have the following schema: .... <xs:element name="data_type_id" type="xs:unsignedShort" /> <xs:element name="data_value" type="xs:anyType" /> .... What I want to do is to specify that "If 'data_value' element exists, 'data_type_id' element MUST exist".
1
2058
by: Ulf Heyder | last post by:
Hello, I have to deal with some xml schemas from a third party. This schema contains the following complex type. <?xml version="1.0"?> <xsd:schema ... elementFormDefault="qualified"> .... <xsd:element name="Foobar" type="foo:FoobarType"/> <xsd:complexType name="FoobarType">
0
1301
by: c_capatana | last post by:
i have 2 abstract type defined: <xs:complexType name="InputHeaderType" id="InputHeaderType" abstract="false"> <xs:complexContent> <xs:restriction base="xs:anyType"> <xs:sequence/> <xs:attribute name="InputField" type="sg:InputFieldType" use="required"/> <xs:attribute name="keyfield" type="sg:KeyfieldType"
3
3290
by: Razvan | last post by:
Hi After playing with XML Spy I saw that in DTDs the element of type "any" could contain text and any element that was declared in the DTD. In XML Schema an element of type anyType can contain *any* kind of tags, even tags that were not previously defined in the XML Schema. I am reading the book "Professional XML" that claims the 2
0
1560
by: Sonna Nach | last post by:
Hi All, I am writing a doc/lit web services, in which the elements under SOAPBody is unknown. That is, these two message are acceptable. 1. <SOAP-ENV:Body><Tag1>It is ok</Tag1></SOAP-ENV:Body> 2. <SOAP-ENV:Body><Tag2><Tag3>It is also ok</Tag3></Tag2></SOAP-ENV:Body> The question is, if I write the wsdl as below, it defines the
1
1440
by: Brett Gerhardi | last post by:
Can anyone explain how I can do the following correctly: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="e"/> <xs:complexType name="ct1"> <xs:choice> <xs:any namespace="##any"/> </xs:choice>
0
1600
by: lonnie.lewis | last post by:
Hi all, I'm a consumer of a web service which is defining an output parameter as an "xsd:anyType": <message name="MyTransaction.IsWebServicesDataValid"> ... <part name="varDisplayMessage" type="xsd:anyType"/> <part name="varErrorOccurred" type="xsd:anyType"/> <part name="varErrorDescription" type="xsd:anyType"/> </message>
1
5177
by: JonBeatty | last post by:
I am trying to serialize a class derived from ArrayList called JobQueue that contains an array of objects of the class Job. Using XmlSerializer I can get this to serialize successfully, but I am unable to change the name of the Job element from "anyType" to "Job". It is somewhat of a nit but it does bother me that I'm not understanding the attributes well enough to make this simple change. I have tried numerous options and now I'm just...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7320
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.