By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,087 Members | 1,520 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,087 IT Pros & Developers. It's quick & easy.

Exporting To XML File

P: n/a
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file begins
with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>

and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the XML file
so all the file contains is data?

Thanks!

Steve

Nov 13 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
I suspect that what you are seeing is "well-formed XML" -- why would you
want to eliminate any part of it to make it "not-so-well-formed"? Does it
not import properly into the target application, and you have determined
that it is these particular markup items that prevent it doing so?

If all you want is data, you could use comma-delimited text (aka
comma-separated-variable, CSV) instead.

The only reason to use XML, generally, is that the data is going to an
application that accepts XML. Otherwise, you'd want to export in some other
format.

Larry Linson
Microsoft Access MVP
"PC Datasheet" <no****@nospam.spam> wrote in message
news:GM*****************@newsread1.news.atl.earthl ink.net...
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file begins
with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>

and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the XML
file so all the file contains is data?

Thanks!

Steve

Nov 13 '05 #2

P: n/a

"PC Datasheet" wrote:
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file begins
with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>

and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the XML
file so all the file contains is data?

Hi Steve,

One small part of my job is to take University
Line Schedule data and print a report to a pdf
file. I use pdf995 which allows adding Bookmarks
after report has printed if they are in a "xml" file
which is not "well-formed."

As I print the report, I save Page number,
College, and Dept in a table.

I then run a function that writes this data
to the "xml" file in form they require by
opening a file for output, cycling through
a recordset to table above, and printing
lines to the file.

So...it's not difficult to "do-it-yourself."
If you'd like, I could post the code, but
the "form" of the output is specific to
pdf995 bookmarks.

I'm curious though as to how you would expect to
"header" a record in your xml....

gary
Nov 13 '05 #3

P: n/a
"PC Datasheet" <no****@nospam.spam> wrote in message
news:GM*****************@newsread1.news.atl.earthl ink.net
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file
begins with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>
Actually, the dashes that precede the tags are an artifact of Internet
Explorer, reflecting the expansion of a hierarchical node structure --
they aren't in the XML file itself, as you'll see if you edit it in
Notepad.
and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the
XML file so all the file contains is data?


Those tags, which I expect are really <QryExportWOOnSelectedShowDate>
.... data elements ... </QryExportWOOnSelectedShowDate>, are required by
the XML structure. Each pair marks the beginning and end of an element
of the document being represented by the XML file. In this case, the
element is a record. You can't get rid of them and still have a
well-formed XML document.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Nov 13 '05 #4

P: n/a
Hi Gary,

Thanks for your response! Dirk Goldgar (who also responded to this thread)
pointed me to the Application,ExportXML method in AccessXP. I used it to
export a query to XML. Now I may sound a little like I know what I am
talking about but it's a facade. I created a routine to export a series of
queries to XML. It worked; the files were in the specified folder but I know
nothing else about XML. So you ask what I would expect to "header" a record
in my xml... I can't answer that because I do no know what you are speking
about. What does it mean to "header" a record?

Thanks again, Gary!

Steve
"Gary Walter" <ga**********@nospamwamego.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

"PC Datasheet" wrote:
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file begins
with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>

and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the XML
file so all the file contains is data?

Hi Steve,

One small part of my job is to take University
Line Schedule data and print a report to a pdf
file. I use pdf995 which allows adding Bookmarks
after report has printed if they are in a "xml" file
which is not "well-formed."

As I print the report, I save Page number,
College, and Dept in a table.

I then run a function that writes this data
to the "xml" file in form they require by
opening a file for output, cycling through
a recordset to table above, and printing
lines to the file.

So...it's not difficult to "do-it-yourself."
If you'd like, I could post the code, but
the "form" of the output is specific to
pdf995 bookmarks.

I'm curious though as to how you would expect to
"header" a record in your xml....

gary

Nov 13 '05 #5

P: n/a
Thanks for the information, Dirk! BTW, I got Application.ExportXML to work
and created a routine to export a series of queries.

Steve
"Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message
news:ux**************@tk2msftngp13.phx.gbl...
"PC Datasheet" <no****@nospam.spam> wrote in message
news:GM*****************@newsread1.news.atl.earthl ink.net
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file
begins with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>


Actually, the dashes that precede the tags are an artifact of Internet
Explorer, reflecting the expansion of a hierarchical node structure --
they aren't in the XML file itself, as you'll see if you edit it in
Notepad.
and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the
XML file so all the file contains is data?


