473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

SQLXML Importing Attribute and Elements into same DB record

I'm importing XML files into a SQLExpress DB using SQLXML and VB.net
2005. I have a simple *.xsd schema file that is pulling in all
attributes from the <Activityelement.

It also has a <Headerelement that I'd like to add the 'Run'
attribute for each record in the TA_HeaderID field. So, in the
example, '879" would be added to each record in the TA_HeaderID field.

Schema file...
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="Activity" sql:relation="TerminalTable">
<xsd:complexType>
<xsd:attribute name="Group" sql:field="TA_Group"
type="xsd:string" use="required" />
<xsd:attribute name="GN" sql:field="TA_GN"
type="xsd:unsignedByte" use="required" />
<xsd:attribute name="Set" sql:field="TA_Set" type="xsd:string"
use="required" />
<xsd:attribute name="Term" sql:field="TA_Term" type="xsd:string"
use="required" />
<xsd:attribute name="TN" sql:field="TA_TN"
type="xsd:unsignedShort" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:schema>

..XML file...
<?xml version="1.0" ?>
<TA>
<Header Version="V418.05"Run="879"/>
<Activity Group="DAB" GN="2" Set="W01" Term="XCTPAY" TN="512"/>
<Activity Group="DAB" GN="2" Set="W01" Term="XGDB03" TN="523"/>
<Activity Group="DAB" GN="2" Set="W01" Term="XGDB06" TN="526"/>
<Activity Group="DAB" GN="2" Set="W01" Term="XGDB09" TN="1080"/>
</TA>

CREATE TABLE [dbo].[TA](
[TA_HeaderID] [int] ,
[TA_Group] [varchar](3),
[TA_GN] [smallint] ,
[TA_Set] [varchar](3) ,
[TA_Term] [varchar](6) ,
[TA_TN] [smallint] ,
) ON [PRIMARY]

I tried adding the following to the schema but all this does is add
one
record to the DB which is not what I desire.

<xsd:element name="Header" sql:relation="TA">
<xsd:complexType>
<xsd:attribute name="Run" sql:field="TA_HeaderId"
type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>

If I add the line
<xsd:attribute name="Run" sql:field="TA_HeaderId" type="xsd:string"
use="required" />
under
'<xsd:element name="Activity" sql:relation="TerminalTable">'
....TA_HeaderId remains empty

How do you edit the schema file to include this Attribute field for
each record?
thanks
Jim
Jun 27 '08 #1
0 1619

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

Similar topics

7
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc....
1
by: Mark Sisson | last post by:
Ok gurus, what would you do? I'm developing an app in C# and trying to use SqlXml but there seems to be a problem at every turn. I want to create a biz object that represents an order to sell a...
0
by: Paula DiTallo | last post by:
Hello Techies-- I am reading an XML document with many nested elements. Many of these elements go to such a variety of tables, that I am trying to simply the read of the document by dumping the...
4
by: Don | last post by:
Hi: When I read my sqlxml results into a reader and deserialize it, I only get the first record deserialized into my object. If I have five records, they're all in the reader. But how do I get...
3
by: Keith Chadwick | last post by:
We current have a bunch of web services that make user of the SQLXML object. A template is created in code which calls several stored procedures each of which returns multiple xml recordsets from...
1
by: sparks | last post by:
I have never done this and wanted to ask people who have what is the best way. One person said import it to excel, then import it into access table. but since this will be done a lot, I am...
5
by: hharriel | last post by:
Hi, I am hoping someone can help me with an issue I am having with excel and ms access. I have collected data (which are in individual excel files) from 49 different school districts. All...
0
by: Patrick.O.Ige | last post by:
Hi guys, How to generate this xsd schema below for SqlXml <?xml version="1.0" ?> <Schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes"...
4
by: vicpada | last post by:
Hi all, I am newbie in all the stuff about xml importing into sql server. What I try to do is simple. It is take an xml file and drop it into a table. I am using VS2005, SQLXML 4.0 and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.