And I agree with you :-) PropertyWriter appears to produce valid, but
verbose xml, e.g. every element /child node gets an "xmlns=<ns>" attribute -
no use of a default or named namespaces. We've been using this patch since
modifying Slide1.0.16 and haven't had any issues where we couldn't parse the
output back into a DOM tree, but I'm definitely offering it as an
improvement over returning "" rather than a good long-term solution.

BTW: We're definitely interested in keeping the client lib alive and having
the command line client as an example of how to use the lib as well as a
quick debug/admin tool. We may have resources to help migrate it towards the
JSR 170 spec over time. For 2.0, we just have a few bug fixes/additions.

  Jim


----- Original Message ----- 
From: "Ingo Brunberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 08, 2004 10:35 AM
Subject: Re: Handling XML-valued properties in the webdav client


> I agree with you, that it would be much nicer if getPropertyAsString()
> returned a full textual representation of the property. That
> technically means to serialize the child nodes of the property
> element. I just hesitate because I am unsure about the quality of
> PropertyWriter. Usually you would do this with the help of JDOM, dom4j
> or something like that, but these libs are not used by the client. So
> I would prefer to utilize JAXP, but that's a bit ugly.
>
> Ingo
>
> > The following change addresses an issue that was pointed out on the
> > slide users mailer - the command line client returns an empty string for
> > XML valued properties (getPropertyAsString for BaseProperty just calls
> > DOMUtils.getTextValue(element)).
> > Changing the getPropertyAsString method in
> > org.apache.webdav.lib.BaseProperty.java=20
> >
> > From:=20
> >
> >       return DOMUtils.getTextValue(element);=20
> >
> > To:=20
> >
> >        StringWriter sw =3D new StringWriter();=20
> >        PropertyWriter pw =3D new PropertyWriter( sw, false);=20
> >        NodeList children =3D element.getChildNodes();=20
> >        if (children =3D=3D null || children.getLength() =3D=3D 0) {=20
> >            return DOMUtils.getTextValue(element);=20
> >        } else {=20
> >          for (int i =3D 0; i < children.getLength(); i++) {=20
> >            Node child =3D (Node) children.item(i);=20
> >            pw.print(child);=20
> >          }       =20
> >        }=20
> >        return sw.toString();=20
> >
> > will print text or XML values as text. This is primarily useful for the
> > command line client, but it doesn't seem like an unreasonable thing to
> > do within the library itself.=20
> >
> > (getPropertyAsString is really display oriented anyway since the
> > subclasses of BaseProperty override it to pretty print their XML -
> > changing BaseProperty just makes it possible to see XML values of non
> > DAV properties without having to add new classes. )
> >
> >    Jim=20
> >
> >
> > James D. Myers=20
> > Chief Scientist, Scientific Computing Environments Group=20
> > Computational Science and Mathematics Department=20
> > Pacific Northwest National Laboratory=20
> > Phone: 610-355-0994=20
> > Fax:     208-474-4616=20
> > [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to