.net - Xml: best practice to create x-path with parameters -
what best practice create x-path parameters?
i have select xml node attribute has exact value, like:
xmlnode node = parentnode.selectsinglenode( string.format("./field1/field2[@attributename='{0}']", valuerequired));
the host of xpath engine can create variables part of context. example of host, providing facility xslt.
in xslt 1 write:
field1/field2[@attributename=$valuerequired]"
one way of creating xpath variables , functions in .net use xsltcontext
class , methods resolvevariable()
, resolvefunction()
another thing remember: never blindly insert user input "skeleton" of xpath expression. aware of possibility xpath injection.
Comments
Post a Comment