+ All Categories
Home > Documents > INDIANAUNIVERSITYINDIANAUNIVERSITY Starting XML Content During this class, you'll be writing your...

INDIANAUNIVERSITYINDIANAUNIVERSITY Starting XML Content During this class, you'll be writing your...

Date post: 02-Jan-2016
Category:
Upload: elisabeth-rice
View: 219 times
Download: 2 times
Share this document with a friend
87
I N D I A N A U N I V E R S I T Y Starting XML Content During this class, you'll be writing your XML in Eclipse and copying the code into OneStart using the publishing options covered in the previous class. If you're new to Eclipse, there will be time during the first exercise to get familiar with it.
Transcript

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Starting XML Content

During this class, you'll be writing your XML in Eclipse and copying the code into OneStart using the publishing options covered in the previous class.

If you're new to Eclipse, there will be time during the first exercise to get familiar with it.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Portal Element

The <portal> element is the outer tag that contains the XML content.

All of your XML goes within this root element.<portal xmlns="https://onestart.iu.edu"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="https://onestart.iu.edu

xmlportlet.xsd"> .........

</portal>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Content Pages

Put content into separate "pages" within a single XML file Can use content navigation and content links to provide navigation within XML content

<content-page content-page-number="1">

</content-page>

<content-page content-page-number="2">

</content-page>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Links

Can link to other content pages, external links, portal pages.<link content-page-number="2"

title="Display Title" focus="fullscreen" />

<link url="https://onestart.iu.edu"

title="Display Title" window-width="1000"

window-height="800" status="yes" scrollbars="no"

resizable="no" toolbar="no" location="no"

menubar="no" directories="no" />

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

More Link attributes

Using the image-button-name attribute, <link> element can also be used to create a button that will dynamically change color determined by the tab the user is on.

<link url="http://mywebapplication.edu" image-button-name="view"/>

You can also put your own image in by using the <image> attribute. Other attributes include specifying size in pixels using image-width and image-height, and image-alt to provide HTML alt functionality.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<link-param>

Using <link-param> with content page links you can pass values from one content-page to another:

<link content-page-number="2" title="Pass param">

<link-param name="test" value="1" />

</link>

<content-page content-page-number="2">

${test}

</content-page>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Additional Attributes

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Image

You can also just put your own image in that is not a link by using the <image> tag. Image contains attributes specifying size in pixels using width and height, alt to provide HTML alt functionality, and button-name.

<image location=

"https://www.example.com/myimage.gif"

width="100" height="200"/>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<list>

The list tag allows both ordered and unordered lists.

<list ordered="false">

<list-item >myitem</list-item>

</list>

Becomes in HTML:

<ul>

<li>myitem</li>

</ul>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<table>

You can create tables much like you can in HTML.<table borders="true" width="90%">

<row>

<header width="10%">Name:</header>

<cell width="90%">

My cell text

</cell>

</row>

</table>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<more-info>

Creates an area for displaying contact information.<more-info email="[email protected]"

url="http://www.example.com/helppage"

display-name="My Help URL"/>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML/HTML Conversion

XML HTML

<align value="center"> move to center</align>

<div align="center"> move to center</div>

<bold> Bold Text </bold> <strong> Bold Text </strong>

<heading text="This is a heading" />

<h3> This is a heading </h3>

<newline /> <br />

<paragraph> Write a paragraph</paragraph>

<p> Write a paragraph</p>

<separator /> <hr />

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Special Entities

As in HTML, replacements in XML content are necessary for special entities &: &amp; <: &lt; >: &gt;

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML Content Exercise #1 (Introduction)

In Eclipse, open the file "XML Content Exercise 1.xml" contained in the folder "publisherTraining/Exercises" and follow the included instructions.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Permissions/Conditions

Using information available to OneStart through ADS, you can specify what information will be made available to different types of users.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<variable>

The <variable> element is used to create variables in your xml content that can be used in conditions, permissions, and general displays.

Local variables are declared within one of your content page tags and can only be referenced in that content page, whereas global variables are set outside of a specific content page and can be accessed throughout your XML content.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Variable type

Type is an optional attribute of variable that supports two values:

date-format person-attribute

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Variable type="date-format"

<variable name="today"

type="date-format"

type-value="MM/dd/yyyy" />

Can also use offset attributes to reference times in the future or past:<variable name="tomorrow" type="date-format"

type-value="MM-dd-yyyy" day-offset="1" />

<variable name="HourFromNow" type="date-format" type-value="h:mm a" minute-offset="60" />

