[AccessD] XML Import Sample File

Greg Smith gwsmith at iowatelecom.net
Tue Nov 28 13:40:19 CST 2006


Hi Shamil!

Well, it was a DUH on me...I'd forgotten that I'd changed the text files
somewhat and it was looking for information that wasn't in there ... once
I fixed that, it worked!  Thanks!

Now I have another question (endless, aren't they?).  All of these samples
work fine with the XML text files that are "two" levels deep, such as, for
the Shippers.xml2.txt file (I truncated the phone number because they were
wrapping around):

<?xml version="1.0"?>
<datarows>
    <Shippers CompanyName="Speedy Express" Phone="(503) ...
    <Shippers CompanyName="United Package" Phone="(704) ...
    <Shippers CompanyName="Federal Shipping" Phone="(503) ...
</datarows>

The XML text file that I am trying to extract data from has many levels to
it, although only a few are pertinent, they are several layers up inside
the XML file (See below):

<?xml version="1.0" encoding="UTF-8"?>
<REQUEST_GROUP>
   <REQUESTING_PARTY/>
   <RECEIVING_PARTY/>
   <SUBMITTING_PARTY/>
      <REQUEST>
         <KEY _Name="SubmissionID" _Value="4281"/>
         <KEY _Name="GroupName" _Value="JFB_Exemption20060831"/>
         <KEY _Name="SubmissionNumber" _Value="0000000610...
           <PRIA_REQUEST _Type="Other"_TypeOtherDescription="ES....
	<PACKAGE>
                      .
                      .
                      .

When I take the existing 'working' file and add one layer to it, nothing
is imported.  I don't get any errors, but I don't get any data either.

Will these samples only work for one/two levels?  If I could use these
(any one of them) to get the data from where I want, that would be
perfect!  But in order to do that, I need to be able to search 'into' the
xml file past the first level.

For example, I have gotten it to work if I use the text file format as
shown below:

<REQUEST>
  <KEY _Name="..../>
  <KEY _Name=".../>
</REQUEST>

But if I add another grouping around the outside, it fails and extracts no
data:

<REQUEST_GROUP>
  <REQUEST>
    <KEY _Name="..../>
    <KEY _Name=".../>
  </REQUEST>
</REQUEST_GROUP>

Or is there a way to make it hit whatever level I want?  So far I've not
been able to do that (yet).

Thanks!
Greg

================
Hello Greg,

It works well here with MSXML v.6.0 - data are imported:

Public Function Parse(ByVal vstrURL As String, ByVal vstrTableName As
String, ByVal vavarFields As Variant)
Dim reader As SAXXMLReader60 '30
    mavarFields = vavarFields
    mstrTableName = vstrTableName
    mintFieldIndex = -1
    mintFieldsCount = 0
    Set reader = New SAXXMLReader60 '30
    Set reader.contentHandler = Me
    Set reader.errorHandler = Me
    reader.parseURL vstrURL
End Function

I have no clear idea why it doesn't work there on you PC.
Try to put breakpoints and debug/trace it...

--
Shamil






More information about the AccessD mailing list