Solved

Multipart XML Maniputlation and SQL Insert

Posted on 2004-08-30
5
332 Views
Last Modified: 2008-01-09
I have a unique situation.  I am going to be grabbing various XML documents from another website run by www.sec.gov.  I have already built the code to find the paths of each file I need to them import into my SQL database.  Here is the issue, the XML documents has a high level tags for <ownershipdocument>  then there are various that need to be put in for each record.  Then the document can have multiple tags with <DerivativeTable> and <NonDerivativeTable>.  Some of the subtags share the same tag names under the higher level tags.  

What I want to do is for each of these documents to create multiple records in my SQL Table with the individual names, addresses and document type then just one of the sections for the <derivativeTable> and <NonDerivativeTable>.  So the insert would be like this:

Person, address, document type, nonderivativeSection1
Person, address, document type, nonderivativeSection2
Person, address, document type, DerivativeSection1
Person, address, document type, DerivativeSection2
Person, address, document type, DerivativeSection3

I am integrating this into an ASP page using VBScript so that once I have provided the links that need to be imported, it would read through them all and when finished, the original set of links in the tempDB would be removed.  Here is a sample of the XML file that I will be pulling from ftp://ftp.sec.gov/edgar/data/99302/0000891839-04-000128.txt .  If you notice in the <nonDerivativeTable> there is only one section of <nonDerivativeHolding>.  In the <derivativeTable>  there are 3 sections of <derivativeHolding>.  What I would need is for the NonDerivativeHolding and the 3 DereivativeHolding sections to create a seperate record in the SQL table with all of the data above the NON seciton repeated.  

Please help.
0
Comment
Question by:pkaleda
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:dualsoul
ID: 11935464
hm...it's not clear what technology you are using to work with XML?

For me, i would write XSL style to transform all kinds of your documents in some intermidiate XML format with ready-to-load data, and then use RDBM tools (if any) or write my own simple tools to insert data from this intermidiate XML to DB.
0
 
LVL 6

Author Comment

by:pkaleda
ID: 11937221
I am using XHLHTTP in ASP to grab the data from the site.  The pages are not XML only that I am pulling.  They have standard text headers and footers with no Markup so XSL always breaks.
0
 
LVL 15

Accepted Solution

by:
dualsoul earned 500 total points
ID: 11945651
hm...and the problem is?
you can cut out this headers and footers, does it problem? the rest will be XML?
0
 
LVL 6

Author Comment

by:pkaleda
ID: 11990582
Daulsoul,

DUHHHHHHHH.  Sometimes you are to close to see the simple fix.  Thanks.

0
 
LVL 15

Expert Comment

by:dualsoul
ID: 11991782
you are welcome :)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert Oracle data into XML document 2 80
Excel file not created as expected 7 111
Macro to import XML in Access 2013 2 81
SQL Server XML Select sub tables 4 67
The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question