We quickly give an overview of pattern syntax and
semantic.
String
"a string" (1)
CDATA (2)
- only matches strings like "a string"
- matches any string.
Sequence
(* empty *) (1)
_ (2)
_? (1+2)
_+ (3)
_* (4)
- matches empty term
- matches a tag or a string
- matches a sequence of tag or string (could be empty)
- matches a sequence of tag or string (at least one)
Tag content
<_> </> (1)
<_> _+ </> (2)
<_> _* </> (1+2)
- matches any tag with an empty content
- matches any tag with a non empty content
Tag name without namespace
<A> </> (1)
<(A|B)> </> (2a)
(<A> </>|<B> </>) (2b)
- matches tag named A
- matches tag named A or B
Tag name with namespace
<_:A> </> (1)
<N:(A|B)> </> (2a)
(<N:A> </>|<N:B> </>) (2b)
<(N|M):(A|B) </> (3)
- matches tag named A in any namespace same as <A> </>
- matches tag named A or B in a namespace N
- matches tag named A or B in a namespace N or M
Tag attribute
<_ att=CDATA> </> (1)
<_ att=CDATA?> </> (2)
<_ N:att=CDATA> </> (3)
<_ _="v1"> </> (4)
<_ N:_="v1"> </> (5)
<_ _:att="v1"> </> (6)
- matches any tag with a valued attribute att
- matches any tag with may be a valued attribute att
- matches any tag with a valued attribute att in a namespace N
- matches a tag with an attribute with a value "v1"
- matches a tag with an attribute in a namespace N with a value "v1"
- same as (2)
Binding fragment
_ as h (1)
_ as head _* as tail (2)
_* as liat _ as deah (3)
<_ as tn> </> (4)
<_ as ns:_ as tn> </> (5)
<_ attributes> </> (6)
- h has the same value as t
- t = head tail with t a non empty sequence
- t = liat deah with t a non empty sequence and deah is the last element
- tn is binded with the tag name (no namespace)
- ns is binded with the namespace and tn is binded with the tag name
- attributes is binded with all attributes in the matched tag