[jdom-interest] Attribute not being set to true?
philip.nelson at omniresources.com
philip.nelson at omniresources.com
Tue Mar 27 10:46:41 PST 2001
>
> Hi, I have figured out how to set attributes. At least I think I have.
>
> If my xml file is as follows:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <WorkRequest>
> <Property Required="false">Entity</Property>
> <Property Required="false">Priority</Property>
> <Property Required="false">Work Type</Property>
>
> then the following should set the Property with a text value
> of Priority to
> true:
>
> List properties=doc.getRootElement().getChildren("Property");
> Iterator iter=properties.iterator();
> List newValues=new Vector();
>
> while(iter.hasNext())
> {
> childElement=(Element)iter.next();
what you want here is
childElement.getAttribute("Required").setValue("true");
without testing anyway ;^)
More information about the jdom-interest
mailing list