PDA

View Full Version : WYSIWYG XML Editors



sakmerlin37
July 1st, 2013, 19:48
I'm taking a look at oXygen XML Editor, which is advertised as a WYSIWYG editor; however, it looks like any other text editor out there; and, sadly, they charge a metric @$s load for it :confused: .

Does anybody know of a true WYSIWYG XML editor (i.e., similar to MS Word)? Or, am I not understanding oXygen to its full potential (which could be the case)?

Trenloe
July 1st, 2013, 20:18
The visual portion of XML is actually a transformation of the XML data in HTML via what is known as a Cascading Style Sheet (CSS). Usually for XML data that will be used to display in a web page, there is a style sheet (.CSS file) that maps the XML data into HTML - which can then be displayed. This is what is being advertised as WYSIWYG for oXygen - add a .CSS file and you can see the changes in the end HTML result as you change the XML data.

Refer to this page, section "Based on W3C Standards" where it mentions that CSSs are used to render the WYSIWYG view: https://www.oxygenxml.com/xml_editor/wysiwyg_xml_editor.html

With regards to Fantasy Grounds: the XML used in Fantasy Grounds that contains the window layout definitions does not get transformed into HTML via a .CSS - it is read directly by FG and the data used to create windows, forms, etc.. It is completely Fantasy Grounds specific - and currently there is not a WYSIWYG editor for FG XML.

I suppose it *may* be possible to write either a .CSS file or other definition file that oXygen (or some other editor/ XML renderer) could read specific to Fantasy Grounds, but it would only cover the basics I would imagine - and it would probably be a lot of work and would need updating each time an upgrade to FG changed anything.

Griogre
July 1st, 2013, 21:28
Personally, I use Visual Studio or Notepad++ for XML. OXyegen, XMLSpy and any of the other dedicated XML editors would be like using a jackhammer to attach a paper to a cork board - gross overkill. I'd suggest you get the free Notepad++ or an express version of Visual Studio, both which are free.

Trenloe
July 1st, 2013, 21:44
Does anybody know of a true WYSIWYG XML editor (i.e., similar to MS Word)? Or, am I not understanding oXygen to its full potential (which could be the case)?
I suppose I should have asked the question: "What do you expect a WYSIWYG XML editor to show as WYSIWYG?"

As mentioned before, XML is a data structure - not specifically graphical/rich text components, so expecting something like Word isn't really appropriate for editing XML.

As Griogre mentions, Notepad++ is a good text editor - showing all of the XML tags and allowing you to open and close tagged sections easily.

But, as I'm not sure what you mean by WYSIWYG XML editing, I can't comment further. Unless you were referring to editing FG layout XML and expecting to see a graphical representation of the FG GUI? In which case, I answered this in post #2 above.

sakmerlin37
July 1st, 2013, 22:36
@Trenloe,

From my understanding of markup languages, they have existed since typeset where the editor would physically markup a document, as needed; Word, WordPerfect et al. usually do the markup in the background, thus precluding the need to type <b></b>, <header 1></header 1>, etc. The WYSIWYG components in Word provide graphical application of SGML.

