I need help finishing a visual basic program that converts SVG to HTML using LINQ. The input in svg.xml should produce the output in target.html
Here is my svg.xml code: - <?xml version="1.0" standalone="no"?>
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
-
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-
<svg width="100%" height="100%" version="1.1"
-
xmlns="http://www.w3.org/2000/svg">
-
-
<rect width="300" height="100" fill="rgb(120,90,255)" strokewidth="1" stroke="rgb(0,0,0)"
-
style="fill:rgb(120,90,255);stroke-width:1;
-
stroke:rgb(0,0,0)"/>
-
-
<rect x="120" y="20" width="250" height="250" fill="purple" strokewidth="5" stroke="purple"
-
style="fill:green;stroke:purple;stroke-width:5;"/>
-
-
<rect x="20" y="120" width="250" height="250" fill="blue" strokewidth="15" stroke="pink"
-
style="fill:blue;stroke:pink;stroke-width:15;"/>
-
-
<rect x="200" y="200" width="250" fill="red" strokewidth="25" stroke="black"
-
height="100" style="fill:red;stroke:black;
-
stroke-width:25;"/>
-
-
</svg>
Here is the desired output code ... - <?xml version="1.0" encoding="utf-8"?>
-
-
<html>
-
-
<body style="width: 100%; height: 100%">
-
-
<div style="position: absolute; left: 20px ; top: 20px ; padding-bottom: 250px ; padding-right: 250px ; border-style: solid; border-width: 0px; background-color:blue;border-color:pink;border-width:5; fill-opacity:0.1;stroke-opacity:0.9"></div>
-
-
<div style="position: absolute; left: 50px ; top: 100px ; padding-bottom: 5px ; padding-right: 10px ; border-style: solid; border-width: 0px; background-color:red;"></div>
-
-
<div style="position: absolute; left: 200px ; top: 175px ; padding-bottom: 500px ; padding-right: 40px ; border-style: solid; border-width: 0px; background-color:purple; border-color:black; border-width: 10;"></div>
-
-
</body>
-
-
</html>
This is my visual basic code so far ... it outputs the html with the vector information as is. I want to alter it to change it to the desired output. - Imports <xmlns:svg="http://www.w3.org/2000/svg">
-
' *** LOOK OUT FOR THIS! ^^^^
-
-
Public Class Form1
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
' svg -> rect*
-
' rect@x = 0, rect@y = 0, rect@width, rect@height
-
' html -> body
-
' body -> div*
-
' <div style="position: absolute; left: ...
-
' top: ... padding-bottom: ... padding-right: ...
-
'
-
-
-
-
End Sub
-
-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
-
-
Dim svg As XElement
-
svg = XElement.Load("../../test.svg.xml")
-
-
Dim html = <html>
-
<body style="width: 100%; height: 100%">
-
-
<%= From rectangle In svg.<svg:rect> Select <div style=<%= "position: absolute; left: " & rectangle.@x & _
-
"px; top: " & rectangle.@y & _
-
"px; padding-bottom: " & rectangle.@width & _
-
"px; padding-right: " & rectangle.@height & _
-
"px; border-style: solid; border-width: 0px; background-color: " & rectangle.@fill & _
-
"; border-color: " & rectangle.@stroke & _
-
"; border-width: " & _
-
rectangle.@strokewidth %>>
-
</div> %>
-
</body>
-
</html>
-
-
html.Save("../../result.html")
-
-
End Sub
-
End Class
If anybody can help me with this, it would be much appreciated!
1 2710
You almost have it, it's:
---------------------------------------------------
Dim html = <html>
<body style="width: 100%; height: 100%">
<%= From rect In svg...<svg> Select <div style=<%= "position: absolute; left: " & rect.@x & _
"px; top: " & rect.@y & _
"px; padding-bottom: " & rect.@width & _
"px; padding-right: " & rect.@height & _
"px; border-style: solid; border-width: 0px; background-color: " & rect.@fill & _
"; border-color: " & rect.@stroke & _
"; border-width: " & rect.@strokewid th %>>
</div> %>
</body>
</html>
html.Save("../../result.html")
-----------------------------------------------
The compliler will give you errors, not liking pink and so forth in the HTML, but it outputs it correctly.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: pari kanaga |
last post by:
Hi,
Is there anyway to create a HTML file and Archieve by calling a dll in
aspx page.
I know its possible to render a html file by HtmlTextWriter. But I don't
know How to use in Dll.
thanks
pk
|
by: carlos |
last post by:
How can we read / write numbers in a excel data sheet.
|
by: amit260906 |
last post by:
Can anybody tell me how to read Html file from Visual basic.
|
by: Faez |
last post by:
i am using Visual Studio 2005 with Visual Basic language.
i have a command button, labelled 'SEARCH' and i want to add the following code to the button; so that when people click on the search button (at run time), they could see the result from the search engines.
the code is in HTML and i don't know how to translate or convert into VB code.
...
|
by: msnews.microsoft.com |
last post by:
I have a constructor with parameters.
__gc public class GpsUsbDevice : public GpsDevice
{
public:
GpsUsbDevice(String* DeviceName)
{
}
| |
by: a4poster |
last post by:
Hi, I have constructed a form that when completed ouputs an HTML code. What I would like to know is how I can save this code that is wrote to a text file as an html file without physically changing the file extension.
Cheers, A4.
| |
by: vai |
last post by:
hi all
i have created a html help file for my project which is developed
using visual basic 6.0.
i have used the shell.execute command as follows:
Shell.Execute("Path");
it's not working.pls help me.
thnx in advance.
|
by: amit saini |
last post by:
Hi
I have using back end sql server 2000, fornt end Visual Basic and For
reporting using Ms-Word 2000. I have face a problem . In sql server i
have using Image type data type and stored a image in it. and now i want
to open that image in Ms-Word. please send me solution of it. I shall be
Greatfull to u
Thanx
Amit
*** Sent via Developersdex http://www.developersdex.com ***
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |