Class XPathUtil
- java.lang.Object
-
- org.eclipse.birt.report.model.api.util.XPathUtil
-
public class XPathUtil extends java.lang.ObjectThe XPath string helps user locate this element in design file. It follows a subset of XPath syntax. Each node name indicates the name of the element definition and the 1-based element position in the slot. The position information is only available when the element is in the multicardinality slot.For example,
type examples element /report/body/table[3]
/library/components/grid/row[1]/cell[2]/labelslot /report/body
/report/body/*
/report/body/table/detail/row[slotName="cells"]
property /report/parameters/scalar-parameter[@id="2"]/@name
/report/list-property[@name="images"]
/report/body/text[@id="19"]/text-property[@name="content"]
/report/body/text[@id="19"]/text-property[@name="content"]/@keystructure (EmbeddedImageHandle/IncludedLibraryHandle/ResultSetColumnHandle) /report/list-property[@name="images"]/structure[2]
/report/list-property[@name="images"]/structureIt is strongly recommended not to call
getInstance(ModuleHandle, String)with manually created XPath string. Much better to use XPath string returned bygetXPath(Object).
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringRESOURCE_KEY_SUFFIXThe suffix for the resource key.static java.lang.StringSLOT_NAME_PROPERTYThe attribute to indicate a slot name.
-
Constructor Summary
Constructors Constructor Description XPathUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.ObjectgetInstance(ModuleHandle module, java.lang.String xpath)Returns the instance by the given XPath ofDesignElementHandle,SlotHandle,StructureHandle.static java.lang.StringgetXPath(java.lang.Object instance)Returns the XPath of the given instance.static java.lang.StringgetXPath(java.lang.Object instance, int index)Returns the script path of the given instance.
-
-
-
Field Detail
-
SLOT_NAME_PROPERTY
public static final java.lang.String SLOT_NAME_PROPERTY
The attribute to indicate a slot name.- See Also:
- Constant Field Values
-
RESOURCE_KEY_SUFFIX
public static final java.lang.String RESOURCE_KEY_SUFFIX
The suffix for the resource key.- See Also:
- Constant Field Values
-
-
Method Detail
-
getXPath
public static java.lang.String getXPath(java.lang.Object instance)
Returns the XPath of the given instance. For the structure, only EmbeddedImageHandle is supported.- Parameters:
instance- can beDesignElementHandle,SlotHandle,StructureHandle,PropertyHandle.- Returns:
- the XPath in string
-
getXPath
public static java.lang.String getXPath(java.lang.Object instance, int index)Returns the script path of the given instance.- Parameters:
instance-PropertyHandlewhich type or sub type must be expression or script.index- of property should be in valid range. 0 based- Returns:
- the path in string
-
getInstance
public static java.lang.Object getInstance(ModuleHandle module, java.lang.String xpath)
Returns the instance by the given XPath ofDesignElementHandle,SlotHandle,StructureHandle.- Parameters:
module- the report/libraryxpath- the XPath in string- Returns:
DesignElementHandle/SlotHandle/StructureHandle.
-
-