Hi there,
At the moment it seems impossible to create a path at a specific
position within a group of siblings. I am using JXPath with a DOM
Document which is great apart from I need to create paths at specific
locations. I started with a generic DOMNodeFactory that extends
AbstractFactory and that was all great, but I have now had to make it
aware of specific documents/elements so that I can create siblings at
the correct position, unfortunately it is no longer clean and generic.
I think the functionality to create a path at a specific position
within a group of siblings is important and would like to offer my
services to implement such a thing, I am a proficient Java programmer
and have a good user knowledge of JXPath, but I would need some
guidance on the best way of achieving this.
Imagine a document something like, where all elements are mandatory
apart from AddressLine2 and AddressLine3 -
<Address>
<AddressLine1/>
<AddressLine2/>
<AddressLine3/>
<Town/>
<Postcode/>
</Address
I have two possible high level ideas -
(1)
JXPathContext ctx = JXPathContext.newContext(doc);
ctx.createPath("/Address/AddressLine2[local-name(following-sibling::node())
= 'Town'])
ctx.createPath("/Address/AddressLine3[local-name(following-sibling::node())
= 'AddressLine2'])
(2)
JXPathContext ctx = JXPathContext.newContext(doc);
ctx.createPath("/Address/AddressLine2", 2)
ctx.createPath("/Address/AddressLine3", 3)
Any suggestions, encouragement, discouragement or guidance is
appreciated please :-)
--
Adam Retter
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]