Those tags, which I expect are really <QryExportWOOnSelectedShowDate>
... data elements ... </QryExportWOOnSelectedShowDate>, are required by
the XML structure. Each pair marks the beginning and end of an element
of the document being represented by the XML file. In this case, the
element is a record. You can't get rid of them and still have a
well-formed XML document.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Nov 13 '05 #6

P: n/a
"PC Datasheet" <no****@nospam.spam> wrote in message
news:cq*****************@newsread3.news.atl.earthl ink.net
Thanks for the information, Dirk! BTW, I got Application.ExportXML to
work and created a routine to export a series of queries.


I guessed as much. You're welcome.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Nov 13 '05 #7

P: n/a
Hi Steve,

I imagine you probably understood better
from Dirk's sage response, but just in case...

Suppose I had a table called Books. Two records
might look like:

Author: John L. Viescas
Title: Building Microsoft Access Applications
ISBN: 0-7356-2039-3
Pub: Microsoft Press
Edition: 2005

Author: Ken Henderson
Title: The Guru's Guide to Transact-SQL
ISBN: 0-201-615760-2
Pub: Addison-Wesley
Edition: 2000

At its very basic, XML is a markup language
that will allow you to produce your hierarchy of
records using beginning and ending tags
(which *you* can define).

It might be loosely analogous with you setting
up headers and footers in an Access report.

In our example, we might define the "header and
footer" tags for a book record as

<book>
</book>

then within each book "header/footer" tag set, we use similar
tags for each fieldname within the record and the field
values go between those tags. At its simplest form,
our XML file might look like:

<book>
<Author>John L. Viescas</Author>
<Title> Building Microsoft Access Applications</Title>
<ISBN> 0-7356-2039-3</ISBN>
<Pub> Microsoft Press</Pub>
<Edition> 2005</Edition>
</book>

<book>
<Author>Ken Henderson</Author>
<Title> The Guru's Guide to Transact-SQL</Title>
<ISBN> 0-201-615760-2</ISBN>
<Pub> Addison-Wesley</Pub>
<Edition> 2000</Edition>
</book>

In your export, it looks like the
process chose to use your query
name for the "header/footer" tags
of a record

<QryExportWOOnSelectedShowDate>
......
......
</QryExportWOOnSelectedShowDate>

I am not an XML expert. It gets a lot more
complicated when you throw in powerful
namespaces, style sheets, and formatting,
but a "well-formed" XML file all starts with
the basics above.

good luck,

gary

{I probably should not have confused
things by using "header" in my original
response...sorry}

"PC Datasheet" wrote:

Thanks for your response! Dirk Goldgar (who also responded to this thread)
pointed me to the Application,ExportXML method in AccessXP. I used it to
export a query to XML. Now I may sound a little like I know what I am
talking about but it's a facade. I created a routine to export a series of
queries to XML. It worked; the files were in the specified folder but I
know nothing else about XML. So you ask what I would expect to "header" a
record in my xml... I can't answer that because I do no know what you are
speking about. What does it mean to "header" a record?

Thanks again, Gary!

Steve
"Gary Walter" <ga**********@nospamwamego.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

"PC Datasheet" wrote:
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file
begins with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>

and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the XML
file so all the file contains is data?

Hi Steve,

One small part of my job is to take University
Line Schedule data and print a report to a pdf
file. I use pdf995 which allows adding Bookmarks
after report has printed if they are in a "xml" file
which is not "well-formed."

As I print the report, I save Page number,
College, and Dept in a table.

I then run a function that writes this data
to the "xml" file in form they require by
opening a file for output, cycling through
a recordset to table above, and printing
lines to the file.

So...it's not difficult to "do-it-yourself."
If you'd like, I could post the code, but
the "form" of the output is specific to
pdf995 bookmarks.

I'm curious though as to how you would expect to
"header" a record in your xml....

gary


Nov 13 '05 #8

P: n/a
Steve, try this code to create some pure xml for any table ...
Function CreatePage(sTable As String) As String

Dim mydb As Database
Dim rst As Recordset
Dim fld As Field
Dim strText As String
Set mydb = CurrentDb
Set rst = mydb.OpenRecordset(sTable, dbOpenSnapshot)

