org.apache.metamodel.xml
Class XmlSaxTableDef

java.lang.Object
  extended by org.apache.metamodel.xml.XmlSaxTableDef
All Implemented Interfaces:
Serializable

public final class XmlSaxTableDef
extends Object
implements Serializable

Defines a table layout for XmlSaxDataContext. This class is used as an instruction set of xpath expressions for the datacontext to create Tables. These types of expressions are allowed in the XmlSaxTableDef:

If, for example, this is your XML document:
 <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: Or if you wanted to extract information about employees:

See Also:
Serialized Form

Constructor Summary
XmlSaxTableDef(String rowXpath, String[] valueXpaths)
          Constructs a XmlSaxTableDef based on an xpath expression for the row scope and an array of xpath expressions for the individual values (columns) within a row.
 
Method Summary
 boolean equals(Object obj)
           
 String getRowXpath()
           
 String[] getValueXpaths()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlSaxTableDef

public XmlSaxTableDef(String rowXpath,
                      String[] valueXpaths)
Constructs a XmlSaxTableDef based 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/employee
valueXpaths - 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)]
Method Detail

getRowXpath

public String getRowXpath()

getValueXpaths

public String[] getValueXpaths()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.