[Dev] Interface Up/Down

Brett Wooldridge bwooldridge at alterpoint.com
Sun May 18 06:07:58 CDT 2008


Unfortunately, XPath 1.0 does not have a reverse function (at least not for NodeList).  We could do it easily with XPath 2.0, but these are run on the client-side and there is no XPath 2.0 implementation for Flex (and only one for Java).  I expect it will be  year or more before there is XPath 2.0 support for Flex.  XPath 2.0 is extremely complex to implement, which probably accounts for the single implementation in Java compared to half a dozen or so for XPath 1.0.

One "possibe solution" would be to have the client call "some provider" on the server to resolve XPath 2.0 expressions.  But is so gross it's like being in a porta-potty when someone turns it over.  In fact, I never said it and you never heard it.  Let us never speak of it again.  Next.

-Brett

On 5/18/08 4:37 PM, "Leo Bayer" <lbayer at alterpoint.com> wrote:

Couldn't you try something like...

xpath=reverse(/ZiptieElementDocument//interface//adminStatus/text()|/ZiptieElementDocument//interface//name/text())

There are a lot of crazy xpath functions to do almost anything.

 - Leo


On May 17, 2008, at 11:45 PM, Brett Wooldridge wrote:

Ryan,

 I "fixed" (read "broke") your interface up/down tool.  It now uses a new 'grid' input contributor which uses XPath to populate the grid with both the current up/down status of the interface as well as the interface name in a grid.  Probably broke in this case, because the input generated by the grid tool is a CSV for each selected item in the grid (I'm trying not to get too tricky by allowing specific column input determination).

 So in the case of the 'old' list input it was using, if there was a list like so:

 loopback0
 loopback1
 fastethernet0

 Your tool might get:

 "loopback0","fastethernet0"

 as it's input.  In the case of the new grid control the grid contains something like

 up    loopback0
 down  loopback1
 up    fastethernet0

In which case, your tool input will be a properly escaped CSV like so:

 "up,loopback0","down,fastethernet0"

 Obviously, your tool can choose to ignore the current up/down status reflected in the input, but will have to deal with it enough to know to ignore it.

 If you play around with it you'll note that there is no way using XPath with our document structure to generate a grid like so:

 loopback0     up
 loopback1     down
 fastethernet0 up

This is because of our decision to use 'tags' rather than 'attributes' on nodes like interface.  If they were attributes we could chose the selection order, but as nodes the result will always be in "document order" and because "adminStatus" occurs before "name" in the document it will always be emitted first by XPath.  Cest la vie.

 Anyway, sorry for breaking your tool.  It was for the greater good of mankind.

 -Brett

  <ATT00001.txt>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ziptie.org/pipermail/dev/attachments/20080518/eefce859/attachment.html 


More information about the Dev mailing list