Help Needed in updating XLM format

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I inherited an application that can import XML data from two tables into an application. They now want to be able export the data in a few tables as an xml file. I have the button and am using ExportXML to create the XML file. However the xml file is not
in the format needed.
My predecessor left me with some sample xml import files along with corresponding xsd files (located in same folder as xml files).

On top of the xml files there is a XMLSchema-instance defined
<?xml version="1.0"?><br/>
<Section16_5 <br/>
xmlns=" http://mywebpage.ky.gov/Pages http:// mywebpage http://mywebpage.ky.gov/Pages .com/Pages "<br/>
xmlns:xsi=" http://minepermits.ky.gov/Pages/XMLSchema-instance http:// mywebpage http://minepermits.ky.gov/Pages/XMLSchema-instance ..com/Pages/XMLSchema-instance "<br/>
xsi:schemaLocation=" http://minepermits.ky.gov/Pages/Section16_5.xsd http:// mywebpage http://minepermits.ky.gov/Pages/Section16_5.xsd .com/Pages/Section16_5.xsd
<br/>
I had to add several fields to the tables being exported which will also change the data imported/exported. I changed the xsd file to include the new fields

I am assuming that I need to update the files on our website? If so, what files?Also, I am using the following code to create the xml file. How would I include these files in the xml file created?

<pre class="prettyprint lang-vb Private Sub btnExpGW_xml_Click()
Application.ExportXML ObjectType:=acExportQuery, DataSource:="Qry_GW_XMLExp", _
DataTarget:="C:KYDNRMPA03Exp_xmlGW_Samples.xml"
End Sub[/code]

