Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] 0x25?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: Nils_Kilden-Pedersen AT Countrywide.Com, xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] 0x25?
  • Date: Sat, 29 Mar 2003 14:20:03 -0500

At 9:02 AM -0800 3/28/03, Nils_Kilden-Pedersen AT Countrywide.Com wrote:
This code throws the NullPointerException:

InputStreamReader isr = new InputStreamReader(new FileInputStream(filename));
Document doc = new Builder().build(isr);


Probably not related to your problem--well, you know actually maybe it is. You shouldn't be doing that. There's no guarantee that the default encoding for your platform used by the InputStreamReader is in fact the encoding of the document. You should just build the Documenht from the raw InputStream (or a buffered version) and let the parser figure out which encoding the document uses. But this may not be why you're seeing the NullPointerException. I'm still investigating that.
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| Processing XML with Java (Addison-Wesley, 2002) |
| http://www.cafeconleche.org/books/xmljava |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
From elharo AT metalab.unc.edu Sat Mar 29 15:04:08 2003
Return-Path: <elharo AT metalab.unc.edu>
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from mail.speakeasy.net (mail12.speakeasy.net [216.254.0.212])
by happyhouse.metalab.unc.edu (Postfix) with ESMTP id 2398E2002B
for <xom-interest AT lists.ibiblio.org>;
Sat, 29 Mar 2003 15:04:08 -0500 (EST)
Received: (qmail 29202 invoked from network); 29 Mar 2003 20:04:14 -0000
Received: from unknown (HELO [192.168.254.4]) ([216.254.85.72])
(envelope-sender <elharo AT metalab.unc.edu>)
by mail12.speakeasy.net (qmail-ldap-1.03) with SMTP
for <Nils_Kilden-Pedersen AT Countrywide.Com>;
29 Mar 2003 20:04:14 -0000
Mime-Version: 1.0
X-Sender: elharo AT mail.ibiblio.org
Message-Id: <p04330101baaba267d089@[192.168.254.4]>
In-Reply-To: <OF8C7C178A.9CBC46A2-ON88256CF7.002AAF21 AT countrywide.com>
References: <OF8C7C178A.9CBC46A2-ON88256CF7.002AAF21 AT countrywide.com>
Date: Sat, 29 Mar 2003 14:20:48 -0500
To: Nils_Kilden-Pedersen AT Countrywide.Com,
xom-interest AT lists.ibiblio.org
From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
Subject: Re: [XOM-interest] 0x25?
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Sat, 29 Mar 2003 20:04:09 -0000

At 11:46 PM -0800 3/27/03, Nils_Kilden-Pedersen AT Countrywide.Com wrote:
<http://java.sun.com/j2ee/sdk_1.3/techdocs/api/org/xml/sax/XMLReader.html>http://java.sun.com/j2ee/sdk_1.3/techdocs/api/org/xml/sax/XMLReader.html

Don't know which is right.


I'll bring this up over on sax-devel, but I suspect the Sun parser is buggy. Which parser are you using. Crimson?
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| Processing XML with Java (Addison-Wesley, 2002) |
| http://www.cafeconleche.org/books/xmljava |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
From passani AT eunet.no Sat Mar 29 15:12:17 2003
Return-Path: <passani AT eunet.no>
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from mail-relay.eunet.no (mail-relay.eunet.no [193.71.71.242])
by happyhouse.metalab.unc.edu (Postfix) with ESMTP id 5ECC62002B
for <xom-interest AT lists.ibiblio.org>;
Sat, 29 Mar 2003 15:12:17 -0500 (EST)
Received: from eunet.no (host231-207.pool62211.interbusiness.it
[62.211.207.231] (may be forged))h2TKC8Ek014133
for <xom-interest AT lists.ibiblio.org>;
Sat, 29 Mar 2003 21:12:15 +0100 (CET)
(envelope-from passani AT eunet.no)
Message-ID: <3E85FE17.7070902 AT eunet.no>
Date: Sat, 29 Mar 2003 21:12:07 +0100
From: luca passani <passani AT eunet.no>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.0.2) Gecko/20030208 Netscape/7.02
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: xom <xom-interest AT lists.ibiblio.org>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Subject: [XOM-interest] loop in loop? xpath?
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Sat, 29 Mar 2003 20:12:18 -0000


Assuming I have a bit of XML like the following, what's the best (most efficient) way
to retrieve the list of capability names and stick them into an ArrayList?

I already have:

Element genericElement = (Element)deviceElementsList.get("generic");

I can only think of nested loops, but maybe there is some XOM shorthand notation?
What about XPATH?

<device id="generic">
<group id="ui">
<capability name="proportional_font" value="false"/>
<capability name="built_in_back_button_support" value="false"/>
</group>
<group id="cache">
<capability name="total_cache_disable_support" value="false"/>
<capability name="time_to_live_support" value="false"/>
</group>
</device>

thank you

Luca




Archive powered by MHonArc 2.6.24.

Top of Page