<variable name="OneWeekAgo" type="date-format" type-value="MM-dd-yyyy" day-offset="-7" />

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<variable>, usingperson-attribute

<variable name="email"

type="person-attribute"

type-value="user.iu.email" />

In this example you could display the user's email by using the following variable reference:

${email}

For more person-attribute values see:

https://uisapp2.iu.edu/confluence//x/NICd

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<variable>(With Test Attribute, Xpath)

Comparing with Test:<variable name="MyVariable" value="variableValue1"/>

<variable name="MyVariable2" value="variableValue2"

test="$[MyVariable] = 'test'"/>

<variable name="MyVariable2" value="variableValue3"

test="$[MyVariable] = 'variableValue1'"/>

Referencing with Xpath:<variable name="myNewTestVariable"

dataset="myDataset"

xpath="data/rows/row/more_xpath_to_my_data" />

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<xpath>

Language for navigating XML documents Supported in XML contents using <xpath> element

Examples taken from:

http://www.w3schools.com/Xpath/default.asp

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

/bookstore

<?xml version="1.0" encoding="ISO-8859-1"?>

<bookstore>

<book>

<title lang="eng">Harry Potter</title>

<price>29.99</price>

</book>

<book>

<title lang="eng">Learning XML</title>

<price>39.95</price>

</book>

</bookstore>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

/bookstore/book

<?xml version="1.0" encoding="ISO-8859-1"?>

<bookstore>

<book>

<title lang="eng">Harry Potter</title>

<price>29.99</price>

</book>

<book>

<title lang="eng">Learning XML</title>

<price>39.95</price>

</book>

</bookstore>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

/bookstore/book/title

<?xml version="1.0" encoding="ISO-8859-1"?>

<bookstore>

<book>

<title lang="eng">Harry Potter</title>

<price>29.99</price>

</book>

<book>

<title lang="eng">Learning XML</title>

<price>39.95</price>

</book>

</bookstore>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

/bookstore/book[price>35.00]/title

<?xml version="1.0" encoding="ISO-8859-1"?>

<bookstore>

<book>

<title lang="eng">Harry Potter</title>

<price>29.99</price>

</book>

<book>

<title lang="eng">Learning XML</title>

<price>39.95</price>

</book>

</bookstore>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<permission>

Three different ways to create permissions:

Person – personAttribute; user information from ADS Group – ADS group Role – cachedPermissions; these are complex expressions created by the OneStart team

Additionally, <or>, <not>, and <and> elements can be used to form complex permission expressions.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<permission>Example

<permission name="myPermission">

<![CDATA[

<or>

<personAttribute key="user.iu.ou" value="BL"/>

<group key="BL-UITS-ONESTART-TEAM"/>

<cachedPermission key="iu-permission-in-student"/>

</or>

]]>

</permission>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<permission> Example, A Little More Complex

<or>

<cachedPermission key="IU-PERMISSION-CO-FORMER-STUDENT"/>

<and>

<cachedPermission key="IU-PERMISSION-STUDENT"/>

<group key="MY_ADS_GROUP"/>

<not>

<personAttribute key="user.iu.ou" value="BL"/>

</not>

</and>

</or>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<if>

The if tag is used to create conditionals.<if test="$[myVariable] != 'variableValue'">

My variable

</if>

<if permission="IU-PERMISSION-STAFF">

I am a staff.

</if>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<safeword-protect>

<safeword-protect>

My safeword card projected data.

</safeword-protect>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML Content Exercise #2 (Permissions)

In Eclipse, open the file "XML Content Exercise 2.xml" contained in the folder "publisherTraining/Exercises" and follow the included instructions.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

External Data Sources

Access your existing XML files (including RSS feeds) as well as your personal databases using the <dataset> element

Supported Databases:OracleMySQLMicrosoft SQL

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<dataset>

In this example, we retrieve data from an external xml file:<dataset name="datasetFromURL"

datasource=

"https://www.example.com/sample.xml" />

In this example, we retrieve data from an external database we registered with OneStart:<dataset name="datasetFromDB"

datasource="ourDatasource"

query="SELECT 1 FROM DUAL" />

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<dataset-bind-param>

Allows you to dynamically assign parameters while querying a database "index" attribute defines the order you want your parameters inserted into the query "type" attribute specifies whether the bind-param is an "int", "long", or "string"

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Dynamic Dataset Query

<dataset name="myDataset"

datasource="myDatabase"

query="select name from userTable where

