[jdom-interest] Adding attributes with XPath

Kevin L. Cobb kevin.cobb at emergint.com
Thu Jul 28 12:19:28 PDT 2005

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. 


From: jdom-interest-bounces at jdom.org
[mailto:jdom-interest-bounces at jdom.org] On Behalf Of Dmitriy Viner
Sent: Thursday, July 28, 2005 2:38 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Adding attributes with XPath

Is it possible to add attributes with xpath expression?

jdom-interest-request at jdom.org wrote: 

	Send jdom-interest mailing list submissions to
	jdom-interest at jdom.org
	To subscribe or unsubscribe via the World Wide Web, visit
	or, via email, send a message with subject or body 'help' to
	jdom-interest-request at jdom.org
	You can reach the person managing the list at
	jdom-interest-owner at jdom.org
	When replying, please edit your Subject line so it is more
	than "Re: Contents of jdom-interest digest..."
	Today's Topics:
	1. making XMLOutputter DTD-aware (Paul Libbrecht)
	2. XMLOutputter generates weird chars (Ivo J?nsk?)
	Message: 1
	Date: Tue, 26 Jul 2005 17:05:40 +0200
	From: Paul Libbrecht 
	Subject: [jdom-interest] making XMLOutputter DTD-aware
	To: jdom-interest at jdom.org
	Content-Type: text/plain; charset=US-ASCII; format=flowed
	hello list,
	I gave some cycles into making XMLOutputter DTD-aware.
	The reason for doing so is that we write XML-files with a
	with a large set of hidden information encoded in the DTD such
	namespace for almost all elements. Most of these are attribute
	Only using such an outputter I can claim that our authors' files
	not changed too dramatically. Otherwise, each line is made twice
as big 
	and completely unreadable.
	Clearly using a finer-grained parsing (that would report wether
	attribute is present or only "implied") would bring it all...
but such 
	fine-grained lexical analysis isn't available as far as I know.
	So I just adapted XMLOutputter to prevent the output of
attributes of 
	namespaces if equivalent to the DTD-specified values... seems to
	working fine.
	I'd love providing this to the project. It is relying on Mark
	DTD parser, now with an Apache-style-license, which is the only
	DTD-parser I found.
	Where could I drop such a submission ?
	Also I would have wished to subclass XMLOutputter but this
turned out 
	to be impossible... there are too many private methods that
needed to 
	be either re-used or overridden... not sure if that's solvable. 
	Currently, I just added "setDtd" and modified XMLOuputter's
	Message: 2
	Date: Tue, 26 Jul 2005 18:48:31 +0200
	From: Ivo J?nsk? 
	Subject: [jdom-interest] XMLOutputter generates weird chars
	To: jdom-interest at jdom.org
	Message-ID: <200507261848.32113.linux4life at seznam.cz>
	Content-Type: text/plain; charset="us-ascii"
	when I run the following code:
	//in ! the xml variable (java.lang.String) is the actual XML
	SAXBuilder builder = new
SAXBuilder("org.apache.xerces.parsers.SAXParser", false);
	Document document = builder.build(new
	Format format = Format.getPrettyFormat();
	XMLOutputter fmt = new XMLOutputter(format);
	xml = fmt.outputString(document);
	I see this in the console:
	but I should see this:
	the difference?
	a-dtype=... should not be there
	I just can't figure out what is wrong. Any ideas?
	To control your jdom-interest membership:
	End of jdom-interest Digest, Vol 12, Issue 10

Sincerely Dmitriy Viner

E-Mail: dxv7027 at yahoo.com

Cell Phone: 716-415-3096

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20050728/cd6f292d/attachment.htm

More information about the jdom-interest mailing list