cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 13216] New: - XMLFormTransformer violations tags don't match using canonical paths
Date Wed, 02 Oct 2002 16:58:41 GMT
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=13216>.
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=13216

XMLFormTransformer violations tags don't match using canonical paths

           Summary: XMLFormTransformer violations tags don't match using
                    canonical paths
           Product: Cocoon 2
           Version: Current CVS
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: general components
        AssignedTo: cocoon-dev@xml.apache.org
        ReportedBy: jsnyder@coremetrics.com


If a complex data structure is used (e.g. HashMap) as part of the form data 
model, the violation JXPath to the offending elements will not match because 
XMLFormTransformer uses the reference path instead of the canonical path to 
compare (and violations report using canonical paths).

Fixes for the startElementViolations() are below:

      else
      {
        Entry entry = (Entry) refStack.peek ();
        String currentRef = (String) entry.getValue ();
        Violation v = new Violation();
// Need to support getCanonicalPath on Form
        String canonicalPath = form.getCanonicalPath(currentRef);
        v.setPath( canonicalPath );
        Collection restViolations = violations.tailSet ( v );
        Iterator rviter = restViolations.iterator ();
        while ( rviter.hasNext () )
        {
          Violation nextViolation = (Violation) rviter.next ();
          // we're only interested in violations
          // with matching reference
// don't use currentRef rather use canonical path
          if ( !canonicalPath.equals (nextViolation.getPath () ) ) break;

          // render <violation> tag
          super.startElement(uri, TAG_VIOLATION, NS_PREFIX + ":" + 
TAG_VIOLATION, attributes );
          // set message
          String vm = nextViolation.getMessage();
          super.characters( vm.toCharArray(), 0, vm.length());
          super.endElement(uri, TAG_VIOLATION, NS_PREFIX + ":" + TAG_VIOLATION);
        }

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


Mime
View raw message