Populating Columns Based on Element Attribute?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I'm trying to develop an XML View (XSD Schema) so I can bulkload
(SQLXMLBulkLoad) an XML file into a database. Based on the value of an
Element's attribute, I want to place data from the XML file into specific
columns. However, it appears I need some sort of conditional statement in
XSD that apparently does not exist.

The table (simplified) would be,

FACTS
------------------
FactID (int)
Category (varchar)
StringValue (varchar)
DateValue (date)
NumericValue (numeric)

The source XML is,

<Facts>
<Fact valueType="string">
<Category>Important Things</Category>
<Value>Christmas</Value>
</Fact>
<Fact valueType="date">
<Category>Holidays</Category>
<Value>12/25/06</Value>
</Fact>
<Fact valueType="numeric">
<Category>Academic</Category>
<Value>1.414</Value>
</Fact>

And I would like the resulting table to be filled like this with only ONE of
the columns populated with the Value:

FactID Category StringValue DateValue
NumericValue
------- ------------------ ------------- ------------ ---------------
1 Important Things Christmas NULL NULL
2 Holidays NULL 12/25/06 NULL
3 Academic NULL NULL 1.414

Is this possible with XSD? If not, will I need to first transform (somehow)
the XML to more easily map, column to column, with the database table?

Thanks for any help or direction.


.



Relevant Pages

  • Re: XML parser and writer
    ... them on a calendar. ... Therefore I will need to both easily parse and write new XML files. ... why not some database technology? ... an advanced user can edit the XML file directly at ...
    (comp.lang.java.programmer)
  • Re: Console Window and XmlSchema
    ... The XSD is based off an existing XML file. ... Would a dll run as a scheduled task? ...
    (microsoft.public.dotnet.general)
  • Re: Special Characters not resolving
    ... starting data at the origin in an ORacle database is 2000 characters. ... When the XML isdelivered to me on disk and I load an ... Obviously I need to find either a way to have the XML file provider strip ...
    (microsoft.public.dotnet.xml)
  • Re: dynamic class instantiation
    ... I think mixing XML, ... LDF to python parser is a LOT ... This xml file is then fed into the database at the ...
    (comp.lang.python)
  • Re: XML and the Datagrid
    ... I find it, when it is in memory, exactly as good as the database, because it ... I wished that the complexity from an XML file was in a real database system. ... It is in my opinion the best thing to describe and hold data until now and I ...
    (microsoft.public.dotnet.languages.vb)