File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes XML schema into jsf datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "XML schema into jsf datatable" Watch "XML schema into jsf datatable" New topic

XML schema into jsf datatable

Amrita SeungJo

Joined: Apr 09, 2014
Posts: 4
I have an xml schema.. I need to display it as JSF datatable can anybody help me..

This is my xml schema


<?xml version="1.0" encoding="UTF-8"?>

<shiporder orderid="889923" xmlns:xsi=""
<orderperson>John Smith</orderperson>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<title>Hide your heart</title>

<name>John Maxwell</name>
<address>400 street</address>
<note>Special Edition</note>


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="">

<xs:simpleType name="stringtype">
<xs:restriction base="xs:string" />

<xs:simpleType name="inttype">
<xs:restriction base="xs:positiveInteger" />

<xs:simpleType name="dectype">
<xs:restriction base="xs:decimal" />

<xs:simpleType name="orderidtype">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{6}" />

<xs:complexType name="shiptotype">
<xs:element name="name" type="stringtype" />
<xs:element name="address" type="stringtype" />
<xs:element name="city" type="stringtype" />
<xs:element name="country" type="stringtype" />

<xs:complexType name="itemtype">
<xs:element name="title" type="stringtype" />
<xs:element name="note" type="stringtype" minOccurs="0" />
<xs:element name="quantity" type="inttype" />
<xs:element name="price" type="dectype" />

<xs:complexType name="shipordertype">
<xs:element name="orderperson" type="stringtype" />
<xs:element name="shipto" type="shiptotype" />
<xs:element name="item" maxOccurs="unbounded" type="itemtype" />
<xs:attribute name="orderid" type="orderidtype" use="required" />

<xs:element name="shiporder" type="shipordertype" />


Please reply soon as i need to submit it today for my college project :( :(
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

Actually, your "XML Schema" is the XSD file. The file you're calling the XML schema is simply XML data. The schema is the data structure definition.

To represent this XML data in a datatable, you need to convert it into something that a JSF DataModel object can wrap - in other words, an ordered collection of row objects such as a List or array.

One popular way to do this with XML is to use the Apache Digester, which can read XML and emit an object tree based on the rules that you provided the Digester with.

There are lots of other ways of doing this as well, such as JAXB.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: XML schema into jsf datatable
jQuery in Action, 3rd edition