[ https://issues.apache.org/jira/browse/XERCESJ-37?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Elliotte Rusty Harold resolved XERCESJ-37. ------------------------------------------ Resolution: Fixed seems to have been fixed long ago > setIgnoringComments does not seem to work > ----------------------------------------- > > Key: XERCESJ-37 > URL: https://issues.apache.org/jira/browse/XERCESJ-37 > Project: Xerces2-J > Issue Type: Bug > Components: JAXP (javax.xml.parsers) > Affects Versions: 2.0.0 [beta 2] > Environment: Operating System: All > Platform: All > Reporter: Brent Boyer > > The setIgnoringComments method of DocumentBuilderFactory does not seem to > work! > First, it is a little unclear exactly what this method is supposed to do. > The > skimpy javadocs simply state: > "Specifies that the parser produced by this code will ignore comments" > Well, what does "ignore comments" PRECISELY mean? > I ASSUME that it means that whenever the parser hits a comment in the xml > document, it will ignore it as if it were never in the document. > Consider this document fragment: > <someElement> > blah blah blah > <!-- comment, should be ignored --> > more blahs > </someElement> > If my interpretation of "ignoring comments" is correct, then the > <someElement> > tag should have precisely 1 child Node, a Text node to be specific. > If you adopt a slightly looser interpretation of "ignore comments", then > maybe > the parser might initially produce 2 child Text Nodes for <someElement>. In > this case, if you call on someElement's normalize method when working with > the > DOM view of the document, it should coalesce the 2 child Text nodes into 1. > In reality, I see neither of the above behaviors. Instead, all 3 child Nodes > of > the original document are present in the DOM view (a Text Node, then Comment > Node, then the final Text Node). Here, I am using the default parser (i.e. > Xerces 2.0.0 beta 2). > I assume that the above behavior is a bug. > Regardless of whether or not it is a bug, the javadocs for the method need > considerable more fleshing out. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org For additional commands, e-mail: j-dev-h...@xerces.apache.org