At the core of Lotus Component Designer is XML. Even though we don't put it right in your face, it's there if you need it. This post covers a few areas where you can use XML directly in Designer.The XML Schema Editor
- A full-featured, easy to use editor. Work in visual mode or text. You can also import an existing schema into Designer. I do that all the time to jump start my app. I've found that starting with a schema is easier (and better) than building your schema on the fly, as you work. You have to think of what you are building first and what data structure you want for your documents.
(click to open larger image)
- Documents created with Designer are XML and follow the schema that you are using. So, for example, you'd end up with a document with the elements from the schema - i.e. a <taskName> element, a <taskOrder> element, etc. XML is heirarchical, so your documents can be organized appropriately, as in the <Issues> element in my schema above. Once you have designated a data source for a page, the schema becomes available in the Data Palette, from which you can drag and drop to create input controls or whatever.
- You address a "field" in a Designer document using XPath. I think of it as a way of reaching into the document to select a certain element. So, document.getStringValue("/tasks/taskName") refers to the <taskname> element. XPath can be quite complex, but the basics are pretty straightforward. XPath expressions are part of the extensions we've done to JSF, so that you can use it for JSF value expressions. See the script editor below, where you can use XPath expresssions.
This example would total all of the "/costs" elements in the document and put the value in the field.XML DOM.
In the scripting world, you can use either the Designer built-in document api, which is easy to understand and use, or you can go directly against the XML document using the standard XML DOM API
. The Document API also has these functions because it inherits from the DOM. Any, you can see the objects in the DOM below. XML Data Source.
Another place where you can access XML directly is via a Data Source. A Data Source is added to a page and is used in the page, to bind UI controls to, using the Data properties for the control. One of the data source types is XML File - others are Designer document, Domino db, Relational Query, and Web Service. So, you can directly call some XML, either a file or URL that returns an XML document and use that on the page, all without parsing the doc yourself. The only thing you have to do manually right now is to provide a schema that the XML maps to - this is so we can visualize the data source in the Data Palette (as in the picture above).
The Data properties for a page showing an XML Data Source.
I wanted to use this to go get some RSS, but would you believe it ?- there's no XML Schema file that I could find for RSS! Someone did try to do it as a side project, but it's huge! I think the trick is to do something simple in the Designer Schema Editor that just defines the elements you care about and forget about the rest. The essence of RSS is pretty straightforward, I just haven't done it yet. Once you've done this step, you can use that XML on your page - I'd probably put it inside a repeating control, which iterates over the XML document automatically.
As you can tell from this post, there's a lot of different ways that XML is used in Component Designer. It's a fundamental building block for the product and how you work with its documents. Designer hides a lot of the complexity in working with XML, but it can be quite powerful to use it directly.Download Component Designer Beta.
Manager, User Experience Design for Notes and Sametime