commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34613] - [digester] Need to process [attribute id="name"]somename[/attribute]
Date Wed, 01 Jun 2005 06:25:02 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34613>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34613





------- Additional Comments From markchristopherng@yahoo.com  2005-06-01 08:25 -------
Created an attachment (id=15239)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=15239&action=view)
adds simple attribute matching

I changed the following classes in the commons-digestor 1.6 so it can match
based on the attribute value

Modified  
RuleBase.add()
Digestor.startElement()

Added
Rule.attributeXpath 
Rule.getAttributeXpath()
Rule.setAttributeXpath()
Digestor.filterRulesByValidAttributeMatch()
Digestor.useAttributeRule()
Digestor.rebuildNode()

For the following exmple.

<people>
	<person>
		<location type="home">
			<postcode>3190<postcode>		
		</id>
	</person>
</people>

<digester-rules>
	<pattern value="people/person">
		<object-create-rule classname="com.Person" />
		<pattern value="location[@type='home']">	
			<call-method-rule pattern="postcode"
methodname="setPostcode" paramcount="0"/>
		</pattern>		
		<set-next-rule methodname="add" paramtype="java.lang.Object" />

	</pattern>
</digester-rules>


The person.postcode value will be 3190 as the xpath e.g.
people/person/location[@type='home'] /postcode matches the rules.

If the sample input was as follows then the person.postcode value would not be
set.


<people>
	<person>
		<location type="work">
			<postcode>3190<postcode>		
		</id>
	</person>
</people>


The modification to code is limited to defining one [@XXX] per xpath. Also i do
not pop all the of the attributes off the stack, only the ones i need. Is there
a better way to do this? 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message