Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Stax parser: Is "&lt;" always < ?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Webheavy <webheavy AT yahoo.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Stax parser: Is "&lt;" always < ?
  • Date: Sun, 4 Jun 2006 19:28:02 -0700 (PDT)

I am trying to get a StAX parser to pass &-el-tee; as characters, not
converted to <. Is this possible? I've tried the RI from Sun and WoodStox but
it seems to be hardwired in for the built-in entities.

Thanks for any advice.
Roger Kovack


---------------------------------
Ring'em or ping'em. Make PC-to-phone calls as low as 1ยข/min with Yahoo!
Messenger with Voice.
>From wolfgang.hoschek AT mac.com Mon Jun 5 00:50:08 2006
Return-Path: <wolfgang.hoschek AT mac.com>
X-Original-To: xom-interest AT lists.ibiblio.org
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.172])
by lists.ibiblio.org (Postfix) with ESMTP id DF7544C00B
for <xom-interest AT lists.ibiblio.org>;
Mon, 5 Jun 2006 00:50:07 -0400 (EDT)
Received: from mac.com (smtpin03-en2 [10.13.10.148])
by smtpout.mac.com (Xserve/8.12.11/smtpout02/MantshX 4.0) with ESMTP
id
k554o7Y4014396; Sun, 4 Jun 2006 21:50:07 -0700 (PDT)
Received: from [10.0.1.2] (adsl-71-131-239-62.dsl.sntc01.pacbell.net
[71.131.239.62]) (authenticated bits=0)
by mac.com (Xserve/smtpin03/MantshX 4.0) with ESMTP id k554o3tO011881
(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO);
Sun, 4 Jun 2006 21:50:06 -0700 (PDT)
In-Reply-To: <20060605022803.70294.qmail AT web55502.mail.re4.yahoo.com>
References: <20060605022803.70294.qmail AT web55502.mail.re4.yahoo.com>
Mime-Version: 1.0 (Apple Message framework v749.3)
Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed
Message-Id: <3D472E8F-A359-4B0D-9203-1A6AA9177141 AT mac.com>
Content-Transfer-Encoding: quoted-printable
From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
Date: Sun, 4 Jun 2006 21:49:58 -0700
To: Webheavy <webheavy AT yahoo.com>
X-Mailer: Apple Mail (2.749.3)
Cc: xom-interest AT lists.ibiblio.org
Subject: Re: [XOM-interest] Stax parser: Is "&lt;" always < ?
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: XOM API for processing XML with Java <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: Mon, 05 Jun 2006 04:50:08 -0000

How about using a CDATA section to avoid parser interpretation of =20
content? Example:

[hoschek /Users/hoschek/unix/devel/nux] cat /tmp/test2.xml
<foo><![CDATA[&lt;]]></foo>
[hoschek /Users/hoschek/unix/devel/nux] fire-java =20
nux.xom.sandbox.ParseTest false /tmp/test2.xml
true
false
<?xml version=3D"1.0"?>
<foo>&amp;lt;</foo>

[hoschek /Users/hoschek/unix/devel/nux] cat src/nux/xom/sandbox/=20
ParseTest.java
package nux.xom.sandbox;

import java.io.File;

import nu.xom.Builder;
import nu.xom.Document;
import nux.xom.io.StaxUtil;

public class ParseTest extends IOTest {

public static void main(String[] args) throws Throwable {
boolean useSAX =3D new Boolean(args[0]).booleanValue();
Builder builder =3D useSAX ? new Builder() : =20
StaxUtil.createBuilder(null, null);
Document doc =3D builder.build(new File(args[1]));

System.out.println(doc.getRootElement().getValue=20
().equals("&lt;"));
System.out.println(doc.getRootElement().getValue=20
().equals("<"));
System.out.println(doc.toXML());
}
}
[hoschek /Users/hoschek/unix/devel/nux]


Wolfgang.

On Jun 4, 2006, at 7:28 PM, Webheavy wrote:

> I am trying to get a StAX parser to pass &-el-tee; as characters, =20
> not converted to <. Is this possible? I've tried the RI from Sun =20
> and WoodStox but it seems to be hardwired in for the built-in =20
> entities.
>
> Thanks for any advice.
> Roger Kovack
>
> =09
> ---------------------------------
> Ring'em or ping'em. Make PC-to-phone calls as low as 1=A2/min with =20=

> Yahoo! Messenger with Voice.
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest





Archive powered by MHonArc 2.6.24.

Top of Page