PDA

View Full Version : ...and back to XSD



stanl
11-06-2007, 07:04 AM
Access 2003 incorporates 2 methods to export and import xsd, xml, or both to and from tables. You can use the attached mdb and this code to create an export:

Sub xsd()
cXML = ActiveWorkbook.Path & "\employees.xml"
cXSD = ActiveWorkbook.Path & "\employees.xsd"
cMDB = ActiveWorkbook.Path & "\sample1.mdb"
If Dir(cMDB) = "" Then Exit Sub
If Dir(cXML) <> "" Then Kill cXML
If Dir(cXSD) <> "" Then Kill cXSD
cTable = "Employees"
Set oMDB = CreateObject("Access.Application")
oMDB.Visible = 1
oMDB.Application.OpenCurrentDatabase cMDB
'exports xml and embeds schema
oMDB.Application.ExportXml ObjectType:=acExportTable, DataSource:=cTable, DataTarget:=cXML, OtherFlags:=1
'export schema only
'oMDB.Application.ExportXML ObjectType:=acExportTable,DataSource:=cTable,SchemaTarget:=cXSD
oMDB.Application.CloseCurrentDatabase
Set oMDB = Nothing
End Sub



curious though:dunno the xsd data types are validated by the namespace and I have wondered if there is a way to code in some interoperability [say to move Access xsd into an SQL Server table] without resort to purchasing a third party product. There is a freeware version of FoxXML, but it is more concerned with validation.

If anyone comes across any refererence/links to interpreting xsd/xml I would appreciate your posting them. It is easy enough to say "Why go through all the trouble with xsd/xml when you can use transferdatabase() or ado methods?".... and that surely misses the point.

XLGibbs
11-07-2007, 10:21 AM
http://msdn2.microsoft.com/en-us/library/aa167846(%20office.11).aspx

that is pretty useful, but I am unfamiliar at this point.

stanl
11-07-2007, 02:34 PM
that is pretty useful, but I am unfamiliar at this point.

Well, if you get a moment look at http://www.sifinfo.org/

especially the SIF specifications. This is pretty slick stuff, and as a former contractor who worked with the SIMS and SASI systems currently employed in many US Public Schools (which make Cobol look inviting) and some slick marketing to get funding.... there is a need..

while unemployed in early 2007 I was approached by a small company that provided alert systems for schools (for bomb threats, snow days, and other reasons schools shut down in a hurry) who were thinking they would soon need to import SIF into their callout db. Fortunately for them education efficiency is an oxymoron so they said we'll catch you later... but I have since noticed a lot more xsd references...

Oh, and I had recently been dowsized again; hence my earlier post on the other forum about the 2 %^&$#ers who tried to take me for a free ride. I subscribe to a couple of other NG's where the 'help me with my homework' and 'help me with my job - for free' are less tolerated... ahh... sorry about the rant:devil2:

XLGibbs
11-07-2007, 06:12 PM
Oh, and I had recently been dowsized again; hence my earlier post on the other forum about the 2 %^&$#ers who tried to take me for a free ride. I subscribe to a couple of other NG's where the 'help me with my homework' and 'help me with my job - for free' are less tolerated... ahh... sorry about the rant:devil2:

no rant apology necessary. It is the reverse of caveat emptor. I would embed "extra features" in code and just not remove them until they paid up anyway.