使用成员函数这是我的代码:方案
(define p (read(open-input-file "starbucks4.sxml")))
(define get-artifacts
(lambda (l)
(member (list 'opm:artifact) l)))
(get-artifacts p)
我被告知,该成员函数在整个名单完全搜索。 .sxml文档中有一个复杂的列表,其中包含许多称为“opm:artifact”的元素,但此方法返回#f且不包含列表。
任何人都可以看到我做错了什么?
样品.sxml文件:
(opm:account ((ref "detailedAccount")))
"\n "
(opm:label ((value "Provide other Beverage")))
"\n ")
"\n ")
"\n "
(opm:artifacts
()
"\n "
(opm:artifact
((id "a1"))
"\n "
(opm:account ((ref "detailedAccount")))
"\n "
(opm:label ((value "order")))
"\n ")
"\n "
(opm:artifact
((id "a2"))
"\n "
(opm:account ((ref "detailedAccount")))
"\n "
(opm:label ((value "cash")))
"\n ")
"\n "
我试图寻找所有的OPM:文物和相关的数据(它的子表)。
谢谢!我会如何搜索符号opm:神器? – Alex 2010-10-26 19:34:18
@Alex:'(deep-search'opm-artifact p)'注意这只会返回true或false。如果你需要更多,需要修改一下。 – sepp2k 2010-10-26 19:43:08
@Alex:另外请注意,对于示例文件,您显示'p'将只包含'(opm:account((ref'detailedAccount“))),因为'read'只读取一个表单。 – sepp2k 2010-10-26 19:44:34