XML, again from what I understand, meaning that I am definitely not a pro, is a markup language, specific to web-based rendering. WYSIWYG HTML editors exists (i.e., see drupal's implementation). So, what I am searching for is an XML editor on which I can press a 'B' button after highlighting text, instead of typing in [TAB],[TAB],[TAB],<b>my text here</b>, to get a bold text (much like this message box into which I am typing at the moment).

@Griogre
I use Linux, so Notepad++ isn't available :cry: , I used Notepad++ for years. I usually use vim for editing, with a ton of plugins installed & several options turned on. I love vim more than almost anything in the *Nix world :D

Trenloe
July 1st, 2013, 22:56
XML, again from what I understand, meaning that I am definitely not a pro, is a markup language, specific to web-based rendering. WYSIWYG HTML editors exists (i.e., see drupal's implementation). So, what I am searching for is an XML editor on which I can press a 'B' button after highlighting text, instead of typing in [TAB],[TAB],[TAB],<b>my text here</b>, to get a bold text (much like this message box into which I am typing at the moment).
OK, there is a definite misunderstanding of XML here. XML stands for eXtensible Markup Language - the eXtensible bit means that tags are not defined and anyone can add to the tags (extend) for their own use. I talk about XML as it relates to Fantasy Grounds in this thread: https://www.fantasygrounds.com/forums/showthread.php?t=19018

The Bold tag <b> your are mentioning is actually HTML, not XML. If you're interested in creating formatted text for use in Fantasy Grounds, then you can use any HTML editor to create the formatted text - just be aware that the formattedtext control in Fantasy Grounds does not support all HTML formatting - see this thread for info: https://www.fantasygrounds.com/forums/showthread.php?t=14323

The gotcha is that once you have formatted text with the various supported HTML tags, you will have to manually copy/paste this into the relevant portion of the FG database (stored as XML) - so it's not the easiest thing to do. Some of this is mentioned in this thread: https://www.fantasygrounds.com/forums/showthread.php?t=15656

That's given you a lot of threads to read! ;)

I'm still not clear as to what you want an HTML WYSIWYG editor for? Are you going to enter story entries outside of Fantasy Grounds and then bring them in? Are you looking to create your own Fantasy Grounds library modules?

Or, am I getting confused and you don't intend to import anything into Fantasy Grounds and it was just a question about editing XML in general? :)

sakmerlin37
July 1st, 2013, 23:47
@Trenloe,

That is a ton of reading, thank you! I was hoping to ease the pain of Fantasy Grounds module development; I'm currently working on one and, although I usually like coding, HTML coding is like repeatedly hitting your thumb with a hammer.

Thanks, again, for the clarification on the eXtensible part; I take it that is how Smiteworks implemented XML: the company created their own tags which is read and rendered by their program specific to their requirements.

So, what I was searching for was a program that rendered basic XML from a WYSIWYG interface. The easiest example would be this message entry window.

I could type to '[ B ] [ / B ]' get a bold text, or, alternatively, I could type the word 'bold' highlight it and then just hit the button; the magic of coding being completed in the background.

Dreamweaver was an HTML WYSIWYG editor, where I was able to type and format words in a page and then click a button to see the HTML created. MS Word, et al., used to have that ability, as well (for those old-timers like me, who might remember seeing that stuff); I'm not sure if they still do, but it used to be part and parcel of what I saw on the screen as I typed.

I found a wonderful PDF from the University of Florida (https://chnm.gmu.edu/digitalhistory/links/pdf/chapter3/3.19a.pdf) that shows WordPerfect (Figure 4) and how it used to show SGML. (Note: This is off FG's site, use proper & safe browsing protocols)

EDIT: hehe, the software rendered the the bold tags, so I added spaces

Trenloe
July 2nd, 2013, 00:31
Thanks, again, for the clarification on the eXtensible part; I take it that is how Smiteworks implemented XML: the company created their own tags which is read and rendered by their program specific to their requirements.
Correct. This is how *everyone* who uses XML has to use it. There is only one standard XML code, found at the beginning of a document "<?xml version="1.0"?>" every tag after that is custom. Of course, if you're creating an XML document that will be used with a specific application, that application will have it's XML format defined - but it is specific to that application. See his section of the ruleset modification guide for a few examples of how XML is used in Fantasy Grounds: https://www.fantasygrounds.com/modguide/templates.xcp


So, what I was searching for was a program that rendered basic XML from a WYSIWYG interface. The easiest example would be this message entry window.

I could type to '[ B ] [ / B ]' get a bold text, or, alternatively, I could type the word 'bold' highlight it and then just hit the button; the magic of coding being completed in the background.
I think we need to look at an example here... This is a cut-down version of the 3.5e ruleset XML database specification for an NPC:

<Aasimar>
<name type="string">Aasimar</name>
<alignment type="string">NG</alignment>
<strength type="number">8</strength>
<dexterity type="number">10</dexterity>
<constitution type="number">14</constitution>
<intelligence type="number">13</intelligence>
<wisdom type="number">17</wisdom>
<charisma type="number">14</charisma>
<fortitudesave type="number">+4</fortitudesave>
<reflexsave type="number">+0</reflexsave>
<willsave type="number">+5</willsave>
<hp type="number">11</hp>
<init type="number">+0</init>
<xp type="number">200</xp>
<text type="formattedtext">
<p>This supernaturally beautiful woman looks human, yet emanates a strange sense of calm and benevolence.</p>
<p><b><u>Spell-Like Abilities</u></b> (CL 1st)</p><list><li><b>1/day-</b>daylight</li></list>
<p><b><u>Cleric Spells Prepared</u></b> (CL 1st)</p><list><li><b>1st-</b>bless, command (DC 14), protection from evilD</li><li><b>0 (at will)-</b>detect magic, guidance, stabilize</li><li><b>D domain spell</b>; Domains Good, Healing</li></list>
<p></p><p>Aasimars are humans with a significant amount of celestial or other good outsider blood in their ancestry. Aasimars are not always good, but it is a natural tendency for them, and they gravitate to good faiths or organizations associated with celestials. Aasimar heritage can hide for generations, only to appear suddenly in the child of two apparently human parents. Most societies interpret aasimar births as good omens. Aasimars look mostly human except for some minor physical trait that reveals their unusual heritage. Typical aasimar features are hair that shines like metal, unusual eye or skin color, or even glowing golden halos.</p> <h>Aasimar Characters</h> <p>Aasimars are defined by class levels - they do not possess racial Hit Dice. Aasimars have the following racial traits.</p> <p><b>+2 Charisma, +2 Wisdom</b>: Aasimars are insightful, confident, and personable.</p> <p><b>Normal Speed</b>: Aasimars have a base speed of 30 feet.</p> <p><b>Darkvision</b>: Aasimars can see in the dark up to 60 feet.</p> <p><b>Skilled</b>: Aasimars have a +2 racial bonus on Diplomacy and Perception checks.</p> <p><b>Spell-Like Ability</b>: Aasimars can use <i>daylight</i> once per day as a spell-like ability (caster level equals the aasimar's class level).</p> <p><b>Celestial Resistance</b>: Aasimars have acid resistance 5, cold resistance 5, and electricity resistance 5.</p> <p><b>Languages</b>: Aasimars begin play speaking Common and Celestial. Aasimars with high Intelligence scores can choose any of the following bonus languages: Draconic, Dwarven, Elven, Gnome, Halfling, and Sylvan.</p>
</text>
<token type="token">tokens/Aasimar.png@Bestiary13rdPrinting</token>
</Aasimar>
You can see that this contains tagged entries with names specific to the 3.5e ruleset <alignment>, <strength>, etc.. These are all XML tags that are specific to Fantasy Grounds - and the 3.5e ruleset. The data held within these tags is used by various parts of the ruleset to display information, make combat calculations, etc..

Note the <text type="formattedtext"> tag and it's contents. This is HTML that is understood by the Fantasy Grounds "formattedtext" control. If a formattedtext control is anchored to this <text> XML field then it will render the HTML within the field. Here is the resulting rendered text:
https://dl.dropboxusercontent.com/u/39085830/Screenshots/formattedtext%20control.png

This is really the only place within Fantasy Grounds where you will be using HTML tags such as <b> for bold, <i> for italics etc.. This is not XML! It is HTML data being held within an XML tag <text>. Take the HTML data from within the <text> tags and put it into any HTML viewer and you'll see the same. For example, in this online HTML editor/viewer, click the "source" button, paste in the HTML code from within the <text> tags in the above example and press the "source" button again: https://www.quackit.com/html/online-html-editor/

What I'm trying to say is that there is not a WYSIWYG XML editor - because XML does not have visual components! Think of an example from the code above - <alignment> doesn't have any visual component - how would you edit this in a WYSIWYG editor? The only "thing" in FG XMl that has a visual component is the HTML text that is tied to a formattedtext control - and this is XML data, not a XML <tag>. XML data needs to be combined with an application that reads the data specifically for its own use (e.g. Fantasy Grounds) or it needs to have a Cascading Style Sheet (CSS) to convert the data into HTML for viewing - which is where oXygen was saying it was WYSIWYG editor when combined with a CSS.

So, if you want to write HTML text with shortcuts to HTML tags, use any of a multitude of HTML editors - I give you a link to a web page that is a WYSIWYG HTML editor. Then, if you need to bring this into an FG XML data structure, copy/paste into that structure within an XML editor - something like Notepad++ or whatever is similar for Linux.

Doswelk
July 2nd, 2013, 05:10
WHen I am building modules for FGII these days, I use FGII for the WYSIWYG elements and building NPCs (now also Edges/Hindrances/Gear using iKael's library extension).

Once I have keyed it all in, then I use Notepad++ with the XML plugin to build the module itself.

Callum
July 2nd, 2013, 09:17
To expand a little on what Trenloe and Doswelk have said, the only WYSIWYG editor for FG's XML is Fantasy Grounds itself! When you're running the FG software, you get a nice GUI that helps you to input an NPC's alignment, strength, etc, and reminds you which elements you might need to include. It even lets you format text using the standard keyboard shortcut keys (eg Ctrl+B)! Unfortunately, it doesn't give you access to every single thing you might want to add, and the process can be a little long - but that's partly due to the complexity of the concepts being encoded in the XML (ie the rules of the game).

sakmerlin37
July 2nd, 2013, 18:39
Thanks, all, for your patience as I am learning a new concept. I'm still trying to wrap my head around this...

XML is like meta-data that requires a specific program to understand its tags (which can be anything needed, like <books></books>; <mycollection1></mycollection1>; etc.) and then uses either HTML or CSS, or C++ or any other GUI program to use the XML data.

So, it's not really a "markup language" in that it does not tell a system how to render the information, it seems to be more as a container of information which can be used as required by the program.

I guess that's where my confusion came up; I'm telling age here, but I used to "markup" news articles, poetry, published books, etc. using a blue or red pen/pencil/marker. In today's digital age, the term "markup" as regards published material seems to mean, mark the text up any way you want using tags, properly closed, as long as it is legible in the final product.

EDIT: Understanding this now, I cannot, for the life of me, think why anybody in their right mind would pay the price of some of these XML programs; heck, I have a program called Bluefish that does what these programs do.

Griogre
July 2nd, 2013, 19:12
To add a few things, I'm almost sure there will be a Vim plugin for XML but what it will do is check for matching elements (tags) and color code them.

I like to add that XML as used by FG (and most other programs) is basically a custom data storage/structure - very much like an individual save file. Further, each individual *ruleset* could and does have a different structure. That said, most rulesets have very similar XML structures because the all grew out of a handful of example rulesets.

Edit: Got distracted while writing this and sakmerlin37 posted before me.

People buy some of those programs because for a certain niche audience they can help them be very productive. However *because* it is a niche the price tends to be high because of the small number of sales (and often if licenses are bought in bulk there are very steep discounts).

Valarian
July 3rd, 2013, 13:35
I use JEdit for XML coding and highlighting. Great text editor. It does code highlighting for Lua as well.
https://www.jedit.org/

What I tend to do for development of character / NPC sheets is to add in the XML, save the file (working in a development ruleset in the rulesets folder), then do /reload in Fantasy Grounds to see the changes.

Ikael
July 3rd, 2013, 13:40
I use JEdit for XML coding and highlighting. Great text editor. It does code highlighting for Lua as well.
https://www.jedit.org/

What I tend to do for development of character / NPC sheets is to add in the XML, save the file (working in a development ruleset in the rulesets folder), then do /reload in Fantasy Grounds to see the changes.

I second JEdit program for XML and lua. I have used it all the time for managing my modules and doing FG coding. However now I have switched to Eclipse IDE.

Still if you like to have real FG WYSIWYG-editor use the FG interface for writing your stuff, export them out and manage the XML mingling manually. That's the best way.

sakmerlin37
July 4th, 2013, 06:50
@Ikael,

Thanks, I may try to do it that way, that way I can see what's happening; how do you guys check out as you write, open your work in FG?

Trenloe
July 4th, 2013, 19:47
@Ikael,

Thanks, I may try to do it that way, that way I can see what's happening; how do you guys check out as you write, open your work in FG?
Yep, I'm constantly updating the module .mod file and then seeing how it looks in FG. If you close and re-open the module within Module Activation it will re-load the updated data. No need to reload the whole ruleset.

sakmerlin37
July 7th, 2013, 00:27
That's an awesome piece of advice, it's been saving me a bit of time not having to /reload!