Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 22173 invoked from network); 3 Mar 2005 22:27:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 3 Mar 2005 22:27:20 -0000 Received: (qmail 28645 invoked by uid 500); 3 Mar 2005 22:27:19 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 28135 invoked by uid 500); 3 Mar 2005 22:27:17 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 28121 invoked by uid 500); 3 Mar 2005 22:27:17 -0000 Received: (qmail 28117 invoked by uid 99); 3 Mar 2005 22:27:17 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 03 Mar 2005 14:27:16 -0800 Received: (qmail 22133 invoked by uid 65534); 3 Mar 2005 22:27:14 -0000 Message-ID: <20050303222714.22132.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Thu, 03 Mar 2005 22:27:14 -0000 Subject: svn commit: r156094 - in jakarta/commons/proper/betwixt/trunk/src: java/org/apache/commons/betwixt/digester/AttributeRule.java test/org/apache/commons/betwixt/SimpleClass.betwixt test/org/apache/commons/betwixt/SimpleClass.java test/org/apache/commons/betwixt/TestAttributeQNameProblem.java To: commons-cvs@jakarta.apache.org From: rdonkin@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: rdonkin Date: Thu Mar 3 14:27:12 2005 New Revision: 156094 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D156094 Log: Fixed bug in local names when using dot bwetwixt files. Issue 14377. Test c= ases contributed by Christoph Gaffga. Added: jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwix= t/SimpleClass.betwixt jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwix= t/SimpleClass.java jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwix= t/TestAttributeQNameProblem.java Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwix= t/digester/AttributeRule.java Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/= betwixt/digester/AttributeRule.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src= /java/org/apache/commons/betwixt/digester/AttributeRule.java?view=3Ddiff&r1= =3D156093&r2=3D156094 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwix= t/digester/AttributeRule.java (original) +++ jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwix= t/digester/AttributeRule.java Thu Mar 3 14:27:12 2005 @@ -198,7 +198,7 @@ attributeDescriptor.setUpdater( new MethodUpdater( writeMethod= ) ); } =20 - attributeDescriptor.setLocalName( propertyDescriptor.getName() ); + attributeDescriptor.setPropertyName( propertyDescriptor.getName() = ); attributeDescriptor.setPropertyType( type ); =20 =20 // XXX: associate more bean information with the descriptor? Added: jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/bet= wixt/SimpleClass.betwixt URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src= /test/org/apache/commons/betwixt/SimpleClass.betwixt?view=3Dauto&rev=3D1560= 94 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwix= t/SimpleClass.betwixt (added) +++ jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwix= t/SimpleClass.betwixt Thu Mar 3 14:27:12 2005 @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file Added: jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/bet= wixt/SimpleClass.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src= /test/org/apache/commons/betwixt/SimpleClass.java?view=3Dauto&rev=3D156094 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwix= t/SimpleClass.java (added) +++ jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwix= t/SimpleClass.java Thu Mar 3 14:27:12 2005 @@ -0,0 +1,39 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */=20 +package org.apache.commons.betwixt; + +public class SimpleClass { + + private String testPropertyOne =3D "abc"; + + private Integer testPropertyTwo =3D new Integer(12); + + public String getTestPropertyOne() { + return this.testPropertyOne; + } + + public void setTestPropertyOne(String testPropertyOne) { + this.testPropertyOne =3D testPropertyOne; + } + + public Integer getTestPropertyTwo() { + return this.testPropertyTwo; + } + + public void setTestPropertyTwo(Integer testPropertyTwo) { + this.testPropertyTwo =3D testPropertyTwo; + } +} \ No newline at end of file Added: jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/bet= wixt/TestAttributeQNameProblem.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src= /test/org/apache/commons/betwixt/TestAttributeQNameProblem.java?view=3Dauto= &rev=3D156094 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwix= t/TestAttributeQNameProblem.java (added) +++ jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwix= t/TestAttributeQNameProblem.java Thu Mar 3 14:27:12 2005 @@ -0,0 +1,118 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */=20 +package org.apache.commons.betwixt; + +import org.apache.commons.betwixt.io.SAXBeanWriter; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; + +/** + * I would SAX 'start element' event's attributes always expect to have qN= ame + * equal to localName for simple, unprefixed XML tags. But that seems not = to be + * true for betwixt output and breaks my application completely.
+ * For the debugging output to STDOUT I would expect output like: + *=20 + *
+ *   XML: start document event
+ *   XML: start element qName 'test-class', localName 'test-class', URI:
+ *        - Attribute qName 'test-prop-1', localName 'test-prop-1' of CDAT=
A: abc
+ *        - Attribute qName 'test-prop-2', localName 'test-prop-2' of CDAT=
A: 12
+ *        - Attribute qName 'id', localName 'id' of ID: 1
+ *   XML: end element 'test-class'
+ *   XML: end document event
+ * 
+ *=20 + * but I get (the attributes local names differ from the qnames): + *=20 + *
+ *   XML: start document event
+ *   XML: start element qName 'test-class', localName 'test-class', URI:
+ *        - Attribute qName 'test-prop-1', localName 'testPropertyOne' of =
CDATA: abc
+ * 
+ *=20 + * got only the first two lines here beacuase assertEquals fails there. + *=20 + * @author Christoph Gaffga, cgaffga@triplemind.com + */ +public class TestAttributeQNameProblem extends AbstractTestCase { + + public TestAttributeQNameProblem(String testName) { + super(testName); + } + + public static class StdOutContentHandler implements ContentHandler { + + public void setDocumentLocator(Locator locator) {} + + public void startDocument() throws SAXException { + System.out.println("XML: start document event"); + } + + public void endDocument() throws SAXException { + System.out.println("XML: end document event"); + } + + public void startPrefixMapping(String prefix, String uri) throws S= AXException { + System.out.println("XML: start prefix '" + prefix + "' mapping,= URI: " + uri); + } + + public void endPrefixMapping(String prefix) throws SAXException { + System.out.println("XML: end prefix '" + prefix + "' mapping"); + } + + public void startElement(String uri, String localName, String qNam= e, Attributes atts) + throws SAXException { + System.out.println("XML: start element qName '" + qName + "', = localName '" + localName + + "', URI:" + uri); + for (int i =3D 0; i < atts.getLength(); i++) { + System.out.println(" - Attribute qName '" + atts.getQN= ame(i) + "', localName '" + + atts.getLocalName(i) + "' of " + atts.getType(i)= + ": " + + atts.getValue(i)); + assertEquals(atts.getQName(i), atts.getLocalName(i)); + } + } + + public void endElement(String uri, String localName, String qName)= throws SAXException { + System.out.println("XML: end element '" + qName + "'"); + } + + public void characters(char[] ch, int start, int length) throws SA= XException { + System.out.println("XML: characters: from " + start + ", lengt= h " + length); + } + + public void ignorableWhitespace(char[] ch, int start, int length) = throws SAXException {} + + public void processingInstruction(String target, String data) thro= ws SAXException { + System.out.println("XML: processing instruction, target '" + t= arget + "': " + data); + } + + public void skippedEntity(String name) throws SAXException {} + + } + + public void testAttributeOutput() { + try { + SAXBeanWriter beanWriter =3D new SAXBeanWriter(new StdOutConte= ntHandler()); + Object bean =3D new SimpleClass(); + beanWriter.write(bean); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org