.NET Forum / .NET Framework / XML / March 2008
xml graphic representation
|
|
Thread rating:  |
jrl - 14 Mar 2008 07:37 GMT I'm new to using XML, so I'm seeking some general pointers about approaching a project. I'd like to read the sitemap xml file, and generate a graphic representation of the website from the site map. I would like to do this dynamically (creating the page from the current sitemap file). I'm wondering if there are some built in functions I can use, for example to: 1) parse the xml file, creating units at each node 2) interpret levels within the file 3) create graphics based on each node, writing the node property in the text of the graphic object.
I know what functions I'll need for the graphic objects (rect) but maybe this functionality is already built in to .net and you can direct me to the functions. I'm building the project in C#.
Or maybe this is best approached with Silverlight. Any general approaches toward using the most suitable functionality is welcome.
Wen Yuan Wang [MSFT] - 14 Mar 2008 12:05 GMT Hello JRL,
It seems you need a control which could create graphic base on the node in SiteMap xml file, correct? If I misunderstood anything here, please don't hesitate to correct me.
As far as I know, there is no such build-in class in .net framework. You may have to create that by yourself. I think you can use WebBrowser navigate to the target website, and get graphic. For parsing XML file, you can pass it to XMLDocument, and use xmlpath to level the website.
Hope this helps. Please feel free to let us know if there is anything unclear. We are glad to assist you. Have a great day, Best regards, Wen Yuan
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
jrl - 14 Mar 2008 16:13 GMT I would make some minor corrections to this interpretation. I don't want to create a graphic based on a node, rather I want to show the whole hierarchy of nodes, showing the layout of the website pages, and the paths to each page. The sitemap.xml file contains all this information. Also, I don't want to browse to a target website. I want to load the sitemap.xml file for 'itself', meaning that this page would display the organization of the web application (of which the page is itself one node or part).
I see XMLDocument will read in the sitemap.xml file, thanks. It makes reference to applying a transformation. Would the process of drawing and labeling a rectangle be considered a transformation? I mean, would I create a function that receives the information for a particular node, handing off the graphic writing step, and then returning success or failure, before sending another node until the whole sitemap had been processed? Can this type of calling a function (drawing a node) be considered a transformation?
I definitely understand that this is not a built in control, but I'm looking for the most appropriate calls to use in creating this functionality. And, as a relative beginner, I'm looking for samples of code that show a similar process, as a template from which to build this project.
Hopefully this background helps to get closer to these goals.
> Hello JRL, > [quoted text clipped - 38 lines] > This posting is provided "AS IS" with no warranties, and confers no > rights. Wen Yuan Wang [MSFT] - 17 Mar 2008 14:15 GMT Hello JRL, Thanks for your reply.
I misunderstood you want to print Screen-shooting of each page in Web.sitmap before. Now, I seems what you need is to output a graphic of the hierarchy of node sites. Please correct me again if I'm missing anything here.
Could you let me known which kind project you are working on? (ASP.net Website or Winform Application). If it's a Website application, you can count on XmlDataSource to parse your sitemap file, and display sitemaps organization in web control such as TreeView. I searched on internet, found the following article which described how to achieve with repeat control. http://69.10.233.10/KB/aspnet/websitemapnav.aspx [Creating Hierarchical Navigation Without Using the Treeview Control]
Because there is no datasource control in winform application, we have to parse sitemap file by ourselves, and retrieve each site node by XPATH \\siteMap\siteMapNode. Just as what you have seen, we may create a drawing function. When passed site node information, this function draw what we need by Graphic API, then return true if successes. If you are interested in this scenario, please feel free to let me know. I will perform research and provide more detailed information.
System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); xd.Load("web.sitemap"); System.Xml.XmlNode rootnode = xd.SelectSingleNode(@"//siteMap/siteMapNode"); *DrawNode(rootnode.Attributes["title"].Value); DisplayChildNodeText(rootnode);
void DisplayChildNodeText(System.Xml.XmlNode node) { *DrawNode(node.Attributes["title"].Value); foreach (System.Xml.XmlNode subnode in node.SelectNodes("siteMapNode")) DisplayChildNodeText(subnode); }
Hope this helps. Please feel free to let me know if you have any more concern. We are glad to assist you.
Best regards, Wen Yuan Microsoft Online Community Support Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
jrl - 20 Mar 2008 05:15 GMT Sorry for the delay in getting back to you. Here is a visual example of graphically representing a website: http://www.positionmasters.com/website-design/website-worksheet.html
I am working on an ASP.NET website, using visual studio 2008 prof.
Thanks for the link (on navigation without the treeview control). It does provide a general structure for a similar process.
We can conclude this support issue now. I will continue my research, but thank you, this has been helpful to start.
> Hello JRL, > Thanks for your reply. [quoted text clipped - 51 lines] > This posting is provided "AS IS" with no warranties, and confers no > rights. Wen Yuan Wang [MSFT] - 20 Mar 2008 11:16 GMT Hello JRL, Thanks for your reply.
We can parse sitemap file into XMLDocument instance, retrieves each pages. But it's not easy to draw them in graphic, because you may have to calculate the position for each page on the chart.
I suggest you may consider using VISO. We can define relationship between each page in it. Then, VISO could print a well formed chart for us. I searched on internet, found this article. Hope this helps.
http://aspalliance.com/804_Building_Dynamic_Visio_Diagrams_with_NET [Building Dynamic Visio Diagrams with .NET]
Have a great day, Best regards, Wen Yuan
Microsoft Online Community Support Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
jrl - 24 Mar 2008 23:23 GMT Thanks for the link. I don't have visio installed yet, but it looks like an interesting option for later. Since we are continuing, I would say that the layout is something I'll be happy to program later. At this point I would be happy to learn how to display using a series of text boxes.
So would it be possible to: 1) read the sitemap, using XMLDocument 2) for each branch, create a series of text boxes on that line. Each box would be given text according to the webpage title (from the sitemap file). 3) add a new line after each branch. 4) continue until the end is reached.
I'll try setting this up, even though practice leads me to suspect it won't be nearly this simple.
thanks, JRL
> Hello JRL, > Thanks for your reply. [quoted text clipped - 23 lines] > This posting is provided "AS IS" with no warranties, and confers no > rights. Wen Yuan Wang [MSFT] - 25 Mar 2008 11:23 GMT Hello JRL, Thanks for your reply.
>1) read the sitemap, using XMLDocument >4) continue until the end is reached. Sure. You could read sitemap using XMLDocument. If you are not sure how to accomplish that, you may refer to following code snippet. System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); xd.Load("web.sitemap"); System.Xml.XmlNode rootnode = xd.SelectSingleNode(@"//siteMap/siteMapNode"); DisplayChildNodeText(rootnode);
void DisplayChildNodeText(System.Xml.XmlNode node) { foreach (System.Xml.XmlNode subnode in node.SelectNodes("siteMapNode")) DisplayChildNodeText(subnode); }
>3) Add a new line after each branch. You may consider draw line by System.Drawing.Graphics.
>2) For each branch, create a series of text boxes on that line. Each box would be given text according to the webpage title (from the sitemap file). This is doable. But,as you seen, it's difficult to caculate the location for the textbox.This is the reason why we suggest you may consider using Visio.
Anyway, if there is anyting we can help with, please feel free to let us know. It's my pleasure to assist you. :)
Have a great day, Best regards, Wen Yuan
Microsoft Online Community Support Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|