You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2002/02/19 11:40:43 UTC

DO NOT REPLY [Bug 6538] New: - wrong id for property current-element-node

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6538>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6538

wrong id for property current-element-node

           Summary: wrong id for property current-element-node
           Product: Xerces2-J
           Version: 2.0.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: DOM
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: patrick.floissac@realix.fr


Hi,

According to Xerces documentation, id for current-element-node property should 
be : 

      http://apache.org/xml/properties/dom/current-element-node


The following code tries to get the current element, but raises an unexpected 
SAXNotRecognizedException :

if (parser != null) {
  Object o = null;
  try {
    o = parser.getProperty("http://apache.org/xml/properties/dom/current-
element-node");
  } catch (SAXException e) {
    // error handling
  }


Looking at DOMParser.java, we can see that getProperty(String propertyId) first 
check is to compare the propertyId string to CURRENT_ELEMENT_NODE :

  if (propertyId.equals(CURRENT_ELEMENT_NODE)) {
    ...
  }

but CURRENT_ELEMENT_NODE is sadly initialized to an incorrect value in 
AbstractDOMParser.java : 

  protected static final String  CURRENT_ELEMENT_NODE=
        Constants.XERCES_FEATURE_PREFIX + 
        Constants.CURRENT_ELEMENT_NODE_PROPERTY;

(where XERCES_FEATURE_PREFIX should be corrected to XERCES_PROPERTY_PREFIX).


  
Thus, a basic workaround to get a correct behaviour is, in my application, to 
query : 
  o = parser.getProperty(Constants.XERCES_FEATURE_PREFIX + 
Constants.CURRENT_ELEMENT_NODE_PROPERTY);


By the way, why wouldn't you give a public access to the handy constant 
AbstractDOMParser.CURRENT_ELEMENT_NODE (and to its similar brothers) ?

Regards. 

Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org