Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread EXPORT TABLE to XML
Tue, Dec 17 2013 10:01 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Hi

I'm using this line to export data:-
-------------------------------------------------------------------------------------------------------------------
apmDM.EDBMemory.Execute('EXPORT TABLE "' + sTempFileName + '" TO "'
                 + ExtractFileName(s)
                 + '" IN STORE "ExportFiles" ('
                 + sl.CommaText
                 + ') FORMAT XML ENCODING ANSI INCLUDE HEADERS');
-------------------------------------------------------------------------------------------------------------------
where "apmDM.EDBMemory" is a database in my datamodule
         "s" is the full file path of where I will save this file later.

The resulting file (***attached ***) looks OK in Notepad but in IE, Chrome
or XML Viewer (from MindFusion) I get an error message.

XML Viewer gave me:    Only one top level element is allowed in an XML
document.

Chrome gave me:-         error on line 9 at column 1: Extra content at the
end of the document

IE was verbose (but not particularly helpful :-
--------------------------------------------------------------------------------
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and
then click the Refresh button, or try again later.
Only one top level element is allowed in an XML document. Error processing
resource 'file:///C:/temp/test4.XML'. Line 9, P...
--------------------------------------------------------------------------------

I have successfully used "FORMAT DELIMITED", though I had to put in the
"ENCODING ANSI" before Excel would open it.  I've tried the above export
with and without the encoding clause.

The database is EDB 2.14 Build 2, Delphi XE and it is UNICODE.

Hopefully someone has run into this one before.

Cheers

Jeff
--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz





Attachments: test4.XML
Wed, Dec 18 2013 8:27 AMPermanent Link

Raul

Team Elevate Team Elevate

Have not had to use this myself.

The XML itself looks OK but it's also correct that it lacks a single top
level element. Instead it has <columns> and then <row> as top elements.

Solution would be to surround it with a top level element (for example
<table> as first line and </table> as last in the file).

However that's something EDB should do automatically so i would email
Tim for support.

Raul


On 12/17/2013 10:01 PM, Jeff Cook wrote:
> Hi
>
> I'm using this line to export data:-
> -------------------------------------------------------------------------------------------------------------------
> apmDM.EDBMemory.Execute('EXPORT TABLE "' + sTempFileName + '" TO "'
>                    + ExtractFileName(s)
>                    + '" IN STORE "ExportFiles" ('
>                    + sl.CommaText
>                    + ') FORMAT XML ENCODING ANSI INCLUDE HEADERS');
> -------------------------------------------------------------------------------------------------------------------
> where "apmDM.EDBMemory" is a database in my datamodule
>            "s" is the full file path of where I will save this file later.
>
> The resulting file (***attached ***) looks OK in Notepad but in IE, Chrome
> or XML Viewer (from MindFusion) I get an error message.
>
> XML Viewer gave me:    Only one top level element is allowed in an XML
> document.
>
> Chrome gave me:-         error on line 9 at column 1: Extra content at the
> end of the document
>
> IE was verbose (but not particularly helpful :-
> --------------------------------------------------------------------------------
> The XML page cannot be displayed
> Cannot view XML input using XSL style sheet. Please correct the error and
> then click the Refresh button, or try again later.
> Only one top level element is allowed in an XML document. Error processing
> resource 'file:///C:/temp/test4.XML'. Line 9, P...
> --------------------------------------------------------------------------------
>
> I have successfully used "FORMAT DELIMITED", though I had to put in the
> "ENCODING ANSI" before Excel would open it.  I've tried the above export
> with and without the encoding clause.
>
> The database is EDB 2.14 Build 2, Delphi XE and it is UNICODE.
>
> Hopefully someone has run into this one before.
>
> Cheers
>
> Jeff
>
Thu, Dec 19 2013 3:20 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jeff,

<< XML Viewer gave me:    Only one top level element is allowed in an XML
document. >>

I'll see about adding a top-level <table> element.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Dec 19 2013 4:50 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Thanks Tim

I entered an Incident report for this "the other day".

Cheers

Jeff
--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:4F683556-43AC-4CA6-9BE2-CE093DCA025B@news.elevatesoft.com...
> Jeff,
>
> << XML Viewer gave me:    Only one top level element is allowed in an XML
> document. >>
>
> I'll see about adding a top-level <table> element.
>
> Thanks,
>
> Tim Young
> Elevate Software
> www.elevatesoft.com

Image