EOSERV Forum > Programming > HTML-Type Markup Language
Topic is locked.
Page: << 1 >>
HTML-Type Markup Language
Author Message
Post #137781 HTML-Type Markup Language

Ok, so im working a project that im not going to release much about so far. Im trying to parse an html type language i am making myself. Im using an XML Reader to parse it into nodes and attributes and etc. Im a little confused on how im going to get this to work. I need to parse the html andseperate them into controls into a list of the derived class "Control".


Heres the class :


Imports System.Xml
Imports System.IO

Namespace Markup
    Public Class Markup
        Private ControlList As List(Of Control)

        Sub New()

        End Sub

        Public Sub Parse(ByVal HtmlString As String)
            Dim CurrentControl As Control = Nothing
            Dim LastElement As String = Nothing
            Dim LastEndElement As String = Nothing

            Using Parser As XmlReader = XmlReader.Create(New StringReader(HtmlString))
                While Parser.Read()
                    Select Case Parser.NodeType
                        Case XmlNodeType.Element
                            LastElement = Parser.Name
                            Try
                                
                            Catch ex As Exception

                            End Try
                        Case XmlNodeType.Attribute

                        Case XmlNodeType.Text

                        Case XmlNodeType.EndElement
                            LastEndElement = Parser.Name
                    End Select
                End While
            End Using
        End Sub

    End Class
End Namespace


I need to seperate it in to the objects but i have no clue how to keep track of everything. In the Try Catch in the beginning is where it is going to select the control. Im going to add a Handler class to select which object it is depending on the name. Here is the "Control" class so far, whichinclude the default attributes.


Public Class Control

    Public ID As String
    Public Width As Integer = 0
    Public Height As Integer = 0

    Public Margin As _Margin
    Public Padding As _Padding

    Structure _Margin
        Dim Top As Integer
        Dim Left As Integer
        Dim Right As Integer
        Dim Bottom As Integer
    End Structure

    Structure _Padding
        Dim Top As Integer
        Dim Left As Integer
        Dim Right As Integer
        Dim Bottom As Integer
    End Structure

End Class


The Inheriting classes will look something like this.



Namespace Markup.Controls

    Public Class Div
        Inherits Control
    End Class

End Namespace

Does anyone have a clue how i can do this?


Notes

  • I need to fully parse it myself as it will have custom controls and custom rendering.
  • I cant use anyone else's class because of that-/\
  • I will be rendering the controls based on the list of controls.
---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
14 years, 14 weeks ago
Post #138582 Re: HTML-Type Markup Language

Unless you will write your own interpreter(browser) then you need to convert it back to an interpreted language?

---
https://www.youtube.com/watch?v=d_DFVzxsEUc
14 years, 13 weeks ago
Post #138588 Re: HTML-Type Markup Language
Madao posted: (25th Mar 2012, 12:56 am)

Unless you will write your own interpreter(browser) then you need to convert it back to an interpreted language?


No, you dont understand what im trying to do. Im making my own markup language, i just need to parse it and set it into an array with the details. Im just having trouble trying to keep track of which control is which using this system.
---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
14 years, 13 weeks ago
Post #138592 Re: HTML-Type Markup Language
Wildsurvival posted: (25th Mar 2012, 01:45 am)

Madao posted: (25th Mar 2012, 12:56 am)

Unless you will write your own interpreter(browser) then you need to convert it back to an interpreted language?


No, you dont understand what im trying to do. Im making my own markup language, i just need to parse it and set it into an array with the details. Im just having trouble trying to keep track of which control is which using this system.

HTML is a markup language. How do you expect the browser to understand your markup language?
---
https://www.youtube.com/watch?v=d_DFVzxsEUc
14 years, 13 weeks ago
Post #138593 Re: HTML-Type Markup Language

Madao he is writing his own little "Markup language". He is saying the syntax of it is similar to HTML. he is having trouble writing an interpreter.

---
Love you too.
14 years, 13 weeks ago
Post #138599 Re: HTML-Type Markup Language

Thanks, newguy


"I will be rendering the controls based on the list of controls"

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
14 years, 13 weeks ago
Post #140284 Re: HTML-Type Markup Language

I could be wrong >_> But HTML uses more tags...
Like ... 


<html>
<head></head>
<body>
</body>
</html>

>_> Perhaps you need a way of signifying what's what by adding some sort of tag base sequence to interpret what belongs where.

14 years, 10 weeks ago
Post #140292 Re: HTML-Type Markup Language


Nah, I solved it. I used the xml reader in a loop with a function to set the properties.

 

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
14 years, 10 weeks ago
Page: << 1 >>
Topic is locked.
EOSERV Forum > Programming > HTML-Type Markup Language