Web Connection
wwXML.xmltocursor does not generate the cursor Web Connection 5.68
Gravatar is a globally recognized avatar based on your email address. wwXML.xmltocursor does not generate the cursor Web Connection 5.68
  Ludmila
  All
  Jun 15, 2017 @ 02:01pm

We use Web Connection Version 3.20 for more than 10 years now with no problems. Now we would like to upgrade to version 5.68 we bought sometime in January 2012. Yes it took us a long time to start the upgrade. The conversion to 5.68 is so far going well except one thing.

Following code is not working in version 5.68:

Function xmlul

      Local lcXML, owwXML, lcResult, lcOutFile
      
      lcResult = "OK"
      lcXML = Request.FormXML()
      
      =Strtofile(lcXML, "c:\delete\xml.txt")   
      owwXML = Createobject("wwXML")
      
      owwXML.Xmltocursor(lcXML, "xmlul")
      If !Used("xmlul")
            lcResult = "FAIL"

Program does not crash but does not generate the xmlul cursor. Parser XML_XMLDOM_PROGID "MSXML2.DOMDocument.6.0" complains that “Element content is invalid according to the DTD /Schema”.I have attached screen shot showing values in wwxml.xmltocursor at the moment when the code below is executed

IF VARTYPE(lvXML) # "O"
   loXML = CREATEOBJECT(XML_XMLDOM_PROGID)
   loXML.LoadXML( lvXML )
ELSE
   *** Input object must be IE 5 XML object
   loXML = lvXML
ENDIF

*** Required to preserve leading spaces
loXML.PreserveWhiteSpace = .T.

*** Check for parsing error
IF !EMPTY(loXML.ParseError.reason)
   THIS.lerror = .T.
   THIS.cErrorMsg = loXML.ParseError.reason + CRLF + ;
      "Line: " + TRANSFORM(loXML.ParseError.LINE) + CRLF +;
      loXML.ParseError.SrcText
   RETURN .F.
ENDIF

Thanks for your advice

Ludmila Tornyai

Gravatar is a globally recognized avatar based on your email address. re: wwXML.xmltocursor does not generate the cursor Web Connection 5.68
  Rick Strahl
  Ludmila
  Jun 16, 2017 @ 01:13pm

Xml to Cursor requires a very specific structure in order to be able to import files, so depending on what you're doing it won't just import a random XML file. Basically the structure is the reverse of CursorToXml(). Anything that has a different structure than that won't import correctly.

IOW, the XML importing is a round-trip format.

FWIW, I wouldn't use wwXml for this anyway - use FoxPro's native XMLTOCURSOR() or the XmlAdapter class. The wwXml functions predate those features in VFP. The VFP features are significantly faster than the wwXml options as well (although wwXml does lean on these functions in newer versions). XmlAdapater in particular does allow some configuration for custom XML schemas and how to map data, but it's a pain to do custom schema mapping that in many cases for custom XML schema's it's actually easier to do explicit MSXML parsing of the data.

+++ Rick ---

© 1996-2024