|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
NamespacesHi,
I really like everything I have seen so far from juxy. I still have one thing to ask: Is there a way to set namespaces for xpath expressions? After a call to applyTemplates, the result is something like this. <out:root xmlns:out="http://my-cool.namespace.com/path/to/wherever"> <element> <child attr="val">123</child> </element> </out:root> An I want to check the value of root/element/child[@attr='val'] in a namespace-aware way, but I could not see any way to register a namespace on XPathExpr nor XPathAssert, nor the test case. Something like xpath.registerNamespace("out", "http://my-cool.namespace.com/path/to/wherever"); xpathAssert("out:root/out:element/out:child/text()", "123").eval(resultNode); To navigate to a node would be great Thanks for your help, Kariem --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: NamespacesHello Kariem,
Currently XPathAssert does not allow you to register namespaces. I will extend API to support this feature in the next version. Now you can do the following (I expect you extended your TestCase from JuxyTestCase): assertEquals("123", xpath("out:root/out:element/out:child/text()") .addNamespace("out", "http://my-cool.namespace.com/path/to/wherever") .toString(resultNode)); -- Pavel Sher Software Developer JetBrains, Inc. http://www.jetbrains.com "Develop with pleasure!" > I really like everything I have seen so far from juxy. > I still have one thing to ask: Is there a way to set namespaces for > xpath expressions? After a call to applyTemplates, the result is > something like this. > <out:root xmlns:out="http://my-cool.namespace.com/path/to/wherever"> > <element> > <child attr="val">123</child> > </element> > </out:root> > An I want to check the value of > root/element/child[@attr='val'] > in a namespace-aware way, but I could not see any way to register a > namespace on XPathExpr nor XPathAssert, nor the test case. > Something like > xpath.registerNamespace("out", > "http://my-cool.namespace.com/path/to/wherever"); > xpathAssert("out:root/out:element/out:child/text()", "123").eval(resultNode); > To navigate to a node would be great > Thanks for your help, > Kariem > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: NamespacesHi Pavel,
Thank you for the quick reply. I did not see this option anywhere, even searching through the source. I should have looked more closely. Thank you, this is just what I need. Kariem On 1/15/07, Pavel Sher <Pavel.Sher@...> wrote: > Hello Kariem, > > Currently XPathAssert does not allow you to register namespaces. I will > extend API to support this feature in the next version. Now you can do > the following (I expect you extended your TestCase from JuxyTestCase): > > assertEquals("123", xpath("out:root/out:element/out:child/text()") > .addNamespace("out", "http://my-cool.namespace.com/path/to/wherever") > .toString(resultNode)); > > -- > Pavel Sher > Software Developer > JetBrains, Inc. > http://www.jetbrains.com > "Develop with pleasure!" > > > > I really like everything I have seen so far from juxy. > > > I still have one thing to ask: Is there a way to set namespaces for > > xpath expressions? After a call to applyTemplates, the result is > > something like this. > > > <out:root xmlns:out="http://my-cool.namespace.com/path/to/wherever"> > > <element> > > <child attr="val">123</child> > > </element> > > </out:root> > > > An I want to check the value of > > > root/element/child[@attr='val'] > > > in a namespace-aware way, but I could not see any way to register a > > namespace on XPathExpr nor XPathAssert, nor the test case. > > > Something like > > > xpath.registerNamespace("out", > > "http://my-cool.namespace.com/path/to/wherever"); > > xpathAssert("out:root/out:element/out:child/text()", "123").eval(resultNode); > > > To navigate to a node would be great > > > Thanks for your help, > > Kariem > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscribe@... > > For additional commands, e-mail: users-help@... > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
| Free Forum Powered by Nabble | Forum Help |