<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2523" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=148071819-28072005><FONT face=Arial
color=#0000ff size=2>No. Think of XPATH expressions as having read only access
to your XML data. They cannot effect the contents of the XML data. That's what
XSLT is for. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=148071819-28072005></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> jdom-interest-bounces@jdom.org
[mailto:jdom-interest-bounces@jdom.org] <B>On Behalf Of </B>Dmitriy
Viner<BR><B>Sent:</B> Thursday, July 28, 2005 2:38 PM<BR><B>To:</B>
jdom-interest@jdom.org<BR><B>Subject:</B> [jdom-interest] Adding attributes with
XPath<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Is it possible to add attributes with xpath
expression?<BR><BR><B><I>jdom-interest-request@jdom.org</I></B> wrote:
<BLOCKQUOTE class=replbq
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Send
jdom-interest mailing list submissions to<BR>jdom-interest@jdom.org<BR><BR>To
subscribe or unsubscribe via the World Wide Web,
visit<BR>http://www.jdom.org/mailman/listinfo/jdom-interest<BR>or, via email,
send a message with subject or body 'help'
to<BR>jdom-interest-request@jdom.org<BR><BR>You can reach the person managing
the list at<BR>jdom-interest-owner@jdom.org<BR><BR>When replying, please edit
your Subject line so it is more specific<BR>than "Re: Contents of
jdom-interest digest..."<BR><BR><BR>Today's Topics:<BR><BR>1. making
XMLOutputter DTD-aware (Paul Libbrecht)<BR>2. XMLOutputter generates weird
chars (Ivo
J?nsk?)<BR><BR><BR>----------------------------------------------------------------------<BR><BR>Message:
1<BR>Date: Tue, 26 Jul 2005 17:05:40 +0200<BR>From: Paul Libbrecht
<PAUL@ACTIVEMATH.ORG><BR>Subject: [jdom-interest] making XMLOutputter
DTD-aware<BR>To: jdom-interest@jdom.org<BR>Message-ID:
<A06F447C380969E573D1F75D2421B910@ACTIVEMATH.ORG><BR>Content-Type: text/plain;
charset=US-ASCII; format=flowed<BR><BR><BR>hello list,<BR><BR>I gave some
cycles into making XMLOutputter DTD-aware.<BR>The reason for doing so is that
we write XML-files with a dtd-reference <BR>with a large set of hidden
information encoded in the DTD such as <BR>namespace for almost all elements.
Most of these are attribute default <BR>values.<BR>Only using such an
outputter I can claim that our authors' files are <BR>not changed too
dramatically. Otherwise, each line is made twice as big <BR>and completely
unreadable.<BR><BR>Clearly using a finer-grained parsing (that would report
wether an <BR>attribute is present or only "implied") would bring it all...
but such <BR>fine-grained lexical analysis isn't available as far as I
know.<BR><BR>So I just adapted XMLOutputter to prevent the output of
attributes of <BR>namespaces if equivalent to the DTD-specified values...
seems to be <BR>working fine.<BR><BR>I'd love providing this to the project.
It is relying on Mark Wutka's <BR>DTD parser, now with an
Apache-style-license, which is the only usable <BR>DTD-parser I
found.<BR>Where could I drop such a submission ?<BR><BR>Also I would have
wished to subclass XMLOutputter but this turned out <BR>to be impossible...
there are too many private methods that needed to <BR>be either re-used or
overridden... not sure if that's solvable. <BR>Currently, I just added
"setDtd" and modified XMLOuputter's methods
<BR>directly.<BR><BR>paul<BR><BR><BR><BR>------------------------------<BR><BR>Message:
2<BR>Date: Tue, 26 Jul 2005 18:48:31 +0200<BR>From: Ivo J?nsk?
<LINUX4LIFE@SEZNAM.CZ><BR>Subject: [jdom-interest] XMLOutputter generates
weird chars<BR>To: jdom-interest@jdom.org<BR>Message-ID:
<200507261848.32113.linux4life@seznam.cz><BR>Content-Type: text/plain;
charset="us-ascii"<BR><BR>Hi,<BR><BR>when I run the following
code:<BR><BR>//in ! the xml variable (java.lang.String) is the actual XML
code<BR><BR>SAXBuilder builder = new
SAXBuilder("org.apache.xerces.parsers.SAXParser", false);<BR>Document document
= builder.build(new ByteArrayInputStream(xml.toBytes()));<BR><BR>Format format
= Format.getPrettyFormat();<BR>XMLOutputter fmt = new
XMLOutputter(format);<BR>xml =
fmt.outputString(document);<BR>System.out.println(xml);<BR><BR>I see this in
the console:<BR><BR><CXML payloadID="9949494-196@ariba.com"
timestamp="2000-02-04T18:39:49-08:00" version="1.2.013"
xml:lang="en-US"><BR><RESPONSE><BR><STATUS code="200" text="OK"
/><BR><PROFILERESPONSE effectiveDate="2000-01-01T05:24:29-08:00"
a-dtype="effectiveDate dateTime.tz lastRefresh dateTime.tz"><BR><TRANSACTION
a-dtype="requestName NMTOKEN"
requestName="OrderRequest"><BR><URL>http://service.ariba.com/cgi/orders.cgi</URL><BR></TRANSACTION><BR><TRANSACTION
a-dtype="requestName NMTOKEN"
requestName="PunchOutSetupRequest"><BR><URL>http://service.ariba.com/cgi/PunchOut.cgi</URL><BR></TRANSACTION><BR></PROFILERESPONSE><BR></RESPONSE><BR></CXML><BR><BR>but
I should see this:<BR><BR><CXML payloadID="9949494-196@ariba.com"
timestamp="2000-02-04T18:39:49-08:00" version="1.2.013"
xml:lang="en-US"><BR><RESPONSE><BR><STATUS code="200" text="OK"
/><BR><PROFILERESPONSE
effectiveDate="2000-01-01T05:24:29-08:00"><BR><TRANSACTION
requestName="OrderRequest"><BR><URL>http://service.ariba.com/cgi/orders.cgi</URL><BR></TRANSACTION><BR><TRANSACTION
requestName="PunchOutSetupRequest"><BR><URL>http://service.ariba.com/cgi/PunchOut.cgi</URL><BR></TRANSACTION><BR></PROFILERESPONSE><BR></RESPONSE><BR></CXML><BR><BR>the
difference?<BR>a-dtype=... should not be there<BR><BR>I just can't figure out
what is wrong. Any
ideas?<BR><BR><BR>------------------------------<BR><BR>_______________________________________________<BR>To
control your jdom-interest
membership:<BR>http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com<BR><BR>End
of jdom-interest Digest, Vol 12, Issue
10<BR>*********************************************<BR></BLOCKQUOTE></DIV><BR><BR>
<P>Sincerely Dmitriy Viner</P>
<P>E-Mail: <A href="mailto:dxv7027@yahoo.com">dxv7027@yahoo.com</A></P>
<P>Cell Phone: 716-415-3096</P>
<P>__________________________________________________<BR>Do You Yahoo!?<BR>Tired
of spam? Yahoo! Mail has the best spam protection around
<BR>http://mail.yahoo.com </P></BODY></HTML>