这里又是Xquery新手。我有以下xml:
<div type="section" n="1">
<p>Lorem ipsum dolor sit amet, <rs type="xyz">consectetur</rs> adipiscing <placeName ref="#PLACE1">elit</placeName>, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
在xml文件中有许多条目,并具有xpath with条件:
/XMLReport/Report/PreflightResult/PreflightResultEntry[
@type = 'Check' and @level = 'warning']/PreflightResultEntryMessage/Message/text()
输出为:
onetwothreefour... and more
我需要分离
'---' one---two---three---four
或
[enter]
one
two
three
four
有可能吗
我想要验证我的字符串,以检查是否有效。如果字符串包含(_,-,alphanumerics) (不包括任何其他特殊字符),则该字符串有效。
我使用的是下面的正则表达式,但是如果字符串的末尾包含#或?,那么它就被认为是有效的,而不是抛出一个无效字符串的错误。
def is_valid_id(id_):
"""Check if id is valid"""
return re.match(r'^[\-a-zA-Z0-9_]+\Z', id_)
如果字符串末尾包含除(_,-)之外的任何特殊字符,我认为该字符串是无效的
嗨,我正在尝试使用xquery将一些xml转换为csv,并找到了以前的一篇文章,它帮助我了解了这一点:
for $b in /root/Result
return
concat(escape-html-uri(string-join(($b/HolidayEndDate,
$b/HolidayType,
$b/FirstName,