En un programa que estoy haciendo necesito unir dos dibujos SVG en uno solo.
Lo he solucionado (basandome en parte de un código de Vuott para unir varios .odt) de la siguiente manera para el caso especial svg de xml:
Public Function XmlMerger(xml As String[]) As XmlDocument '' Funcion que crea un xml resultante conformado por otros dos iniciales.
Dim int As Integer
Dim str As String
Dim stxExt As New String[]
Dim stx As New String[]
Dim xmdMerge As New XmlDocument
Dim strExt As String
For int = 0 To xml.Max
strExt = String.LCase(File.Ext(xml[int]))
If stxExt.Find(strExt) = -1 Then
stxExt.Add(strExt)
Endif
Next
If stxExt.Count = 1 Then
Select stxExt[0]
Case "svg"
' Header
str = File.Load(xml[0])
stx.Push(Scan(str, "*</metadata>*")[0] & "</metadata>")
' Documents content
For int = 0 To xml.Max
str = File.Load(xml[int])
stx.Push(Scan(str, "*</metadata>*</svg>*")[1])
Next
End Select
Endif
xmdMerge.FromString(stx.Join(Null, Null))
Return xmdMerge
End
Dim int As Integer
Dim str As String
Dim stxExt As New String[]
Dim stx As New String[]
Dim xmdMerge As New XmlDocument
Dim strExt As String
For int = 0 To xml.Max
strExt = String.LCase(File.Ext(xml[int]))
If stxExt.Find(strExt) = -1 Then
stxExt.Add(strExt)
Endif
Next
If stxExt.Count = 1 Then
Select stxExt[0]
Case "svg"
' Header
str = File.Load(xml[0])
stx.Push(Scan(str, "*</metadata>*")[0] & "</metadata>")
' Documents content
For int = 0 To xml.Max
str = File.Load(xml[int])
stx.Push(Scan(str, "*</metadata>*</svg>*")[1])
Next
End Select
Endif
xmdMerge.FromString(stx.Join(Null, Null))
Return xmdMerge
End
Ahora bien, para "editar" un svg con gb.xml y agregar entidades como una linea o un texto ¿Como se haría?
¿Alguien tiene un ejemplo de este tema que quiera compartir?
Saludos.