George
Thu Aug 12 09:26:58 CDT 2004
Hmm, very intriguing indeed...
The xml parser works ok. Now the fox parser fails trying to convert the
xml to a cursor.
I guess the fox parser tries to convert the value '10.10.10' to a number
and throws an error when finding two or more decimal points.
If the value is '10.10' it works ok.
'x10.10.10' also works ok because it thinks it is a string.
It is definitely an interesting bug.
Try and you'll see:
* OK
<?xml version="1.0" ?>
<VFPData>
<host>
<ip>a10.10.10</ip>
</host>
</VFPData>
* ERROR
<?xml version="1.0" ?>
<VFPData>
<host>
<ip>10.10.10</ip>
</host>
</VFPData>
* OK
<?xml version="1.0" ?>
<VFPData>
<host>
<ip>10.10</ip>
</host>
</VFPData>
So, unless you use a schema, the parser will wrongly infer a number and
throw an exception.
GaryZ wrote:
> Thanks George,
>
> I'm new at this XML stuff.
>
> One XMLTOCURSOR() problem solved. Here's another. Now the XMLTOCURSOR()
> starts to read the XML file, then I get this error: "XML Parse Error:
> Function argument, value, type or count is invalid. node 'ip' xml =
> <ip>10.10.10.2</ip>]"
>
> I'd like to know the answer, just as part of my learning. Maybe I can still
> get it going.
>
> In the mean time, I was able to load the XML File with no problems by using:
>
> Create Cursor xmllines(linetext C(254))
> APPEND FROM (m_xmlfile) SDF
> a SCAN loop parses just the data items I need into another table.
>
> Sometimes the basics will work when the new-fangled won't. lol.
>
> "George" wrote:
>
>
>>you forgot to add the "512" parameter
>>
>>If the first argument is an xml stream you don't need it, but if it is a
>>file name you do.
>>
>>try:
>>
>>x = XMLTOCURSOR(m_xml,"mycursor",512)
>>
>>HTH
>>
>>GaryZ wrote:
>>
>>>I have much the same problem as Seeker (see below), except the xml file is
>>>located on a local network drive. I'm using VFP8 SP1.
>>>
>>>The xml file does exist, but the cursor does not exist and should be created
>>>by the XMLTOCURSOR function
>>>.
>>>Here is the source.
>>>
>>>m_xml="'Y:\GZook\Lan Guard\216.158.61.68 - 4 August.xml'"
>>>x = XMLTOCURSOR(m_xml,"mycursor")
>>>
>>>The error:
>>>
>>>"XML Parse Error: Invalid at the top of the document. Line 1, Position 1.
>>>'Y:\GZook\Lan Guard\216.158.61.68 - 4 August.xml' "
>>>
>>>Here is the first line of the XML code, since the error indicates Line 1
>>>Position 1:
>>>
>>><hosts count="43" scan_target="domain_list.txt" created_on="Wednesday, 4
>>>August 2004 - 11:41 AM" lnss_version="3.3">
>>>
>>>I still get this same error if I add:
>>>
>>><?xml version="1.0" encoding="Windows-1252" standalone="yes" ?>
>>><hosts count="43" scan_target="domain_list.txt" created_on="Wednesday, 4
>>>August 2004 - 11:41 AM" lnss_version="3.3">
>>>
>>>Any help is appreciated.
>>>
>>>Gary Z.
>>>
>>>"seeker" wrote:
>>>
>>>
>>>
>>>>What is the correct way to reference an http request in XMLTOCURSOR? This
>>>>syntax does not work:
>>>>
>>>>XMLTOCURSOR("
http://abc.server.com/xyz.xml", "cCursor", 512)
>>>>--
>>>>seeker
>>