recursive xml function: clean xml

Mariovde

New member
Joined
Sep 12, 2008
Messages
2
Programming Experience
1-3
Greetings!

I have attached a couple of files to backup this post...

The problem i'm currently having is that I have an xml-structure, a result from a flex application.

the structure of the xml can change constantly, so I don't know how many nodes will be in the xml...

while the xml is being parsed, I should take the information located in the style-attribute of the current node and place the necessary information like font-size, font face etc in the right place and create a string like in the IndesignStylesheet.txt...

So:

loop trough every node, check for childnodes as deep as you can...
filter out the style attribute and create a string like in the IndesignStylesheet.txt file...

don't need a fully working/finished code, but a recursive function would be awesome!!

Thanks you guys!

Mario
 

Attachments

  • IndesignStylesheet.txt
    5.4 KB · Views: 17
  • WindowsApplication1.zip
    13.6 KB · Views: 20
Last edited by a moderator:
Better use a XmlTextReader, example:
VB.NET:
Dim reader As New Xml.XmlTextReader("result.xml")
While reader.Read
    If reader.NodeType = XmlNodeType.Element AndAlso reader.HasAttributes Then
        Dim style As String = reader.GetAttribute("style")
        If style <> String.Empty Then
            ' do something here
        End If
    End If
End While
reader.Close()
I'm not sure what you want to do with the style strings though.
 
I need to extract data from the xml and concatenate it into the strings used in the indesignstylesheet.txt file...just use hard coded code and concatenate font size and font family etc into it...
 
Back
Top