Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requesting Implementation Recommendations...

Status
Not open for further replies.

Enigma007

Programmer
Jun 22, 2004
15
US
Heya.

I am new here as I am new to XML, and I was hoping I could find some guidance.

I am in the process of implementing a system that has been outlined as follows:

There are 2 databases. The DBMSs being used on both sides are unknown. At this point I have to just work on creating everything that I can while following the specifications given.

Both databases have differing schema. A DTD has been specified that both sides have agreed upon. Data only goes one way to update the destination database.

Data needs to flow as so:

1. A piece of code connects to the source database via ODBC. This code extracts the data found in the database and produces source.xml according to the DTD.

2. The source.xml is tested against the DTD for validity.

3. If valid, source.xml is sent to the destination facility.

4. A piece of code at the destination facility takes source.xml and inserts it into the destination database.

With that said... Here is where I stand. I will be using C++ for the coding. So:

1. I have read a good deal about the varying APIs, but is there any that could be recommended (or that I could be told to avoid for that matter)?

2. I have read about DOM and SAX, but I really don't know what would be best for my situation.

3. Are there any hints and tips you could give to a person new to XML implementation?

I apologize for being long-winded, but I truly appreciate any help that can be given.

Thanks,
Enigma
 
[ul]
[li]We have source[/li]
[li]Then a miracle occurs[/li]
[li]Now we have desired results[/li]
[/ul]

You, my man, are being had. I wouldn't touch this until I got my hands on both database schemas. (What could be easier for your employer to produce?) If you can't begin with what is already known, then you're being required to perform magic. Nuts to that!
 
All my XML applications have been written in Java, so I will answer your questions as best as possible.

I think the type of situation you are talking about would best utilize SAX instead of DOM. DOM requires more memory and should only be used if you need to modify the Document Object or reverse traverse through the document. Sounds like you just want to parse the document with validation turned on, send the xml file, then read the document and when you hit certain events, load the documents data into database tables. Perfect for SAX. SAX is faster and used for forward traversing XML files. SAX fires off events to a handler as it hits certain parts of the XML file. For instance, it throws startDocument and endDocument events at the beginning and end of the document. Then it can through startElement and endElement for every element that it hits in the XML file.

Hope this helps.
 
Hehe. They do indeed expect me to perform miracles on a regular basis. I guess it is even easier to convince someone to do the impossible if he does not know what he is getting into.

In any event, while I can't create a solid implementation without the schema, I am looking to gain some experience (just playing around) in the time being.

Thank you Wirelessjay for your input. I had been thinking that was the way to go, but, having no experience, it makes me feel better to have some confirmation of my thoughts.

I really appreciate the help.

Sincerely,
Enigma

 
Enigma, my initial reaction was to write something very similar to wirelessjay's response. But I erased it: you don't know which approach to parsing the XML file will be better until you find out how similar (or wildly different) the database schemas are. You can't get that from a DTD. As it stands, you still don't have enough information to make any decisions.

Been there, done that, regretted it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top