Class TLcdAIXM51XPathFactory
A factory for XPath
objects that are applicable to AIXM 5.1
domain objects like TLcdAIXM51AbstractAIXMFeature
and
TLcdAIXM51AbstractAIXMTimeslice
.
XPath requires namespaces to be used in the expressions. The namespaces that
can be used in expressions for this factory are listed below. XPath
expressions containing elements that belong to other namespaces, or that do
not use the correct prefixes as specified below, will not work. If you want
to support other namespaces, it is possible to construct your own
XPathExpression
using the standard Java API.
The following namespaces can be used:
- aixm51: for elements of the AIXM 5.1 namespace,
- gml: for elements of the GML 3.2 namespace,
- message: for elements of the AIXM 5.1 Basic Message namespace,
- event: for elements of the AIXM 5.1 DNOTAM event namespace,
- xlink: for elements of the XLink namespace.
- lcd: for custom functions defined by this factory,
This factory also provides the following custom functions:
- Node lcd:getLinkedObject( Node ) This function returns the object that is linked to the given node. This assumes that the Node contains an XLink and that the XLink has been resolved; it will not try to resolve the XLink itself.
- Node lcd:getLinkedTimeSlice( Node ) This function works the same
as
getLinkedObject
, but it returns a timeslice of the linked feature instead of the feature itself. It uses the time slice provider that is passed in the constructor to retrieve the time slice, or the default time slice provider of the feature in case a time slice provider is not set on this XPath factory. - String lcd:join-string( NodeSet nodes, String separator) This function takes a node set as its first argument and a separator as an optional second argument. It concatenates the string values of the nodes in the node set, and separates them using the separator String. It is actually a replacement for the standard XPath function join-string which is currently not supported by the underlying XPath resolver.
Examples of XPath expressions for referencing properties in an AIXM 5.1 feature object:
- The name of an AirportHeliport:
/aixm51:AirportHeliport/aixm51:timeSlice/aixm51:AirportHeliportTimeSlice/aixm51:name
- The surface composition of a Runway:
/aixm51:Runway/aixm51:timeSlice/aixm51:RunwayTimeSlice/aixm51:surfaceProperties/aixm51:SurfaceCharacteristics/aixm51:composition
- The unit of measure of the length of a Runway:
/aixm51:Runway/aixm51:timeSlice/aixm51:RunwayTimeSlice/aixm51:length/@uom
- The operational status of a Navaid:
/aixm51:Navaid/aixm51:timeSlice/aixm51:NavaidTimeSlice/aixm51:operationalStatus
- The GML identifier of a TaxiwayElement:
/aixm51:TaxiwayElement/gml:identifier
These examples use absolute location paths to refer to a property, starting from the feature element itself. XPath also supports the use of abbreviated relative location paths, to reduce the number of steps in the expression. For example, the example expression to reference the name of an AirportHeliport could be rewritten in the following ways:
//aixm51:timeSlice/aixm51:AirportHeliportTimeSlice/aixm51:name
//aixm51:AirportHeliportTimeSlice/aixm51:name
//aixm51:name
If multiple nodes correspond to an XPath expression, the first occurrence is selected. By using a predicate, a number can be specified to indicate which node is to be selected. For example, if a Navaid has two timeslices, the following expression can be used to reference the interpretation of the second timeslice:
-
/aixm51:Navaid/aixm51:timeSlice[2]/aixm51:NavaidTimeSlice/aixm51:interpretation
- Since:
- 10.0
- See Also:
-
Field Summary
Fields inherited from class javax.xml.xpath.XPathFactory
DEFAULT_OBJECT_MODEL_URI, DEFAULT_PROPERTY_NAME
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdAIXM51XPathFactory
.TLcdAIXM51XPathFactory
(ILcdAIXM51TimeSliceProvider aTimeSliceProvider) Creates a newTLcdAIXM51XPathFactory
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getFeature
(String aName) newXPath()
void
setFeature
(String aName, boolean aValue) Methods inherited from class com.luciad.format.xml.xpath.TLcdXMLXPathFactory
getXPathFunctionResolver, getXPathVariableResolver, isObjectModelSupported, setXPathFunctionResolver, setXPathVariableResolver
Methods inherited from class javax.xml.xpath.XPathFactory
getProperty, newDefaultInstance, newInstance, newInstance, newInstance, setProperty
-
Constructor Details
-
TLcdAIXM51XPathFactory
public TLcdAIXM51XPathFactory()Creates a newTLcdAIXM51XPathFactory
. -
TLcdAIXM51XPathFactory
Creates a newTLcdAIXM51XPathFactory
.- Parameters:
aTimeSliceProvider
- The time slice provider that will be used when retrieving time slices of linked features. The default time slice provider of the AIXM 5.1 feature will be used if this parameter is null.- See Also:
-
-
Method Details
-
getFeature
- Overrides:
getFeature
in classTLcdXMLXPathFactory
- Throws:
XPathFactoryConfigurationException
-
setFeature
- Overrides:
setFeature
in classTLcdXMLXPathFactory
- Throws:
XPathFactoryConfigurationException
-
newXPath
- Overrides:
newXPath
in classTLcdXMLXPathFactory
-