Re: xpath question

2008-12-09 Thread Dave Brosius
While there are an infinite number of xpaths that represent any arbitrary node, one can be built by walking up the tree, at each level appending nodename[x] where x is the index of the child among it's same-named siblings. - Original Message - From: "Shah Asrani" <[EMAIL PROTECTED]>

Re: Filtering whitespace outside of xml elements using LSParserFilter

2008-12-09 Thread Michael Glavassevich
Hi Rob, Whitespace outside an element is inside of another one (except for whitespace outside of the root element). Whether this whitespace is "ignorable" depends on your application and/or whether you have a grammar which declares that the content of an element is only other elements. The "incl

Re: How to compare Documents? Existing library/method available? or use DOMTreeWalker?

2008-12-09 Thread Jacob Kjome
Have you tried using normalizeDocument() with validation enabled (assuming you have a DTD and/or Schema).  It is supposed to consolidate adjacent text nodes into a single node http://www.w3.org/TR/2003/CR-DOM-Level-3-Core-20031107/core.html#Document3-normalizeDocument http://www.ibm.com/devel

Re: xpath question

2008-12-09 Thread Michael Glavassevich
There's no method in the API that returns an XPath, if that's what you're asking. You would need to construct it yourself by walking the tree. Should be fairly simple. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Shah Asrani" <[E

xpath question

2008-12-09 Thread Shah Asrani
If I have a DOM tree available, is it possible to return the xpath string required for selected node. Shah Asrani - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to compare Documents? Existing library/method available? or use DOMTreeWalker?

2008-12-09 Thread Rob Davis-5
Rob Davis-5 wrote: > > This works. Thank you Michael! > Actually it partially works - it doesn't ignore whitespace outside of elements - which is what I require. I have started a new thread. http://www.nabble.com/Filtering-whitespace-outside-of-xml-elements-using-LSParserFilter-td20918689.html

Filtering whitespace outside of xml elements using LSParserFilter

2008-12-09 Thread Rob Davis-5
I want to be able to filter any whitespace or carriage return types outside of xml elements. I need this to be able to successfully use W3C DOM method Node.isEqualNode() to compare the elements and attributes of Documents with identical elements and attributes but which have differing amounts of

Re: api to generate sample xml

2008-12-09 Thread Shah Asrani
Hi Jacob and Michael, Thanks for quick responses. I will look into both the links provided. The exact scenario for my application is not fully known yet. The idea is to map elements in a schema file to some java objects. and when java objects are initiallized, there is a need to convert the java

Re: How to compare Documents? Existing library/method available? or use DOMTreeWalker?

2008-12-09 Thread Michael Glavassevich
Right. Can only count on what is in the DOM specification. Java-isms like equals(), hashCode() and toString() aren't defined and may behave differently in each implementation. You cannot rely on them. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EM

Re: How to compare Documents? Existing library/method available? or use DOMTreeWalker?

2008-12-09 Thread Rob Davis-5
Thank you Andy. I have used Michael's solution. However the link you posted is interesting: that could be useful for other things! Andy Stevens-2 wrote: > > 2008/12/5 Rob Davis-5 <[EMAIL PROTECTED]>: >> >> I want to compare two Document objects. >> >> That is compare their contents to see if t

Re: How to compare Documents? Existing library/method available? or use DOMTreeWalker?

2008-12-09 Thread Rob Davis-5
This works. Thank you Michael! Sorry I missed it. I was looking for an overridden equals() method but I guess the naming has to comply with the language-independent W3C specification. If interested, what I'm doing is polling for a smallish XML file (2KB) being changed on a Windows file system. D