The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Automatically Diagram XML data? Thread Tools Search this Thread Display Modes
Hi All,

A friend just showed me Omnigraffle... Brilliant application!

I have a tool that creates a XML file that describes a web site layout . Is it possible to have Omnigraffle automatically create an outline view of it?

I have control over the XML format so if the formats describes somewhere I can make my output conform, or perhaps someone has written a clever applescript?



Thanks

-John
 
The Graffle file format isn't very handy for anyone but us. (It is in XML, but it is just using Apple's property list DTD and is pretty grungy to read through.) One of the big things planned for version 5 is a real, good XML file format.

However, Graffle does import OmniOutliner files, which do use a very nice XML doc type. So if producing XML is easiest for you, outputting Outliner files and having Graffle open them might work best.

Alternatively, you may also want to look at the graphviz format, which is especially simple to create, and is another format that OmniGraffle can import.

If you wanted to go into more detail about what your existing XML looks like, it might also make sense to write an AppleScript that reads the XML and builds the Graffle shapes from it as well.
 
Quote:
Originally Posted by Greg Titus
The Graffle file format isn't very handy for anyone but us. (It is in XML, but it is just using Apple's property list DTD and is pretty grungy to read through.) One of the big things planned for version 5 is a real, good XML file format.

However, Graffle does import OmniOutliner files, which do use a very nice XML doc type. So if producing XML is easiest for you, outputting Outliner files and having Graffle open them might work best.

Alternatively, you may also want to look at the graphviz format, which is especially simple to create, and is another format that OmniGraffle can import.

If you wanted to go into more detail about what your existing XML looks like, it might also make sense to write an AppleScript that reads the XML and builds the Graffle shapes from it as well.
Hi Greg,
Right now my app outputs google sitemap.xml file format

https://www.google.com/webmasters/si.../overview.html

However like I said I would be happy to modify it to output a format that Graffle can import easier. The omni-outliner route sounds really good, is that documented somewhere or should I download a demo version and just look at it's output to figure it out?

The other idea I had was the applescript route but since I've never written applescript before I'm a little shy to go that route.

By the way, my app is a plugin for RapidWeaver that creates sitemaps (http://loghound.com/Sitemap/index.php) and when my friend showed me the nifty auto-diagramming from outline freature in Graffle I thought 'Bingo' it would be really nice to throw your site into graffle for documentation purposes.

-John
 
So what sort of layout are you looking for in Graffle? Hierarchical with the tree structure of the URLs?
 
The sitemap.xml format is particularly simple. Here is a quick AppleScript that will create a box in Graffle for each URL in a <loc> tag. They aren't connected to each other or anything - that would be a bit more complicated - but I'd be happy to extend the script once you left me know what sort of structure you are interested in. (Just change the first property line to the Mac-style path of the sitemap file.)

Code:
property file_to_read : "Tiger:Users:toon:Documents:sitemap.xml"

tell application "OmniGraffle"
	set fileID to open for access file file_to_read
	set isDone to false
	set startingY to 20.0
	repeat until isDone
		try
			-- read up to a tag, and see what the tag is
			read fileID before "<"
			set theTag to read fileID before ">"
			
			-- if it is a <loc> tag, then read the contents
			if theTag is "loc" then
				set theURL to read fileID before "<"
				
				-- and make a box in Graffle with the URL as its title and also its link
				tell canvas of front window
					make new shape at end of graphics with properties {text:{alignment:left, text:theURL}, url:theURL, vertical padding:5, autosizing:full, side padding:10, origin:{100.0, startingY}}
				end tell
				set startingY to startingY + 30.0
			end if
		on error
			set isDone to true
		end try
	end repeat
	
	close access fileID
end tell
 
Just to let you know, you can get free day long trial licences for all of Omni's apps that allow you to use the app without limits for that length of time (this allows you to try out the app to its fullest without hitting the limits of the demo versions, or to do that one off thing - such as use OmniOutliner as a bridge between your file formats).

When in the OmniStore, look for Trial licences.
 
So here is the source to an AppleScript droplet that will parse these sitemap files, make a shape for each web page with the file name as its title and with the full URL as an action, and lay them out hierarchically left-to-right.

Just paste this into Script Editor, save it as an application, and then drop any number of sitemap XML files on it to make a new OmniGraffle document out of each.
Attached Files
File Type: txt Sitemap to Graffle.txt (3.4 KB, 590 views)
 
Any reason that I can't download the attachment? Some kind of permissions thing?
 
I try using this script but cannot get it to save.
I get this message when trying:

Expected variable name, class name or property but found application constant or consideration.

Can anyone help?
 
I have a more general question along the same lines as this thread:

Is there a repository of information somewhere that describes how to control OmniGraffle from Applescript? I have several projects that fitting OmniGraffle into the tool chain would be perfect for and I'm willing to learn Applescript to do it, but I can't seem to find documentation of the interface to OG. Perhaps I'm looking in the wrong places?
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I break process diagram into separate pages and display diagram name on every page Chien OmniGraffle General 0 2012-04-25 07:38 AM
Creating graphs automatically from imported data Angostura OmniGraffle General 2 2008-04-30 01:29 PM
automatically formatted imported data MAatHome OmniOutliner 3 for Mac 3 2007-12-04 07:32 PM


All times are GMT -8. The time now is 12:07 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.