Xscan
Processes streaming XML data based on input path expressions and returns a relation consisting of attribute-value bindings.
Usage
xscan (paths, xmldata : bindings)
Details
Returns all attribute-value bindings found in an XML data stream. Attributes are derived from paths, both relative and absolute, passed as input to the operator. Output attribute names are extracted from the attribute name of its corresponding paths expression.
Notes
- Paths is a relation where each tuple consists of a path expression, either relative or absolute.
- XMLdata must be a valid XML document passed in through a relation made up of one tuple consisting of one column.
Known Bugs
Example
Using the input:
RELATION x: path char
//lab/name
//location
RELATION y: xml char
<db>
<lab ID="baselab" manager="smith1">
<name>Seattle Bio Lab</name>
<location>
<city>Seattle</city>
<country>USA</country>
</location>
</lab>
<lab ID="lab2">
<name>PMBL</name>
<city>Philadelphia</city>
<country>USA</country>
</lab>
<paper ID="Smith991231" source="baselab" biologist="smith1">
<title>Autocatalysis of Spectral...</title>
</paper>
<biologist ID="smith1">
<lastname>Smith</lastname>
</biologist>
</db>
when executing the plan:
PLAN c
{
INPUT: stream x,stream y
OUTPUT: stream z
BODY
{
xscan(x,y:z)
}
}
will generate the following output:
----------------------------------------------
RELATION: scan_z
attrs: name, location
----------------------------------------------
Seattle Bio Lab|<city>Seattle</city><country>USA</country>
PMBL|
----------------------------------------------