Finally, will these schemas automatically format the XML data file to what is included in the xsd file.
For reference I have included both the XML file being generated by the above sub procedure and the xsd file which shows the format that the data needs to be in.
I appreciate any help or guidance you can provide
XML File generated by above Sub Procedure
<pre class="prettyprint <?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2012-10-28T14:20:41
<Qry_GW_XMLExp>
<Section16_5_Locations.Station_Number>GW1</Section16_5_Locations.Station_Number>
<CountyCode>37</CountyCode>
<BasinCode>KY</BasinCode>
<QUADCode>0355</QUADCode>
<Watershed>Watershed Example</Watershed>
<Lat_Degrees>66</Lat_Degrees>
<Lat_Mins>66</Lat_Mins>
<Lat_Secs>66</Lat_Secs>
<Long_Degrees>66</Long_Degrees>
<Long_Mins>66</Long_Mins>
<Long_Secs>66</Long_Secs>
<Local_Stream>Elkhorn</Local_Stream>
<Collecting_Firm>Collecting Firm Example</Collecting_Firm>
<Analyzing_Firm>ABC Coal</Analyzing_Firm>
<Comments>This is a test</Comments>
<Station_Type>5</Station_Type>
<Section16_5_Data.Station_Number>GW1</Section16_5_Data.Station_Number>
<Sample_Number>1</Sample_Number>
<Sample_Date>2012-10-02T00:00:00</Sample_Date>
<ACIDITY>9</ACIDITY>
<ALKALINITY>9</ALKALINITY>
<Depth>200</Depth>
<Discharge>788</Discharge>
<FEDISS>76</FEDISS>
<FETOTAL>567</FETOTAL>
<MDISS>54</MDISS>
<MTOTAL>67</MTOTAL>
<pH>9</pH>
<SODISS>0.76</SODISS>
<CONDUCTIVITY>4</CONDUCTIVITY>
<SETTSOLIDS>0.675</SETTSOLIDS>
<TDS>65</TDS>
<TSS>22</TSS>
<ODISS>0.567</ODISS>
<TEMP>66</TEMP>
</Qry_GW_XMLExp>
<Qry_GW_XMLExp>
<Section16_5_Locations.Station_Number>GW1</Section16_5_Locations.Station_Number>
<CountyCode>37</CountyCode>
<BasinCode>KY</BasinCode>
<QUADCode>0355</QUADCode>
<Watershed>Watershed Example</Watershed>
<Lat_Degrees>66</Lat_Degrees>
<Lat_Mins>66</Lat_Mins>
<Lat_Secs>66</Lat_Secs>
<Long_Degrees>66</Long_Degrees>
<Long_Mins>66</Long_Mins>
<Long_Secs>66</Long_Secs>
<Local_Stream>Elkhorn</Local_Stream>
<Collecting_Firm>Collecting Firm Example</Collecting_Firm>
<Analyzing_Firm>ABC Coal</Analyzing_Firm>
<Comments>This is a test</Comments>
<Station_Type>5</Station_Type>
<Section16_5_Data.Station_Number>GW1</Section16_5_Data.Station_Number>
<Sample_Number>2</Sample_Number>
<Sample_Date>2012-10-04T00:00:00</Sample_Date>
<ACIDITY>6</ACIDITY>
<ALKALINITY>6</ALKALINITY>
<Depth>88</Depth>
<Discharge>87</Discharge>
<FEDISS>98</FEDISS>
<FETOTAL>45</FETOTAL>
<MDISS>66</MDISS>
<MTOTAL>99</MTOTAL>
<pH>3</pH>
<SODISS>77</SODISS>
<CONDUCTIVITY>5</CONDUCTIVITY>
<SETTSOLIDS>56</SETTSOLIDS>
<TDS>765</TDS>
<TSS>567</TSS>
<ODISS>45</ODISS>
<TEMP>77</TEMP>
</Qry_GW_XMLExp>
</dataroot>[/code]
Copy of the XSD file I changed to include the new fields<br/>
<pre class="prettyprint <?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema
<xs:element name="Section16_5
<xs:complexType mixed="true
<xs:sequence>
<xs:element name="Section16_5_Locations
<xs:complexType>
<xs:sequence>
<xs:element name="Station_Number" type="xs:string" />
<xs:element name="CountyCode" type="xs:unsignedByte" />
<xs:element name="BasinCode" type="xs:string" />
<xs:element name="QUADCode" type="xs:unsignedByte" />
<xs:element name="Station_Type" type="xs:unsignedByte" />
<xs:element name="Watershed" type="xs:string" />
<xs:element name="Lat_Degrees" type="xs:unsignedByte" />
<xs:element name="Lat_Mins" type="xs:unsignedByte" />
<xs:element name="Lat_Secs" type="xs:unsignedByte" />
<xs:element name="Long_Degrees" type="xs:unsignedByte" />
<xs:element name="Long_Mins" type="xs:unsignedByte" />
<xs:element name="Long_Secs" type="xs:unsignedByte" />
<xs:element name="Local_Stream" type="xs:string" />
<xs:element name="Collecting_Firm" type="xs:string" />
<xs:element name="Analyzing_Firm" type="xs:string" />
<xs:element name="Comments" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" name="Section16_5_data
<xs:complexType>
<xs:sequence>
<xs:element name="Station_Number" type="xs:string" />
<xs:element name="Sample_Number" type="xs:unsignedByte" />
<xs:element name="Sample_Date" type="xs:date" />
<xs:element name="TEMP" type="xs:decimal" />
<xs:element name="ACIDITY" type="xs:decimal" />
<xs:element name="ALKALINITY" type="xs:decimal" />
<xs:element name="Depth" type="xs:decimal" />
<xs:element name="Discharge" type="xs:decimal" />
<xs:element name="FEDISS" type="xs:decimal" />
<xs:element name="FETOTAL" type="xs:decimal" />
<xs:element name="MDISS" type="xs:decimal" />
<xs:element name="MTOTAL" type="xs:decimal" />
<xs:element name="PH" type="xs:decimal" />
<xs:element name="SODISS" type="xs:decimal" />
<xs:element name="CONDUCTIVITY" type="xs:decimal" />
<xs:element name="SETTSOLIDS" type="xs:decimal" />
<xs:element name="TDS" type="xs:decimal" />
<xs:element name="TSS" type="xs:decimal" />
<xs:element name="ODISS" type="xs:decimal" />
<xs:element minOccurs="0" name="cOMMENTS" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>[/code]
<br/>


<hr class="sig jim neal

View the full article
 
Back
Top