You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2002/10/02 18:58:41 UTC

DO NOT REPLY [Bug 13216] New: - XMLFormTransformer violations tags don't match using canonical paths

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