XSD Parser?

Does anyone know of a way to read an XSD file that provides the schema of an XML file and generate variables that will map to the elements and attributes of the XSD?

Looking for sort of the same thing… Really… I just want to read/process an XML file that fails as an XMLDocument but can be read successfully by an XMLReader – unfortunately – the structure of this XML has a nested structure that doesn’t include “name/value” pairs. I have a file that looks like this.

Bob Roberts

The XML Reader finds the “start element” of firstname but it doesn’t find any key/value pair under that element.
It expects a structure like this…


This actually seems like rather ordinary XML structure. I must be missing something. I don’t see how to get the XMLReader to pick up the values associated with element names. Seeking ideas.

you can use SOPA Kit from MBS, it works great http://monkeybreadsoftware.de/xojo/SOAP/

XMLDocument should handle that easily. Parser is overkill for well-formatted xml like that.

Pretty sure in other implementtations of XMLDocument I have used (vbscript?) the text value of an element is accessed just by
.value or

But in the Xojo implementation, Stuff that is not an attribute
appears to need a TextNode child.

Attempts to SET the value of a node just crash

This code shows one way to create an element that has the simple structure you are seeing:

[code] Dim xml As New XmlDocument

Dim xe As new XmlElement //this creates an element with no content
xe = xml.CreateElement(“TestThing”)

//this appends a text node to that… the effect is to change into
//and then put “Thevalue” inside it, giving you Thevalue

Dim xt As new XmlTextNode
xt =xml.CreateTextNode (“Thevalue”)

//now, can we get the text back?

dim k as XmlTextNode

//cast the child as an XMLTextNode
k = XmlTextNode(xe.FirstChild)
//and only THEN can we read the .value safely, it seems

msgbox k.Value


[quote=216567:@Jeff Tullin]
Dim xe As new XmlElement //this creates an element with no content
xe = xml.CreateElement(“TestThing”)[/quote]

fyi there’s no need to create/new this element with no content. Either…

Dim xe As XmlElement xe = xml.CreateElement("TestThing")

Dim xe As XmlElement = xml.CreateElement("TestThing")

… is sufficient. Same for xt.

Thats leftover code from earlier tests when I tried to set the values/properties of the new item before adding it.
Taking out the ‘new’ on the declare will save a little processing time.