Directory

← Back

XmlContainer

Vaadin XmlContainer

Author

Rating

Popularity

<100

Simple Vaadin Container implementation that Bind data from XML file to BeanContainer. This addon use JaxB spec and the Dom Xml Parser Technic. Take a look at the Wiki for more details

Sample code

	protected void init(VaadinRequest request) {
		final VerticalLayout layout = new VerticalLayout();
		layout.setMargin(true);
		setContent(layout);

// Using Dom Parser
		XMLContainer xmlDataSource = XMLContainer.Factory.newInstanceForDom(FOLDER_PATH+"/adr.xml", Address.class);

// Or Using Jaxb Parser
                XMLContainer xmlDataSource = XMLContainer.Factory.newInstanceForJaxb(FOLDER_PATH+"/adr.xml", Address.class);

		
		Table xmlTable = new Table("LoadXmlData",xmlDataSource);
		layout.addComponent(xmlTable);
		xmlTable.setSizeFull();
		
		
	}

@XmlRootElement
public class Address {

	private String city;

	private String street;

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}
}
<?xml version="1.0" encoding="UTF-8"?>
<addresses>
    <address>
		<city>1 Some City</city>
        <street>1 Some Street</street>
    </address>
    <address>
		<city>2 Another City</city>
        <street>2 Another Road</street>
    </address>
    <address>
		<city>3 Last City</city>
        <street>3 Last Road</street>
    </address>
</addresses>

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Adding new calls

Released
2014-10-12
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Browser
Browser Independent

XmlContainer - Vaadin Add-on Directory

Vaadin XmlContainer XmlContainer - Vaadin Add-on Directory
Simple Vaadin Container implementation that Bind data from XML file to BeanContainer. This addon use JaxB spec and the Dom Xml Parser Technic. Take a look at the Wiki for more details
Online