Home > Archive > Other Oracle database topics > September 2005 > create XML from cursor









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author create XML from cursor
Frank Dietrich

2005-09-10, 11:23 am

Hi,

I'm looking for a simple way to produce an valid XML file (with external
DTD) from a table.

A function like: CreateXMLfile(tablen
ame, dtd_filename, xml_filename);

Or is the only way

select XMLELEMENT( "elements",
XMLAGG ( XMLELEMENT ( "child_1",
XMLELEMENT ( "child_2",
[and so on ...]

And check by my self that the XML will be valid to the DTD?

regards
Frank
stephen O'D

2005-09-11, 9:23 am

Frank Dietrich wrote:
> Hi,
>
> I'm looking for a simple way to produce an valid XML file (with external
> DTD) from a table.
>
> A function like: CreateXMLfile(tablen
ame, dtd_filename, xml_filename);
>
> Or is the only way
>
> select XMLELEMENT( "elements",
> XMLAGG ( XMLELEMENT ( "child_1",
> XMLELEMENT ( "child_2",
> [and so on ...]
>
> And check by my self that the XML will be valid to the DTD?
>
> regards
> Frank


I have been using the XML capabilities recently, and I have not yet
found a way to validate an XML type using a DTD. I believe you can
validate against an XML Schema document though (these are the successor
to DTD's and are quite a bit more powerful). I am not sure if you can
put the schema in a file, or if it has to be on a URL. The XML
Developers Guide tells you how to do this (in the section it describes
the XMLTYPE api).

amogh

2005-09-13, 7:23 am

stephen O'D wrote:
> Frank Dietrich wrote:
>
>
>
> I have been using the XML capabilities recently, and I have not yet
> found a way to validate an XML type using a DTD. I believe you can
> validate against an XML Schema document though (these are the successor
> to DTD's and are quite a bit more powerful). I am not sure if you can
> put the schema in a file, or if it has to be on a URL. The XML
> Developers Guide tells you how to do this (in the section it describes
> the XMLTYPE api).
>

Validating an XMLType through a DTD is possible.
Check under "Using Triggers to Constrain XMLType Documents"
here: http://www.oracle.com/oramag/oracle/01-nov/o61xml.html

The example uses a a DTD stored as a CLOB for validating
the XML.

Amogh
stephen O'D

2005-09-13, 9:23 am


amogh wrote:
> stephen O'D wrote:
> Validating an XMLType through a DTD is possible.
> Check under "Using Triggers to Constrain XMLType Documents"
> here: http://www.oracle.com/oramag/oracle/01-nov/o61xml.html
>
> The example uses a a DTD stored as a CLOB for validating
> the XML.
>
> Amogh


Ah yes ... I knew it was possible to validate against a DTD using the
inbuild XML Parser. However, I found it to perform very poorly when I
tried it out (I was parsing a document and extracting some fields from
it). Perhaps I was doing something wrong, but I found using the native
XMLTYPE to perform the parsing and extraction of fields worked ~10
times faster. It is certainly worth giving it a go though, as it is
the only way I have found to validate against a DTD.

Frank Dietrich

2005-09-16, 3:23 am

Hi,

amogh wrote:
> stephen O'D wrote:
> Validating an XMLType through a DTD is possible.
> Check under "Using Triggers to Constrain XMLType Documents"
> here: http://www.oracle.com/oramag/oracle/01-nov/o61xml.html
>
> The example uses a a DTD stored as a CLOB for validating
> the XML.


Thanks for the hint. I will look in the sample forum for an code
snippet.

Frank
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com