[Openroad-users] Importing XML files into Ingres/OpenROAD
Bloomfield, Martin (PSD)
Martin.Bloomfield at psd.defra.gsi.gov.uk
Thu Nov 16 01:39:08 EST 2006
Kim,
Sorry to bother you again. Thanks for the XSL transformation code.
I've tested it in XML-spy and it works fine. However, I'm struggling to
work out how to do this in OpenROAD. I've created myself an external
class pointing to the MSXML 4 control. Unfortunately, not having used
external controls before, I'm rather lost as to how to put the XSL code
into the control and get it to process the b_so_preprocessxml parameter
in the iixmlpreprocess procedure.
Would it be possible for you to send me sample code detailing how to use
the external control, or an export of the procedure? Also, when I
create my own "ReadFile" procedure should the class I pass to it map to
the root element of the XML file? Also, how should I name array
attributes which correspond to repeatable complex XML elements?
for info my XML doc has following structure:
<Results> <-- Do I pass the UserClass
"Results" to my procedure at this level? -->
<sample SampleId="0001/2006"> <-- Should this be an ARRAY of
Sample in UserClass "Results"? -->
<item1>item1</item1>
<item2>data</item2>
<residue Code="ABC"> <-- Should this be an ARRAY of
Residue in UserClass "Sample"? -->
<detection>1.2</detection>
<limit>1.0</limit>
</residue>
<residue Code="DEF">
<detection>1.4</detection>
<limit>0.5</limit>
</residue>
</sample>
<sample SampleId="0002/2006">
<item1>item2</item1>
<item2>data2</item2>
<residue Code="ABC">
<detection>1.2</detection>
<limit>1.0</limit>
</residue>
<residue Code="DEF">
<detection>1.4</detection>
<limit>0.5</limit>
</residue>
</sample>
</Results>
Many thanks for your assistance,
Martin Bloomfield.
____________________________________________
Application Developer & Database Administrator
IT Branch,
Pesticides Safety Directorate
YORK
Email: martin.bloomfield at psd.defra.gsi.gov.uk
<mailto:martin.bloomfield at psd.defra.gsi.gov.uk>
Website: www.pesticides.gov.uk <http://www.pesticides.gov.uk/>
-----Original Message-----
From: Kim Ginnerup [mailto:kgi at bording.dk]
Sent: Tuesday, November 14, 2006 11:48 AM
To: Bloomfield, Martin (PSD)
Cc: openroad-users at peerlessit.com
Subject: SV: [Openroad-users] Importing XML files into
Ingres/OpenROAD
Martin,
And here it is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1"
indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="*">
<xsl:copy>
<xsl:if test="@*">
<xsl:for-each select="@*">
<xsl:element name="{name()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:if>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet
Regards,
Kim
________________________________
Fra: Bloomfield, Martin (PSD)
[mailto:Martin.Bloomfield at psd.defra.gsi.gov.uk]
Sendt: 14. november 2006 11:29
Til: Kim Ginnerup
Emne: RE: [Openroad-users] Importing XML files into
Ingres/OpenROAD
Kim,
As I am new to XML, I would be extremely grateful if you are
able to send me the XSL script, as in my attempts to create an XSD, I've
discovered that unique rules only seem to work on attributes, so have
had to put the unique identifiers into attributes. Obviously, I need to
import these into the database, so will need to convert them to
elements.
Many thanks,
Martin Bloomfield.
____________________________________________
Application Developer & Database Administrator
IT Branch,
Pesticides Safety Directorate
YORK
Email: martin.bloomfield at psd.defra.gsi.gov.uk
<mailto:martin.bloomfield at psd.defra.gsi.gov.uk>
Website: www.pesticides.gov.uk <http://www.pesticides.gov.uk/>
-----Original Message-----
From: openroad-users-bounces at peerlessit.com
[mailto:openroad-users-bounces at peerlessit.com] On Behalf Of Kim Ginnerup
Sent: Tuesday, November 14, 2006 5:31 AM
To: openroad-users at peerlessit.com
Subject: Re: [Openroad-users] Importing XML files into
Ingres/OpenROAD
I forgot to mention
OpenROAD only reads elements from an xml-file all
attributes are ignored.
But you can make a very simple generic XSL-script that
change all attributes to elements.
Put that transformation into iixmlpreprocess using
msxml.
I have such a script somewhere if you are interested I
think it is less than 10 lines of xsl.
Kim
Department for Environment, Food and Rural Affairs (Defra)
This email and any attachments is intended for the named
recipient only.
If you have received it in error you have no authority to use,
disclose,
store or copy any of its contents and you should destroy it and
inform
the sender.
Whilst this email and associated attachments will have been
checked
for known viruses whilst within Defra systems we can accept no
responsibility once it has left our systems.
Communications on Defra's computer systems may be monitored
and/or
recorded to secure the effective operation of the system and for
other
lawful purposes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 18254 bytes
Desc: not available
Url : http://peerlessit.com/pipermail/openroad-users/attachments/20061115/1b08d4fa/attachment.bin
More information about the Openroad-users
mailing list