florindaniel
Programmer
Hello,
I'm having this problem when uploading an XML file (a small xml + xsd is attached):
- if I use the xml and xsd files attached, there will be loaded all 87 files but the tables in the XMLAdapter will have 0 records.
- if I delete the xmlns=" from the xml file, the tables can be loaded with no problem.
(in the xml file attached there are only 2 tables, but it is the same behaviour).
here's, in brief, a sample of the code I'm using:
m.oXML = CreateObject("XMLAdapter")
m.oXML.UTF8Encoded = .T.
CREATE DATABASE (Addbs(asDir) + "Nomencla")
m.oXML.XMLSchemaLocation = asXSD
m.oXML.LoadXML(asXML, .T.)
*** m.oXML.Tables.Count = 87 at this point
FOR i = 1 TO m.oXML.Tables.Count
= ParseXMLTable(m.oXML.Tables, asDir)
ENDFOR
FUNCTION ParseXMLTable(m.oXML.Tables, asDir)
LPARAMETERS aoXMLTable, asDir
LOCAL ARRAY laStruDBF[1]
m.oFields = aoXMLTable.Fields
IF m.oFields.Count = 0
RETURN
ENDIF
m.sCursorName = aoXMLTable.Alias
aoXMLTable.ToCursor()
SELECT (m.sCursorName)
COUNT TO m.nCount
*** Here nCount = 0 if xmlns present !!
*** etc...
Thank you,
Daniel
I'm having this problem when uploading an XML file (a small xml + xsd is attached):
- if I use the xml and xsd files attached, there will be loaded all 87 files but the tables in the XMLAdapter will have 0 records.
- if I delete the xmlns=" from the xml file, the tables can be loaded with no problem.
(in the xml file attached there are only 2 tables, but it is the same behaviour).
here's, in brief, a sample of the code I'm using:
m.oXML = CreateObject("XMLAdapter")
m.oXML.UTF8Encoded = .T.
CREATE DATABASE (Addbs(asDir) + "Nomencla")
m.oXML.XMLSchemaLocation = asXSD
m.oXML.LoadXML(asXML, .T.)
*** m.oXML.Tables.Count = 87 at this point
FOR i = 1 TO m.oXML.Tables.Count
= ParseXMLTable(m.oXML.Tables, asDir)
ENDFOR
FUNCTION ParseXMLTable(m.oXML.Tables, asDir)
LPARAMETERS aoXMLTable, asDir
LOCAL ARRAY laStruDBF[1]
m.oFields = aoXMLTable.Fields
IF m.oFields.Count = 0
RETURN
ENDIF
m.sCursorName = aoXMLTable.Alias
aoXMLTable.ToCursor()
SELECT (m.sCursorName)
COUNT TO m.nCount
*** Here nCount = 0 if xmlns present !!
*** etc...
Thank you,
Daniel