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

Home Posts Topics Members FAQ

ADO.NET writing XML file by schema using datasets

Hello,

having some problems by writing XML file by XML schema.
using strongly typed datasets.

Schema:

<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation= "types.xsd" />
<xs:element name="CharactLi st">
<xs:complexType >
<xs:sequence>
<xs:elementname ="Charact"maxOc curs="unbounded ">
<xs:complexType > <xs:sequence>
<xs:element name="Id" type="Id" /> <xs:element
name="Did" type="Id" />
<xs:element name="Operation " type="Operation " />
<xs:element name="DateFrom" type="ISODate" />
<xs:element name="Character istics">
<xs:complexType >
<xs:sequence>
<xs:element name="RiskGroup " type="RiskGroup " minOccurs="0" />
<xs:element name="Interest" type="Interest" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

C# code:

// xml schema compiled to dll
CharactList charactDS = new CharactList();
SqlDataAdapter charactCMD = new SqlDataAdapter( q1, lizingConn);

int i = charactCMD.Fill (charactDS, "Charact");
richTextBox1.Te xt+= "Rows:" + i;

charactDS.Write Xml("Charact.xm l", XmlWriteMode.Wr iteSchema);
....

Everything is working, but generated new XML file isn't what i need:

<Charact>
<Id>4648</Id>
<Did>14252</Did>
<Operation>CO R</Operation>
<DateFrom>200 4-12-31</DateFrom>
</Charact>

It must be like this:

<Charact>
<Id>4648</Id>
<Did>14252</Did>
<Operation>CO R</Operation>
<DateFrom>200 4-12-31</DateFrom>
<Characteristic s>
<Interest>4.265 </Interest>
</Characteristics >
</Charact>

SQL statement is good, it returns Interest and RiskGroup values, how
to put those values to XML?

SQL:

SELECT
SutCSutId AS Id,
SutCIstId AS Did,
SutCOper AS Operation,
Convert(Char(10 ),SutCDate,126) AS DateFrom
Convert(Decimal (18,3),SutCVert e*100) AS Interest,
SutCRizika AS RiskGroup
FROM
SutCharacter AS chr
INNER JOIN Sutartys AS sut
ON chr.SutCSutId = sut.SutId
WHERE
SutCOper <> 'DEF' AND
SutTipas <> 'SV' AND
SutBusena IS NULL AND
SutCIstId IS NOT NULL
;

Sorry, I am new with XML.

thanks for help.
Nov 12 '05 #1
0 1342

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

Similar topics

6
23591
by: Sebastian Kemi | last post by:
How should a write a class to a file? Would this example work: object *myobject = 0; tfile.write(reinterpret_cast<char *>(myobject), sizeof(*object)); / sebek
0
1547
by: Andrew Dawson | last post by:
I am looking into the possibilities that exist from utilizing XML Schema documents to store the structure of datasets that don't change frequently for access in distributed applications. I discovered the XMLSerializer does not support: 1. Any of the simple type restriction facets besides enumeration 2. Namespace based wildcards 3. Identity constraints 4. Substitution groups 5. Blocked elements or types
0
1010
by: Lindy | last post by:
I have a schema file called asc.xsd which I have added to my project .Net project (VB). I am using XMLTextWriter in order to create/write data to a new XML file. Is there a way to access the elements, etc. from this schema in order to simplify my writing of the elements to the new XML file? If so, how would I do this? When I look at the file in the Schema layout, the top node is called "HC_DATA". There are 3 elements in that box:...
1
1242
by: davis | last post by:
Hello, I am working in .Net C# and have an xml file similar to the one below. I have tried using a DataSet but get the error "The same table (Gid) cannot be the child table in two nested relations". The file has a number of parent nodes at the "<ShipmentHeader>" level, each of which have a number of child nodes. I will not know ahead of time which of these parent/child node relationships will occur. I have looked at the XmlTextReader,...
13
2887
by: Jerry C | last post by:
I am using some sample code from gotdotnet to Create DataSet mappings from a xsd schema. I am geting this error. code and error below. I might mention there is also a publictypelibrary file with this file I may have to use it in some way. I am very new at XML so some examples or articles would be helpfull. The error is:
13
1905
by: Martin Z | last post by:
I'm making a CRUD screen for an Oracle database... but problem is that the primary key in that table is populated via an autonumber, which in Oracle is done just with triggers and sequences. Suffice to say that ADO.Net 1.1 is unaware that this column is, despite appearances, optional - which is a problem when creating new rows. I was wondering what the best way to remove the constraint is? I've been bitten too many times by assuming the...
13
8149
by: Bill Nguyen | last post by:
Is it possible to create your won XSD to use with .NET based on an XML content? For example the one below: <?xml version="1.0"?> <pcats:FuelsDoc xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="NAXML-FuelPrice15.xsd"> <pcats:TransmissionHeader>
0
2592
by: ErikaW | last post by:
Hi all, I've tried to google this but could not find a clear solution. I have a Web application developed in JDevloper using mostly html and Javascript. I have a pre-defined PDF form which I merge with a XML file. I want to be able to save the form automatically for the User so as to prevent typing errors i.e. c:/erikaTemp/subFolder/erika_12345.pdf but from what I've seen this can only be done via the the 'File download' pop up which only...
0
8312
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,...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6169
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
4159
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...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
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
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
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.