year = ? and user_id != ?"

cache-minutes="30" cache-type="user">

<dataset-bind-param index="1" type="int">

2009

</dataset-bind-param>

<dataset-bind-param index="2" type="string">

${userId}

</dataset-bind-param>

</dataset>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

cache-minutes & cache-type

cache-minutes: how often you want OneStart to fetch the data from your database cache-type: valid values are "user" and "global" If your query is specific to the user logged in use the "user" type, so OneStart will create a new cache for each user who views this page Use global if your query is not unique to each user, therefore all users share the same cache.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Iterate Over Retrieved Data

Often times your datasets will contain multiple results. OneStart offers three ways to display/interact with your data:

<rss><data-table><for-each>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Working With RSS Feeds

If your datasource is an RSS feed, you can display its contents as they appear in other feed readers.<dataset name="exampleRss"

datasource="https://www.example.com/rss.aspx"

cache-minutes="5" cache-type="global"></dataset>

<content-page content-page-number="3">

<rss dataset="exampleRss"

showRssImage="true" showRssTitles="true"

showRssDescriptions="true" />

</content-page>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<data-table>

Presents your data in a table that takes advantage of paging and sorting.<data-table name="User"

dataset="usersDB" page-size="5" >

<data-column header="User Name" name="userName" />

<data-column header="Person ID" name="personID" />

<data-column header="Action" id="action1">

<data-column-text test="${User.personID == 'admin'}">

This text will appear only when personID is equal to 'admin'.

</data-column-text>

</data-column>

</data-table>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Why visible="false"?

By making visible="false", it will not display in your table, but you will have access to it in your URL.

<data-table name="userTable" dataset="userDB">

<data-column header="User Name" name="userName" />

<data-column header="userID" name="userID" visible="false"/>

<data-column header="Action" id="action1">

<data-column-text >

<link title="Change"

url="https://www.example.com/edit=${userTable.userID}"/>

</data-column-text >

</data-column>

</data-table>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

for-each example

<list>

<for-each var="myVariable" dataset="myDB">

<list-item>${myVariable.title}</list-item>

</for-each>

</list>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML Content Exercise #3 (Datasets)

In Eclipse, open the file "XML Content Exercise 3.xml" contained in the folder "publisherTraining/Exercises" and follow the included instructions.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Forms

Options for form submission:Save to a databaseDelete form databaseSend form contents as emailSave user preferenceSend request to any listening server

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Form Examples

Save to database<form action="save" data-write="myDatabase"

content-page-number-success="2"

content-page-number-failure="5" id="myform1">

other tags...

</form>

Delete to database<form action="delete" data-write="myDatabase"

content-page-number-success="2"

content-page-number-failure="5" id="myform1">

other tags...

</form>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

More Form examples

Post to server<form action="https://www.example.com/"

id="myform1"> other tags...

</form>

Send email<form action=”[email protected]” id="myform1"> other tags...

</form>

Save preference to OneStart<form action="preference” id="myform1">

other tags...

</form>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Preferences

Setting action="preference" saves form entries to OneStart database

Can be accessed on different pages of your XML content using variable syntax• ${myPreference}

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<textbox>

<textbox name="myTextboxName" size="30"

default="MyDefaultArea" />

The size attribute specifies the length of the text box. You can also use the rows attribute to add more lines to the text area:

<textbox name="myTextAreaName"

size="30" rows="4"

default="MyDefaultArea" />

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<textbox>(with calendar)

If you need a date textbox and want a calendar popup window use the following:

<textbox name="myTextboxName" size="30"

date-format="MM/dd/yyyy" calendar="true"

form-id="myform1"/>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

hidden

The <hidden> element is used to include additional information in a form submission beyond that which was entered by the user.

<hidden name="myName" value="myValue" />

<hidden name="myName2" value="myValue2" type="session"/>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<dropdown>

Dropdown creates a list of options from which a user selects. The following dropdown example includes 4 different options and sets the second option to be selected by default:

<dropdown name="myDropdown">

<option title="option 1" value="a" />

<option title="option 2" value="b"

default="true" />

<option title="option 3" value="c" />

<option title="option 4" value="d" />

</dropdown>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Checkboxes & Radio Buttons

<checkbox name="checkboxName"

default="checked" />

<radio-group name="myRadioGroup">

<radio title="Radio option 1"

value="1" default="true" />

<newline/>

<radio title="Radio option 2"

value="2" />

</radio-group>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

submit, reset & image

<submit name="mysubmitbutton"

