I can't confirm. You say the DBC name gets into the XML when you don't actively give an alias name. I don't see that.
If I open a table (say orders) of a database (say the Northwind sample database), the workarea (ALIAS()) name is "orders", not "northwind_orders". And the XML also has "orders" tags.
It's simply the alias name. And if you don't use the ALIAS clause of the USE command and don't use the long name convention database!table, you get the file name as the alias name.
CURSORTOCML simply takes the alias name of the workarea. So unless you don't actively prepend the DBC name (JUSTSTEM(DBC()) to the alias name, your XML output has no clue of the database origin.
Closing this with a demonstration using differing physical (file) names and logical names for both db and table:
Code:
Clear
Cd GetEnv("TEMP")
Create Database '1st database'
Create Table 'table1 file.dbf' Name "my table1" (id1 integer)
Create Table '2nd table file.dbf' Name "my table2" (id2 integer)
Use
Close Databases
Open Database '1st database'
ADatabases(laDBC)
? laDBC[1,1]
? Dbc()
? '-------'
* automatically determiend alias name
Select 0
Use 'table1 file'
? Alias()
? Dbf()
? '-------'
* automatically determiend alias name
Select 0
Use '1st database!my table1' again
? Alias()
? Dbf()
? '-------'
* automatically determiend alias name
Select 0
Use '2nd table file'
? Alias()
? Dbf()
? '-------'
* manually specified alias name
Select 0
Use 'my table1' Alias _1st_database__my_table1 again
? Alias()
? Dbf()
You can clearly see why everybody avoids naming DBF files starting with a digit. The file system allows that but the automatic alias name of a USE will just take the workarea name (C for workarea 3, W2164 if you first SELECT 2164).
CursorToXML will always pick up the alias name, no more, no less.
What this also shows: Even if you'd give all your DBC tables long table names that prefix the database name, automatic alias names of workareas don't orient themselves mainly after the internal long table name within the DBC. When you use the DBF files by their file name you still have filenames as alias names, as far as that works (spaces are converted to underlines and of course path and file extension are stripped off).
Now, if you have a problem with the XML you could also use Textmerge to be in full control of the tags and namespace and inline schema or XSD file. For example, it takes very few changes you could do with STRTRAN in the variable before using STRTOFILE, to make that XML compatible for usage in .NET languages. I can't tell from the top of my head, but it would mean to replace <VFPData> and </VFPData>, either simply remove this or replace it with a better-suited XML header.
Oh, and last not least wwXML existed before this VFP internal commands, it did things better and continues to do so and continues to work. And by the way, CURSORTOXML has no dependencies to MS XML libraries/DLLs, but XMLToCursor depends on MSXML3, XMLAdapter, XMLTable and other classes depend on MSXML4.
Bye, Olaf.
Olaf Doschke Software Engineering