Showing posts with label document. Show all posts
Showing posts with label document. Show all posts

Monday, March 12, 2012

Localization.Brain Storming.

Hello,

I am working on a Blog and a Documents systems.
What I need is:
1. Each blog can have various language versions.
2. Each document can have various language versions.

I have been thinking about this and I end up with two approaches:
1. Use a structure where all tables depend on a localized table:
BLOGS
|-- BlogsLocalized
|-- BlogsPosts
|-- BlogsRatings
|-- BlogsComments

2. Use a structure where each table has a localized version
BLOGS
|-- BlogsLocalized
|-- BlogsPosts
|-- BlogsPostsLocalized
|-- BlogsComments
|-- BlogsCommentsLocalized

3. Create a simpler, without localization, in SQL and in my web sites have different versions for each language.

The same approach is under thinking for DocumentsTables.

Could someone give me some advice?

I have been looking in internet but until no I couldn't find anything really useful.

Thanks,
Miguel

Hi Miguel,

I would suggest the 3rd way.

In the database, you only store a simple version of the blog contents. But in your website, you can have serveral resource files that contains all the languages for the web site.

HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!

Monday, February 20, 2012

loading xml into SQL 2000

I have some xml files that I want to load into SQL tables. I can use OPENXML and create the table fields and load the document just fine. BUT, is there a way to 1) call the location of the xml document rather than paste all the code and 2) have the table created for me? Below is a SQL example. LMK what you think.

Declare @.idoc int
Declare @.xmldoc varchar (8000)

set @.xmldoc = '
<?xml version="1.0" encoding="utf-8"?>
<ROOT>
<general>
<full_destination_name>London</full_destination_name>
<intro_mini>

London''s contrasts and cacophonies both infuriate and seduce.


</intro_mini>
<intro_short>

London - the grand resonance of its very name suggests history and might. Its opportunities for entertainment by day and night go on and on and on. It''s a city that exhilarates and intimidates, stimulates and irritates in equal measure, a grubby Monopoly board studded with stellar sights.


</intro_short>
<intro_medium>

It''s a cosmopolitan mix of Third and First Worlds, chauffeurs and beggars, the stubbornly traditional and the proudly avant-garde. But somehow - between ''er Majesty and Boy George, Damien Hirst and JMW Turner, Bow Bells and Big Ben - it all hangs together.


</intro_medium>
<intro_quote>

''When a man is tired of London, he is tired of life; for there is in London all that life can afford.'' - Samuel Johnson


</intro_quote>
<timezones>
<timezone>
<gmt_utc>0</gmt_utc>
<timezone_name>Greenwich Mean Time</timezone_name>
</timezone>
</timezones>
<daylight_savings_start>last Sunday in March</daylight_savings_start>
<daylight_savings_end>last Sunday in October</daylight_savings_end>
</general>
</ROOT>'

EXEC sp_xml_preparedocument @.idoc OUTPUT, @.xmldoc


INSERT INTO General

SELECT * FROM OPENXML(@.idoc, 'ROOT/general',3)
WITH General

EXEC master.dbo.sp_xml_removedocument @.idoc

actually, now I load the xml into MS Visual Studio and create the xsd from there. I then load it into a VB Script and successfully execute a DTS package. Question is, where is the table, data?

Here's the xsd file:

<?xml version="1.0" ?>

<xsTongue Tiedchema id="events" targetNamespace="http://tempuri.org/events.xsd" xmlns:mstns="http://tempuri.org/events.xsd"

xmlns="http://tempuri.org/events.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urnTongue Tiedchemas-microsoft-com:xml-msdata"

attributeFormDefault="qualified" elementFormDefault="qualified">

<xs:element name="events" msdata:IsDataSet="true" msdata:EnforceConstraints="False">

<xs:complexType>

<xs:choice maxOccurs="unbounded">

<xs:element name="event">

<xs:complexType>

<xsTongue Tiedequence>

<xs:element name="event_name" type="xsTongue Tiedtring" minOccurs="0" />

<xs:element name="event_from_date" type="xsTongue Tiedtring" minOccurs="0" />

<xs:element name="event_type" nillable="true" minOccurs="0" maxOccurs="unbounded">

<xs:complexType>

<xsTongue TiedimpleContent msdata:ColumnName="event_type_Text" msdata:Ordinal="1">

<xs:extension base="xsTongue Tiedtring">

<xs:attribute name="node_id" form="unqualified" type="xsTongue Tiedtring" />

</xs:extension>

</xsTongue TiedimpleContent>

</xs:complexType>

</xs:element>

</xsTongue Tiedequence>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

</xs:element>

</xsTongue Tiedchema>

and here's the VB Script:

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()
Main = DTSTaskExecResult_Success
Dim objXBulkLoad
Set objXBulkLoad = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")

objXBulkLoad.ConnectionString = "PROVIDER=SQLOLEDB.1;SERVER=SQL-DEV;UID=;PWD=;DATABASE=SQLDBA;"

objXBulkLoad.KeepIdentity = False

'Optional Settings
objXBulkLoad.ErrorLogFile = "c:\temp\NWError.LOG"
objXBulkLoad.TempFilePath = "c:\temp"

'Executing the bulk-load
objXBulkLoad.Execute "C:\TEMP\xml\test_xml\events.xsd", "C:\TEMP\xml\test_xml\events.xml"

Main = DTSTaskExecResult_Success
End Function

shouldn't there now be an events and events and event_type table present?

Loading XML data using DTS.

I am trying to load XML data into SQL Server 2000/sp3a. Since the XML document is in a file, I used DTS to first load the data into a temporary file (with a text field, used varchar(5000) as well) and then copy it into a variable for use in sp_xml_prepare
document.
Everything works fine except that of the date field. For instance, I have defined it as
<ReceivedDate>2004-03-29</ReceivedDate>
However, once it is loaded into the temporary table it is saved as
<ReceivedDate>2004-29-03</ReceivedDate>
I think I am missing something. Please help.
Thanks,
MZeeshan
I'm new at XML, but what I've played with so far, SQL does not create a
root element for your xml file. It looks like it's using the first
record's properties/child elements to name your table?
Robert
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||Well... I ve created a table myself for getting the parsed data. I am getting that through SQL server provided T-SQL utility OPENXML. That is working fine. However, there is some problem in transformation.
|||This is unrelated to the DTS question.
You can add a root element using the root node property of ADO/OLEDB/URL
queries, use an explicit mode query to add it or (only available in the
upcoming SQL Server 2005) use the ROOT directive on a FOR XML clause.
Best regards
Michael
"Robert Taylor" <anonymous@.devdex.com> wrote in message
news:ejkj$lpQEHA.1440@.TK2MSFTNGP10.phx.gbl...
> I'm new at XML, but what I've played with so far, SQL does not create a
> root element for your xml file. It looks like it's using the first
> record's properties/child elements to name your table?
> Robert
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!