strText = "<?xml version=""1.0""?>" & vbcrlf & vbcrlf
strText = strText & "<" & sTable & ">" & vbcrlf

With rst
Do Until .EOF
For Each fld In rst.Fields
strText = strText & " <" & fld.Name & ">" & rst(fld.Name) & "</" & fld.Name & ">" & vbcrlf
Next
strText = strText & vbcrlf
.MoveNext
Loop
End With
strText = strText & "</" & sTable & ">" & vbcrlf

Set rst = Nothing
Set mydb = Nothing

CreatePage = strText

End Function
--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast/
"PC Datasheet" <no****@nospam.spam> wrote ...
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file begins with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>

and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the XML file so all the file contains is data?

Thanks!

Steve

Nov 13 '05 #9

P: n/a
The best thing to do is go http://www.w3schools.com/ and read the LearnXML
under XML Tutorials. It is quite easy to grasp basic XML. You cannot
operate without a basic understanding of XML. I mean, not if you think you
are really going to do anything with it. You also need to figure out what a
schema is. If you import XML into Access without a schema, all the fields
will be data type Text. That will truncate any long memo fields, and that
is not good. At least I was not too happy about it. If I am saying anything
wrong, I am sure I will be immediately corrected.

Mike Gramelspacher
Ferdinand, Indiana
"PC Datasheet" <no****@nospam.spam> wrote in message
news:2h*****************@newsread2.news.atl.earthl ink.net...
Hi Gary,

Thanks for your response! Dirk Goldgar (who also responded to this thread)
pointed me to the Application,ExportXML method in AccessXP. I used it to
export a query to XML. Now I may sound a little like I know what I am
talking about but it's a facade. I created a routine to export a series of
queries to XML. It worked; the files were in the specified folder but I
know nothing else about XML. So you ask what I would expect to "header" a
record in my xml... I can't answer that because I do no know what you are
speking about. What does it mean to "header" a record?

Thanks again, Gary!

Steve
"Gary Walter" <ga**********@nospamwamego.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

"PC Datasheet" wrote:
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file
begins with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>

and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the XML
file so all the file contains is data?

Hi Steve,

One small part of my job is to take University
Line Schedule data and print a report to a pdf
file. I use pdf995 which allows adding Bookmarks
after report has printed if they are in a "xml" file
which is not "well-formed."

As I print the report, I save Page number,
College, and Dept in a table.

I then run a function that writes this data
to the "xml" file in form they require by
opening a file for output, cycling through
a recordset to table above, and printing
lines to the file.

So...it's not difficult to "do-it-yourself."
If you'd like, I could post the code, but
the "form" of the output is specific to
pdf995 bookmarks.

I'm curious though as to how you would expect to
"header" a record in your xml....

gary


Nov 13 '05 #10

P: n/a
First, thanks to all of you!

I'm taking a shortcut here ---

WHAT ARE the big uses of XML? What are the advantages?

Thanks,

Steve
"PC Datasheet" <no****@nospam.spam> wrote in message
news:GM*****************@newsread1.news.atl.earthl ink.net...
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file begins
with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>

and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the XML
file so all the file contains is data?

Thanks!

Steve

Nov 13 '05 #11

P: n/a
One use I'm seeing more and more of is as a replacement for INI files, since
it allows you to organize the data much easier. In situations where you have
multiple possibilities for a particular value, XML allows you the equivalent
of an array, which (assuming your program checks for the possibility) is
easier than having to check multiple keys.

It's also more reliable for simple text data than csv or fixed-width.

Overall, though, I find it tends to be more "verbose" than the alternatives.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"PC Datasheet" <no****@nospam.spam> wrote in message
news:Ah*****************@newsread2.news.atl.earthl ink.net...
First, thanks to all of you!

I'm taking a shortcut here ---

WHAT ARE the big uses of XML? What are the advantages?

Thanks,

Steve
"PC Datasheet" <no****@nospam.spam> wrote in message
news:GM*****************@newsread1.news.atl.earthl ink.net...
AccessXP in 2000 mode.

I am running a procedure using Application.ExportXML. The XML file begins
with:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
- <QryExportWOOnSelectedShowDate>

and I get the following between each record's data:
<QryExportWOOnSelectedShowDate>
-<QryExportWOOnSelectedShowDate>

Does anyone know if there is a way to prevent these entries in the XML
file so all the file contains is data?

Thanks!

Steve


Nov 13 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.