I want to enter the xsd structure as an input and I want to determine complex and simple element by VB code and load them as variables to deal with these variables later. for example I enter the following
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="schemaRead" targetNamespace="http://tempuri.org/schemaRead.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/schemaRead.xsd" xmlns:mstns="http://tempuri.org/schemaRead.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Name" type="xs:string" />
<xs:element name="Street" type="xs:string" />
<xs:element name="Sity" type="xs:string" />
<xs:element name="postalcode" type="xs:integer" />
I want to determine CE1=addresstype
then determine SE1=Name, SE2=Street, SE3=Sity, and so on
MatthiasNicola 120000E28R321 Posts
Re: read the structure as variables2011-10-25T20:54:28ZThis is the accepted answer. This is the accepted answer.Hi there,
if I understand you correctly you want to read, parse, and analyze an XML Schema to produce a list (or tree?) of all elements, attributes, complex types, simple types, etc. that are declared in the schema, right? This is a highly non-trivial task because XML Schemas themselves can be quite complex, e.g. they can include or import other XSD files, they can define choices, optional items, substitution groups, etc. all which your VB code would need to recognize and interpret correctly.
You may find it easier to use existing libraries that parse an XML Schema and allow you to access the schema information. Here are some pointer to start investigating:
Maybe you should also post the same question in a VB forum and get some advice from experienced VB programmers.