GoXML Saving Shapes

Hi Jake,
How would I save/Load the Points for a Stoke, Arc .....
t = New Xml.GoXmlBindingTransformer("Stoke", New GoStroke)
t.AddBinding("Pen") t.AddBinding("PointsCount")

use “Points”. No need to do PointsCount.

How do I get hold of the Points in this case?
 
Public Class TransformDGMStroke
Inherits GoXmlTransformer
Public Sub New()
Me.TransformerType = GetType(DGMStroke)
Me.ElementName = "STROKE"
End Sub

Public Overrides Sub GenerateAttributes(ByVal obj As Object)
MyBase.GenerateAttributes(obj)
Dim c As DGMStroke = CType(obj, DGMStroke)
WriteAttrVal("Position", c.Position)

End Sub

Public Overrides Sub ConsumeAttributes(ByVal obj As Object)
MyBase.ConsumeAttributes(obj)
Dim c As DGMStroke = CType(obj, DGMStroke)

c.Position = PointFAttr("Position", New PointF(110, 110))


End Sub

t.AddBinding(“Points”)

Hi Jake,

I get an Error saying Points is not a Member of stroke?
Public Overrides Sub GenerateAttributes(ByVal obj As Object)
MyBase.GenerateAttributes(obj)
Dim c As DGMStroke = CType(obj, DGMStroke)
WriteAttrVal("Position", c.Position)

WriteAttrVal("Points", c.Points)

End Sub
Please advise...Dead

Right. “Points” is a special keyword handled by AddBinding and GoXmlBindingTransformer.



You’re using the lower level XML support here. Why did you switch? You started this note asking about AddBinding.



Try…



WriteAttrVal(“Points”, c.CopyPointsArray())



and you’ll need something like



((GoStroke)obj).SetPoints(PointFArrayAttr(attrname, null))



on the flip side, but it’s a lot easier to use the GoXmlBindingTransformers.



and you don’t need Position, that’s defined by the Points.





Thanks Jake - I am new with the GoXmlBindingTransformer saving and are looking into the options.

Another question, what is the best aproach to save the GoNode with GoXmlBindingTransformer
1) GoDrawing and GoText that is to a GoNode.

There’s a section in the User Guide on XML, and several samples that show GoXmlBindingTransformer. Plus, the Reference API class documentation has a lot of detail.