beaniebear
Programmer
I have been trying to upload XML to a SQL server database. Using an XDR schema and a vbs file utilising the SQLXMLBulkLoad object.
This works fine until I get to the <story></story> tags which have other elements such as <i></i> and <p></p> within.
Example XML :-
<allnews>
<news>
<headline>News Article</headline>
<shortheadline>News</shortheadline>
<source>A newspaper</source>
<story>Example of a <i>Story</i></story>
</news>
</allnews>
Example XDR :-
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql" >
<ElementType name="headline" dt:type="string" />
<ElementType name="shortheadline" dt:type="string" />
<ElementType name="source" dt:type="string" />
<ElementType name="story" dt:type="string" />
<ElementType name="allnews" sql:is-constant="1">
<element type="news" />
</ElementType>
<ElementType name="news" sql:relation="News">
<element type="headline" sql:field="Headline" />
<element type="shortheadline" sql:field="ShortHeadline" />
<element type="source" sql:field="source" />
<element type="story" sql:field="story" />
</ElementType>
</Schema>
Example VBS :-
set objBL=createobject("SQLXMLBulkLoad.SQLXMLBulkLoad"
objBL.ConnectionString = ""
objBL.ErrorLogFile = "c:\error.log"
objBL.Execute "C:\newsmapping.xml", "c:\news.xml"
set objBL = nothing
How can I make this ignore any styling tags such as bold, italics etc?
Also is this the best way to get data into a SQL database? Would another way be simlper?
Thanks, Jo
This works fine until I get to the <story></story> tags which have other elements such as <i></i> and <p></p> within.
Example XML :-
<allnews>
<news>
<headline>News Article</headline>
<shortheadline>News</shortheadline>
<source>A newspaper</source>
<story>Example of a <i>Story</i></story>
</news>
</allnews>
Example XDR :-
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql" >
<ElementType name="headline" dt:type="string" />
<ElementType name="shortheadline" dt:type="string" />
<ElementType name="source" dt:type="string" />
<ElementType name="story" dt:type="string" />
<ElementType name="allnews" sql:is-constant="1">
<element type="news" />
</ElementType>
<ElementType name="news" sql:relation="News">
<element type="headline" sql:field="Headline" />
<element type="shortheadline" sql:field="ShortHeadline" />
<element type="source" sql:field="source" />
<element type="story" sql:field="story" />
</ElementType>
</Schema>
Example VBS :-
set objBL=createobject("SQLXMLBulkLoad.SQLXMLBulkLoad"
objBL.ConnectionString = ""
objBL.ErrorLogFile = "c:\error.log"
objBL.Execute "C:\newsmapping.xml", "c:\news.xml"
set objBL = nothing
How can I make this ignore any styling tags such as bold, italics etc?
Also is this the best way to get data into a SQL database? Would another way be simlper?
Thanks, Jo