开发者

Providing parameters to XSLT program using Java API

What I want to do is:

setParameter(String name, String value)

But the API is:

void setParameter(QName na开发者_如何学Pythonme, XdmValue value)

I can't find any example to properly create XdmValue and QName, examples I found are all using different versions of this function/api.


Very often parameters have names that are in no namespace, so you can construct the QName using the constructor new QName("p"). If the parameter value is a string, you can construct the value using new XdmAtomicValue("value"). So your example reduces to

setParameter(new QName(name), new XdmAtomicValue(value))

In designing an API like this, one has to judge carefully how to balance the simplicity that comes from providing "shortcut" methods for common simple cases, versus the complexity that comes from having zillions of methods. So I provided new QName(string), but I didn't provide setParameter(string, string).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