Package org.apache.metamodel.xml
Class XmlSaxTableDef
- java.lang.Object
-
- org.apache.metamodel.xml.XmlSaxTableDef
-
- All Implemented Interfaces:
Serializable
public final class XmlSaxTableDef extends Object implements Serializable
Defines a table layout forXmlSaxDataContext. This class is used as an instruction set of xpath expressions for the datacontext to createTables. These types of expressions are allowed in theXmlSaxTableDef:- Element selectors: "/path/to/element"
- Attribute selectors: "/path/to/element@attribute"
- Element index selectors: "index(/path/to)" (can be used to make cross-references to parent tags)
<root> <organization type="company"> <name>Company A</name> <employees> <employee> <name>John Doe</name> <gender>M</gender> </employee> <employee> <name>Jane Doe</name> <gender>F</gender> </employee> </employees> </organization> <organization type="government"> <name>Company B</name> <employees> <employee> <name>Susan</name> <gender>F</gender> </employee> </employees> </organization> </root>Then if you wanted to extract information about organizations, these xpaths could work:- Organization row scope: "/root/organization"
- Organization name: "/root/organization/name"
- Organization type: "/root/organization@type"
- Employee row scope: "/root/organization/employees/employee"
- Employee name: "/root/organization/employees/employee/name"
- Employee gender: "/root/organization/employees/employee/gender"
- Employee organization index: "index(/root/organization)"
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description XmlSaxTableDef(String rowXpath, String[] valueXpaths)Constructs aXmlSaxTableDefbased on an xpath expression for the row scope and an array of xpath expressions for the individual values (columns) within a row.XmlSaxTableDef(String rowXpath, Collection<String> valueXpaths)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)StringgetRowXpath()String[]getValueXpaths()inthashCode()StringtoString()
-
-
-
Constructor Detail
-
XmlSaxTableDef
public XmlSaxTableDef(String rowXpath, String[] valueXpaths)
Constructs aXmlSaxTableDefbased on an xpath expression for the row scope and an array of xpath expressions for the individual values (columns) within a row.- Parameters:
rowXpath- an xpath expression for the scope of a record, eg. /companies/company/employeevalueXpaths- an array of xpath expressions for the individual values (columns) of a row. eg: [/companies/company/employee/name, /companies/company/employee/gender, index(/companies/company)]
-
XmlSaxTableDef
public XmlSaxTableDef(String rowXpath, Collection<String> valueXpaths)
-
-