title="Submit the form" />

<reset name="myresetbutton"

title="Reset the form" />

<image name="imageSubmit"

button-name="save" submit="true"/>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<validation> and <error>

These elements are used to ensure that form values entered by users fit the criteria your content is expecting.

Required fields Numeric values Date formatting See notes below for more

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<validation> and <error>example

<textbox name="myNumber" size="10">

<validation type="required"

message="Please enter something."/>

<validation type="is-integer"

message="Please enter an integer."/>

<validation type="greater-than"

message="Must be greater than 30."

value="30"/>

</textbox>

<error name="myNumber"/>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML Content Exercise #4 (Forms)

In Eclipse, open the file "XML Content Exercise 4.xml" contained in the folder "publisherTraining/Exercises" and follow the included instructions.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML Content Exercise #5 (Preferences)

In Eclipse, open the file "XML Content Exercise 5.xml" contained in the folder "publisherTraining/Exercises" and follow the included instructions.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Data-writes

The data-write tag enables you to use forms to add, update, and delete data from your external databases.

To do so, you must first specify a name for your data-write, a datasource (just as with datasets), and then create your SQL queries.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Writing to a Database

The <sql-query> element defines the SQL statements for maintaining your database.

select: retrieve a row from the databasenew: inserts a new row in the databaseupdate: modifies a row that currently exists in the databasedelete: deletes a row that currently exists in the database

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<data-write> examples, Select and Create

<data-write name="myDatawrite" datasource="myDB">

<sql-query name="mySelect" group="1"

type="select" sql="select my_column_1 from

my_table where my_column_2 = ?" />

<sql-query name="myNewQuery" group="1"

type="new" sql="insert into my_table

(my_column_1, my_column_2)

values (?, ?)" />

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<data-write> examples,Update and Delete

<sql-query name="myUpdateQuery" group="1"

type="update" sql="update my_table set

my_column_2 = ?, my_column_3 = ? where

my_column_1 = ?" />

<sql-query name="myDeleteQuery" group="1"

type="delete" sql="delete from my_table where

my_column_1 = ?" />

</data-write>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Question Marks

Question marks ('?') in our SQL are replaced when the queries are executed

Similar to dynamic dataset queries discussed earlier

As part of form input, <bind-query> specifies replacement value

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<bind-query>(Delete)

<form action="delete" data-write="myDatabase"

content-page-number-success="2"

content-page-number-failure="5" id="myform1">

<textbox name="column_1_value" size="30">

<bind-query query-name="myDeleteQuery"

bind-param-index="1" database-type="string"

primary-key="true" database-column="my_column_1" />

<bind-query query-name="mySelectQuery"

bind-param-index="1" database-type="string"

primary-key="true" database-column="my_column_1" />

</textbox>

<submit name="mysubmitbutton" title="Submit the form"/>

</form>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<refresh-dataset-cache>

Used inside forms when you need to refresh your dataset after the form has been submitted.

<form action="delete"

data-write="myDatawrite"

content-page-number-success="1"

content-page-number-failure="5" id="myform">

<refresh-dataset-cache dataset="myDataset"/>

</form>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML Content Exercise #6 (Datawrite)

In Eclipse, open the file "XML Content Exercise 6.xml" contained in the folder "publisherTraining/Exercises" and follow the included instructions.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Create Charts from Datasets

The following chart types are available via thetype attribute:

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Charts

<chart name="chart2" dataset="production-ws"

type="bar" legend="right" height="550"

width="800">

…Other tags…

</chart>

Name, Dataset, and Type are required for all charts.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<chart-element>

<chart name="chart2" dataset="production-ws"

type="bar" legend="right" height="550"

width="800">

<chart-element name="category-name"

type="category" />

<chart-element name="production-level"

type="value" />

</chart>

Chart-element tags define the data to be plotted.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<chart-option>

<chart name="chart2" dataset="production-ws"

type="bar" legend="right" height="550"

width="800">

<chart-option type="range-label"

type-value="Range"/>

<chart-element name="category-name"

type="category" />

<chart-element name="production-level"

type="value" />

</chart>

Chart-option tags can be used to change the appearance and operation of the chart.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<chart-element-option>

<chart-element name="total" type="value" >

<chart-element-option type="integer-tick-units"

type-value="true"/>

</chart-element>

Children of <chart-element> Specific to an axis Used to format display of data, labels for an axis

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Pie Chart Example

<chart name="animal-chart-pie" dataset="animals"

