export database to xml file

  • Thread starter Gerald Piotrowski
  • Start date
G

Gerald Piotrowski

Hello,

I am new to access and xml and need some help on figuring out the best way
to accomplish exporting a database query to a xml file. The xml file has to
have a specific structure to it and I am not sure how to get it in this
structure.

<DgnData>
<ElementTemplates>
<NodeData name="TEMP" allowChildren="true">
<NodeData name="Linear" allowChildren="true">
<NodeData name="templine" allowChildren="false">
<ECXAttrData><Ustn_ElementParams xmlns="Ustn_ElementParams.01.00">
<Levels>
<Level>
<Value>6</Value>
</Level>
</Levels>
<LineStyles>
<LineStyle>
<Value />
</LineStyle>
</LineStyles>
<Weights>
<Weight>
<Value>0</Value>
</Weight>
</Weights>
<Colors>
<Color>
<Value>0,1,0:[255,255,255]:\\\</Value>
</Color>
</Colors>
</Ustn_ElementParams></ECXAttrData>
</NodeData>

Can anyone point me in the right direction?
 
J

Jeanette Cunningham

Apologies for double post, don't know how that happened.

Jeanette Cunningham

Jeanette Cunningham said:
Gerald,
see if this site is helpful
http://www.databasejournal.com/features/msaccess/article.php/1465481

Jeanette Cunningham

Gerald Piotrowski said:
Hello,

I am new to access and xml and need some help on figuring out the best
way
to accomplish exporting a database query to a xml file. The xml file has
to
have a specific structure to it and I am not sure how to get it in this
structure.

<DgnData>
<ElementTemplates>
<NodeData name="TEMP" allowChildren="true">
<NodeData name="Linear" allowChildren="true">
<NodeData name="templine" allowChildren="false">
<ECXAttrData><Ustn_ElementParams
xmlns="Ustn_ElementParams.01.00">
<Levels>
<Level>
<Value>6</Value>
</Level>
</Levels>
<LineStyles>
<LineStyle>
<Value />
</LineStyle>
</LineStyles>
<Weights>
<Weight>
<Value>0</Value>
</Weight>
</Weights>
<Colors>
<Color>
<Value>0,1,0:[255,255,255]:\\\</Value>
</Color>
</Colors>
</Ustn_ElementParams></ECXAttrData>
</NodeData>

Can anyone point me in the right direction?
 
G

gllincoln

Hi Gerald,

What Access version? 2003 & 2007 has native XML support, not sure when that
came in, but think XP/2002 had it as well. If the XML is well-formed, Access
can directly import the data. Access will also export tables as XML -
however I have not worked enough with XML to know how to get Access to
export a compound object like your sample.

Your sample is not well-formed by most standards - I suspect what we are
seeing in the forum is not the complete XML document. XML is somewhat
similar to HTML in that each opening argument should have a a closing
argument mated to it.

If what you posted represents a complete sample - then the only way you are
going to get that from an Access query is to write your own export
procedure.

While Access can readily export XML - you won't be getting the properties
included, allowChildren="true", for example. Again - if these elements are
necessities then you may need to create the query, then write code to parse
that recordset into your XML format. Ideally, those applications that want
XML for input should provide a detailed schema that describes the structure
and properties, and requirements. Take a look through the documentation,
and the application's home directory for readme.txt type files.

Hope this helps,
Gordon
 
G

Gerald Piotrowski

Gordon,

You are correct in that the sample that I provided is not the whole
document. It is just a very small snipet of of the document.

When I import my xml file into Access it seems that Access is not reading
the file properly. I found the xsl that the program uses to export my xml
file but access refuses to read it on import. I get an error message saying:

"Microsoft Access has encountered and error processing the XML schema in the
file InRoads.xml. A document must contain exactly one root element."

Everything in the sample must be wrote to the file during export. Can I
create my own xsl file to be used during import and export to have the xml
file wrote in the correct format?

--
Thanks,
Gerald Piotrowski


gllincoln said:
Hi Gerald,

What Access version? 2003 & 2007 has native XML support, not sure when that
came in, but think XP/2002 had it as well. If the XML is well-formed, Access
can directly import the data. Access will also export tables as XML -
however I have not worked enough with XML to know how to get Access to
export a compound object like your sample.

Your sample is not well-formed by most standards - I suspect what we are
seeing in the forum is not the complete XML document. XML is somewhat
similar to HTML in that each opening argument should have a a closing
argument mated to it.

If what you posted represents a complete sample - then the only way you are
going to get that from an Access query is to write your own export
procedure.

While Access can readily export XML - you won't be getting the properties
included, allowChildren="true", for example. Again - if these elements are
necessities then you may need to create the query, then write code to parse
that recordset into your XML format. Ideally, those applications that want
XML for input should provide a detailed schema that describes the structure
and properties, and requirements. Take a look through the documentation,
and the application's home directory for readme.txt type files.

Hope this helps,
Gordon















Gerald Piotrowski said:
Hello,

I am new to access and xml and need some help on figuring out the best way
to accomplish exporting a database query to a xml file. The xml file has
to
have a specific structure to it and I am not sure how to get it in this
structure.

<DgnData>
<ElementTemplates>
<NodeData name="TEMP" allowChildren="true">
<NodeData name="Linear" allowChildren="true">
<NodeData name="templine" allowChildren="false">
<ECXAttrData><Ustn_ElementParams
xmlns="Ustn_ElementParams.01.00">
<Levels>
<Level>
<Value>6</Value>
</Level>
</Levels>
<LineStyles>
<LineStyle>
<Value />
</LineStyle>
</LineStyles>
<Weights>
<Weight>
<Value>0</Value>
</Weight>
</Weights>
<Colors>
<Color>
<Value>0,1,0:[255,255,255]:\\\</Value>
</Color>
</Colors>
</Ustn_ElementParams></ECXAttrData>
</NodeData>

Can anyone point me in the right direction?
 
G

gllincoln

Hi Gerald,

You can give it a shot. In the name of expediency, I have used what Access
generates or created a brute force solution where I picked up the data from
the query or tables and sliced it up using tags copied from sample XML
files. I keep meaning to find time to get a stronger handle on XML and the
XSLTransform object - but by the time I clear my desk lately, my brain is
too fried to tackle it.

Here is the only bookmark I have made on the XSLTransform object.
http://support.microsoft.com/kb/313997/en-us

Heard good things about an XML /XSL editor named Oxygen, it's not
inexpensive but they do offer a free trial download and an academic license
price if that applies in your circumstance. http://www.oxygenxml.com

Hope this helps,
Gordon
 
F

fenfen

Gerald Piotrowski said:
Hello,

I am new to access and xml and need some help on figuring out the best way
to accomplish exporting a database query to a xml file. The xml file has
to
have a specific structure to it and I am not sure how to get it in this
structure.

<DgnData>
<ElementTemplates>
<NodeData name="TEMP" allowChildren="true">
<NodeData name="Linear" allowChildren="true">
<NodeData name="templine" allowChildren="false">
<ECXAttrData><Ustn_ElementParams
xmlns="Ustn_ElementParams.01.00">
<Levels>
<Level>
<Value>6</Value>
</Level>
</Levels>
<LineStyles>
<LineStyle>
<Value />
</LineStyle>
</LineStyles>
<Weights>
<Weight>
<Value>0</Value>
</Weight>
</Weights>
<Colors>
<Color>
<Value>0,1,0:[255,255,255]:\\\</Value>
</Color>
</Colors>
</Ustn_ElementParams></ECXAttrData>
</NodeData>

Can anyone point me in the right direction?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top