Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XMLDOM building a valid document for an external DTD
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00344636
Message ID:
00344763
Views:
29
THis is kinda roundabout, but you can just read the XML from the server and then create the DTD on the fly right? IOW, parse the data by wlaking the childnodes collection to get all the element names instead of what I do with AMEMBERS().

The create the DTD as a string and LoadXML() on it and you have it in the parser. If you made the DTD so elements are required you'll have to add the first record.

Regardless of how you slice it this doesn't look like a smart way to go. Maybe you should ask the server for a data structure in XML format separately or additionally (embed it directly into the document). In fact wwXML still has this code somewhere - I used that before I created the DTD creating code and frankly I still like that better than DTDs or schemas - much cleaner, but unfortunately totally non-standard.

+++ Rick ---





>Erik,
>
>We have defined a DTD. It is used by my VFP client to create an XML document filled with data. Document is sent over the network to a C++ server that does some work and returns another XML document that uses a different DTD. I'm to create a generic routine to build the XML document that complies with the first DTD. The code in wwXML uses amembers() to gather the object properties, but the problem is they are in alphabetical order and the tags in the DTD are not defined in that order so the server's XML validation is rejecting the document I send it.
>
>I was planning on using XMLDOM to build the document which will avoid the alphabetical order problem. But how do I "seed" it with just the DTD so it knows what the tree looks like so it can build the nodes in the proper order? The only thing I can find is that you feed the DOM an already valid XML document.
>
>I'd like to use schemas too, but since they are an approved thing yet it's hard to get everyone to buy off on them. I can forsee the same kind of problem though I'd have to get the schema into the DOM without having an actual XML doc built from the schema.
>
>>I'm foggy. Are you trying to create an XML document from a DTD, or the other way around? As you probably know, you can create nodes through the Document object using oDOM.CreateNode(). AFAIK, there is no built in support for constructing a DTD. Sorry if I'm a mile off here.
>>
>>FWIW, I have discarded the idea of using DTDs in favor of Schemas because of this and all the other reasons that come along with the fact that DTDs are not XML, and Schemas are. Schemas can be read and created with the parser just like the documents they are validating. If you have any control over the decision of which to use, I highly recommend investigating what schemas can get you.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform