Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating xml file from schema without xmladapter
Message
From
21/01/2014 10:56:48
 
 
To
21/01/2014 10:30:09
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01592221
Message ID:
01592224
Views:
65
>The goal is to create a very complex xml output file.
>
>Ideally (and what I normally do), I would have generated xml output using xmladapter to create the tables to populate and then push out the xml per the schema, but xmladapter will not read this schema.
>
>xmltocursor and cursortoxml are not available due to the complexity of the schema
>xmladapter is not available due to the complexity of the schema (returns XML Schema is too complex)
>I can load the schema using:
>
>
>LOCAL loXMLSchema as "MSXML2.XMLSchemaCache.4.0"
>loXMLSchema = CREATEOBJECT("MSXML2.XMLSchemaCache.4.0")
>loXMLSchema.add("", lcSchemaDir +'myschema.xsd')
>LOCAL loXML as "MSXML2.DOMDocument.4.0"
>loXML = CREATEOBJECT("MSXML2.DOMDocument.4.0")
>loXML.schemas = loXMLSchema
>loXML.async = .F.
>
>
>In .net I can use the schema and populate tables and push it out easily, but this schema has turned into a bear in VFP9....
>
>Am I overlooking something?
>
>
>The schema loads and I can load an example xml file using the schema. However, my goal is to create an xml file that meets the layout of the schema.
>
>Typically I use DOM just to read and parse xml files. I typically use xmladapter to generate xml files. However, since I cannot read the schema from xmladapter, what is the next best method short of manually coding the xml file using TEXT....ENDTEXT (I do that in other xml output files but this one is very complex and time consuming to manually build that way)? How do I (can it be done) generate an xml using DOM? Is there a way to step through the nodes in the schema and create the appropriate nodes/props in the loXML object above?
>
>I can parse xml files using dom and step through the nodes of an xml file, but never created nodes in a DOMDocument based on a schema using dom.
>
>Or is that not possible and I need to do something else?
>
>TIA,


Tracy,

If you don't mind doing it manually using a class ( you can define new types, add nodes, add elements, add atributes, handles utf-8) which makes a file, I can provide the code

You'll have to understand the schema yourself.

If you need to validate the file against the schema(s) , you would use DOM
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform