Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB.Net and XML XSD Files

Posted on 2016-08-21
1
Medium Priority
?
93 Views
Last Modified: 2016-08-27
I am wondering if there is a simple way to parse an XSD file and extract the folowing

a) a list of all simpleType elements. I would like to get the Name, the RestrictionBase, MinLength, MaxLength and if posible the list of enumeration.

b)  a list of all complexTypes and all elements in the sequence with Name, type, min and Max Occurrence

I enclosed a sample file
cfs_billing.xsd
0
Comment
Question by:AlexPonnath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 36

Accepted Solution

by:
Kimputer earned 2000 total points
ID: 41765425
Just some code to get you started. You can find HtmlAgilityPack in the free Nuget packages that you can install.
Of course I can try to finish the whole working code, but I'm assuming you can finish it by yourself using the code provided. If not, check output first, and feedback on what you need.

Imports HtmlAgilityPack


Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim doc As New HtmlDocument()

        doc.Load("C:\Users\Kimputer\Downloads\cfs_billing.xsd.txt")



        For Each node In doc.DocumentNode.SelectNodes("schema")
            Dim counter = 1

            For Each node2 In node.SelectNodes("simpletype")
                TextBox1.AppendText("Enumerate " & counter.ToString & vbCrLf)
                Dim test = node2.Attributes("name")
                TextBox1.AppendText("simpletype name = " & test.Value & vbCrLf)
                Dim nodetest = node2.SelectNodes("restriction")
                If Not (IsNothing(nodetest)) Then
                    For Each node3 In node2.SelectNodes("restriction")
                        Dim test2 = node3.Attributes("base")
                        TextBox1.AppendText("restriction base = " & test2.Value & vbCrLf)
                    Next
                End If

                counter = counter + 1
            Next
        Next
        


    End Sub
End Class

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question