Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XMLAdapter Load XML ignoring .xsd
Message
 
 
To
09/03/2016 10:24:45
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01632680
Message ID:
01632743
Views:
44
>>>>>>Hi,
>>>>>>
>>>>>>Is it possible to load an XML file into XMLAdapter ignoring the .xsd file defined in the .XML file? For example, the top of the XML looks like this:
>>>>>>
>>>>>>
>>>>>><?xml version="1.0" encoding="utf-8" ?>
>>>>>><EmailList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>>>>>>	xsi:noNamespaceSchemaLocation="EmailList.xsd" >
>>>>>>
>>>>>>
>>>>>>But I want to load the XML ignoring this EmailList.xsd because XML may have elements NOT defined in the XSD file. Can it be done?
>>>>>>
>>>>>>TIA
>>>>>
>>>>>Ignore inline or referenced schema:
>>>>>
>>>>>m.loXMLAdapter.XMLSchemaLocation = ""
>>>>>
>>>>
>>>>Thank you. But something does not work. I added this line in the following segment:
>>>>
>>>>
>>>>oXMLAdapter = NEWOBJECT('XMLAdapter') 
>>>>oXMLadapter.XMLSchemaLocation = ""
>>>>oXMLadapter.LoadXML( "emaillist.xml", .T.)
>>>>oXMLadapter.Tables.Item(1).ToCursor(.F.,cCursorName)   && this is the line on which error occurs.
>>>>
>>>>
>>>>but then I get error "Index or expression does not match an existing member of the collection"
>>>
>>>what simply says the tables collection has no item with index 1
>>
>>Yes. And it looks like the line
>>
>>m.loXMLAdapter.XMLSchemaLocation = ""
>>
>>causes this problem. When I comment it, I get some results.
>
>This says VFP does not understand the XML without internal named XSD.
>[snip]
>"1"
> LoadXML processes inline or external schema, if referenced in the XML document. ToXML generates inline schema. (Default)
> [/snip]

This is why I started the thread. I do want the LoadXML to ignore the XSD schema. But if I use the line
m.loXMLAdapter.XMLSchemaLocation = ""
nothing is loaded into the XML adapter. If I comment this line, the XSD is being used but this is not what I need.
"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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform