473,473 Members | 1,581 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Writing an XML doc

Jon
I have a dtd from a client and I need to export our database records to an
XML doc compliant to that DTD.

My question is what's the best method to go about that?

Currently we bring all the values in from a couple different SQL statements
and pop them into variables and then format them and write them out to a CVS
file. The client now wants an XML format of the export.

Is it best to continue to pull the SQL values into variables and perform the
needed calculations and then simply write the XML doc node-by-node? I've
done that before with simpler xml docs.

Is there some way I can build a dataset from the values we get from the SQL
selects and then use exporting to get xml from there? I've never attempted
to use these methods before.

What method would be best?

The dtd follows:

<?xml version="1.0" encoding="UTF-8"?>

<!ELEMENT bac-invoice (invoice-header,invoice-detail,invoice-footer)+>
<!ATTLIST bac-invoice source CDATA #REQUIRED >
<!ATTLIST bac-invoice exportdate CDATA #REQUIRED >
<!ELEMENT invoice-header (inv-id,vnd-id,inv-date,recvd-date,po-id?,
inv-type?,description,special-handling?,
inv-amount,inv-tax)>
<!ELEMENT invoice-detail (detail-line+)>
<!ELEMENT invoice-footer (line-item-count)>

<!-- Invoice Header elements -->

<!ELEMENT inv-id (#PCDATA)>
<!ELEMENT vnd-id (#PCDATA)>
<!ELEMENT inv-date (#PCDATA)>
<!ELEMENT recvd-date (#PCDATA)>
<!ELEMENT po-id (#PCDATA)>
<!ELEMENT inv-amount (#PCDATA)>
<!ELEMENT inv-type (#PCDATA)>
<!ELEMENT inv-tax (#PCDATA)>
<!ELEMENT description (#PCDATA) >
<!ELEMENT special-handling (#PCDATA) >

<!ELEMENT detail-line (
lineitem-id,
property-id,
tenant?,
lease?,
unit?,
project-type?,
project-ref?,
task-stage?,
contract-element?,
seg-ref?,
development?,
tax-status?,
trx-subtype?,
fnc-code?,
item-amount,
item-tax?,
(service-from,service-to)?,
(gl-company,gl-costcenter)?,
charge-code,
above-standard,
item-description,
tax-parcel?,
tax-lot?,
tax-paymentno?,
tax-period?,
tax-year?,
(utl-uom,utl-units,utl-meter)?,
wo-number?,
wo-contract?,
wo-svc-code?,
wo-requestor?,
ap-clerk-id)


<!-- Detail Line Elements -->

<!ELEMENT lineitem-id (#PCDATA)>
<!ELEMENT property-id (#PCDATA)>
<!ELEMENT tenant (#PCDATA)>
<!ELEMENT lease (#PCDATA)>
<!ELEMENT unit (#PCDATA)>
<!ELEMENT project-type (#PCDATA)>
<!ELEMENT project-ref (#PCDATA)>
<!ELEMENT task-stage (#PCDATA) >
<!ELEMENT gl-company (#PCDATA)>
<!ELEMENT gl-costcenter (#PCDATA)>
<!ELEMENT above-standard (#PCDATA)>
<!ELEMENT charge-code (#PCDATA)>
<!ELEMENT item-description (#PCDATA)>
<!ELEMENT contract-element (#PCDATA) >
<!ELEMENT item-amount (#PCDATA) >
<!ELEMENT item-tax (#PCDATA) >
<!ELEMENT development (#PCDATA) >
<!ELEMENT fnc-code (#PCDATA) >
<!ELEMENT seg-ref (#PCDATA) >
<!ELEMENT service-from (#PCDATA) >
<!ELEMENT service-to (#PCDATA) >
<!ELEMENT tax-parcel (#PCDATA) >
<!ELEMENT tax-lot (#PCDATA) >
<!ELEMENT tax-paymentno (#PCDATA) >
<!ELEMENT tax-period (#PCDATA) >
<!ELEMENT tax-year (#PCDATA) >
<!ELEMENT tax-status (#PCDATA) >

<!-- Transaction SubType -->

<!ELEMENT trx-subtype (#PCDATA) >
<!ELEMENT utl-units (#PCDATA) >
<!ELEMENT utl-uom (#PCDATA) >
<!ELEMENT utl-meter (#PCDATA)>
<!ELEMENT wo-contract (#PCDATA) >
<!ELEMENT wo-number (#PCDATA) >
<!ELEMENT wo-requestor (#PCDATA) >
<!ELEMENT wo-svc-code (#PCDATA) >
<!ELEMENT ap-clerk-id (#PCDATA) >

<!-- Footer Elements -->
<!ELEMENT line-item-count (#PCDATA) >
Dec 30 '05 #1
0 768

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

Similar topics

48
by: Joseph | last post by:
Hi I'm writing a commercial program which must be reliable. It has to do some basic reading and writing to and from files on the hard disk, and also to a floppy. I have foreseen a potential...
6
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
3
by: ishekar | last post by:
Hi, I have an application where i want to write data to a file, the data is being sent from an external source. I know the total size of the data and then i retrieve the data in small segments...
1
by: Daniel | last post by:
System.IO.StreamWriter Close or Flush method to shut down the computer in such a way that just part of the file is written? or an empty file is written? Also if the Close or Flush is to a...
5
by: Jeong-Gun Lee | last post by:
I'm writing a code of writing a value to a specific memory address. ================================================================= #include <stdio.h> int main() { long air; long...
102
by: Xah Lee | last post by:
i had the pleasure to read the PHP's manual today. http://www.php.net/manual/en/ although Pretty Home Page is another criminal hack of the unix lineage, but if we are here to judge the quality...
16
by: Claudio Grondi | last post by:
I have a 250 Gbyte file (occupies the whole hard drive space) and want to change only eight bytes in this file at a given offset of appr. 200 Gbyte (all other data in that file should remain...
6
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
3
by: Barry Flynn | last post by:
Hi I am working with a VB 2005 program which has been converted from VB6. It writes data out to a flat file, with code like the following line WriteLine(riFileNo, "Hist", lsAssetID,...
89
by: Skybuck Flying | last post by:
Hello, This morning I had an idea how to write Scalable Software in general. Unfortunately with Delphi 2007 it can't be done because it does not support operating overloading for classes, or...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
1
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.