>>I want to load XML file into a cursor. Here is an example:
>>
>>create cursor c_cursor (name c(20), email_addr c(100), account c(50))
>>nRecCount = XMLTOCURSOR( "emaillist.xml", "c_cursor", 512+8192)
>>
>>
>>The problem is that the emaillist.xml points to an xsd file emaillist.xsd and I want it to be ignored. Because the emaillist.xsd has no reference of the element "account".
>>Can I change the parameter used with XMLTOCURSOR() from 512+8192 so some other value to make it ignore the XSD?
>>
>>
>
>I'll assume that
name,
email_addr and
account are the elements that you need to read from the XML file, and that they are siblings (that is, they share the same parent).
>
>CREATE CURSOR c_cursor (name c(20), email_addr c(100), account c(50))
>
>LOCAL loXML AS MSXML2.DOMDocument60
>
>m.loXML = CREATEOBJECT("MSXML2.DOMDocument.6.0")
>
>m.loXML.Async = .F.
>m.loXML.Load(GETFILE("xml"))
>
>LOCAL loRows AS MSXML2.IXMLDOMNodeList
>
>m.loRows = m.loXML.selectNodes("//*[local-name() = 'email_addr']/parent::node()")
>
>LOCAL loRow AS MSXML2.IXMLDOMNode
>
>FOR EACH m.loRow IN m.loRows
> INSERT INTO c_cursor (name, email_addr, account) ;
> VALUES (m.loRow.selectNodes("name").item(0).text, m.loRow.selectNodes("email_addr").item(0).text, m.loRow.selectNodes("account").item(0).text)
>ENDFOR
>
>m.loXML = .NULL.
>RELEASE m.loXML
>
Thank you. I will try to understand and apply this code.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham