xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Writing to XML through XOM APIs
- From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- To: Ravi Nathwani <ravinathwani AT yahoo.com>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Writing to XML through XOM APIs
- Date: Fri, 23 Jan 2004 09:54:49 -0500
At 3:45 AM -0800 1/23/04, Ravi Nathwani wrote:
The nu.xom APIs for the ëElementí class does have a
getValue() method, but it does not have a setValue()
method.
That's because the value does not have a unique representation in XML. In other words, any given child element has exactly one value, but there are many different child elements with that one value. For instance, consider the value "Hello Ravi". This could be
<child>Hello Ravi</child>
<child>Hello <name>Ravi</name></child>
<child><word>Hello</word> <word>Ravi</word></child>
<child><message><word>Hello</word> <word>Ravi</word></message></child>
Therefore you have to be more explicit about what you want to put in the element rather than just providing the value. The value is a computed property, not a fundamental one.
If you're starting with an empty element and you only want to put text in it, you just need to say child.appendChild("Hello Ravi"). If the element is not empty you may need to remove some content first.
--
Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
-
[XOM-interest] Writing to XML through XOM APIs,
Ravi Nathwani, 01/23/2004
- <Possible follow-up(s)>
-
[XOM-interest] Writing to XML through XOM APIs,
Ravi Nathwani, 01/23/2004
- Re: [XOM-interest] Writing to XML through XOM APIs, Elliotte Rusty Harold, 01/23/2004
Archive powered by MHonArc 2.6.24.