type="pie" title="Preferred Household Pets"

legend="right">

<chart-element name="category-name"

type="category" />

<chart-element name="number-who-prefer"

type="value" />

</chart>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Time Series Example

<chart name="timeseries-example" dataset="production-ts"

type="timeseries" title="Chart Example" legend="right" width="500">

<chart-option type="range-label" type-value="Production Level"/>

<chart-option type="shapes-visible" type-value="true"/>

<chart-element name="mydate" type="category" >

<chart-element-option type="time-increment" type-value="day" />

<chart-element-option type="date-format" type-value="yyyy/MM/dd" />

</chart-element>

<chart-element name="production-level" type="value"/>

<chart-element name="series-name" type="series"/>

</chart>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML Content Exercise #7 (Charts)

In Eclipse, open the file "XML Content Exercise 7.xml" contained in the folder "publisherTraining/Exercises" and follow the included instructions.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<tree>

Creates a tree hierarchy in which you can organize data in folders

Example of basic tree structure:

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Simple Tree Example

<tree>

<category id="1" title="My Category">

<item id="1" title="My Item1">

<description>This is description 1</description>

<link url="http://www.google.com" title="Google" />

</item>

<item id="2" title="My Item2">

<description>This is description 2</description>

<link url="http://www.iu.edu" title="IU" />

</item>

</category>

</tree>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Tree version 2

Load datasets into tree Uses Ajax to open and close folders

without reloading the page Can have nested folders and leaves.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Referencing Your Data

Need at least two different, previously defined datasets: Starting folders Starting "leaves" (folder contents) Each dataset needs to have parent information for their contents

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Setting up a dataset tree

<tree version="2" name="Bookmarks"

starting-folder-dataset="folders"

starting-leaf-dataset="bookmarks"

starting-folder-id="0"

default-icon-image-folder="3">

<tree-dataset dataset="folders" type="folder"

xpath-node-id="/data/rows/row/FLDR_ID"

xpath-node-parent-id="/data/rows/row/PRNT_FLDR_ID" bind-param-index="2"/>

<tree-dataset dataset="bookmarks" type="leaf"

xpath-node-id="/data/rows/row/BKMRK_ID"

xpath-node-parent-id="/data/rows/row/FLDR_ID"

bind-param-index="2"/>

…other tags… </tree>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Customizing your dataset tree

Four customization options:<tree-option type="height"

type-value="auto" />

<tree-option type="show-top-folder"

type-value="false" />

<tree-option type="show-column-headers"

type-value="true" />

<tree-option type="show-lines"

type-value="true" />

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Defining your tree's columns

Supports up to five columns Columns can be resized by dragging

column heading Contains internal/external links

(including email), more folders

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Column Options

<tree-column-option type="column-name"

type-value="Folder" />

<tree-column-option type="column-width"

type-value="300" />

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

<tree-column-fragment>

Create both folders and leaves in <tree-column-fragment>.

Specify the following attributes: title: text that is displayed node-type: leaf and folder

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Additional Attributes

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Retrieve Data to Display in Column

As with <dataset-bind-param> or <link-param>, we can use xpath stored in a variable to retrieve data.

<tree-column-fragment fragment-number="1"

node-type="leaf" url="{1}" title="{2}">

<tree-column-variable position="1"

xpath="/data/rows/row/BKMRK_URL"/>

<tree-column-variable position="2"

xpath="/data/rows/row/BKMRK_TITLE"/>

</tree-column-fragment>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Content Page Navigation Within Trees

You can pass folder or leaf information to other content pages.

<tree-column column-number="2">

<tree-column-option type="column-width"

type-value="250" />

<tree-column-fragment fragment-number="1"

node-type="folder" content-page-number="5"

title="delete {2}">

<tree-column-variable link-param="myId"

position="1" xpath="/data/rows/row/myId" />

<tree-column-variable position="2"

xpath="/data/rows/row/myTitle" />

</tree-column-fragment>

</tree-column>

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML Content Exercise #8 (Trees)

In Eclipse, open the file "XML Content Exercise 8.xml" contained in the folder "publisherTraining/Exercises" and follow the included instructions.

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

XML Content Future Enhancements

Writing to multiple databases on a single form submission

Checkbox validation require at least 1 or more are checked

Disabled checkboxes More chart types Publishing Mode

I

N

D

I

A

N

A

U

N

I

V

E

R

S

I

T

Y

Additional Resources

OneStart Documentation:

https://onestart.iu.edu/confluence/display/OSD


Recommended