You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Aaron Wadley <AW...@TheFund.com> on 2001/06/14 23:30:18 UTC
Entity expansion
Please forgive me if this question has been asked before, but I can't seem
to find the archives.
I've got an ampersand (&) in the content of an element. Eg.
<field>&</field> The parser interprets this as an entity reference, when
it's really part of the data. Is there a way to turn off the parser trying
to expand this? I tried the following code, with no luck.
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setExpandEntityReferences(false);
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
Am I doing something wrong or does factory.setExpandEntityReferences(false)
not do what I think it should do?
Thanks.
--
Aaron Wadley awadley@thefund.com
Programmer/Analyst (407) 240-3863 x7787
The Fund, Inc. http://www.thefund.com
=====================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Entity expansion
Posted by Ian Roberts <ir...@decisionsoft.com>.
On Thu, 14 Jun 2001, Aaron Wadley wrote:
> Please forgive me if this question has been asked before, but I can't seem
> to find the archives.
>
> I've got an ampersand (&) in the content of an element. Eg.
> <field>&</field> The parser interprets this as an entity reference, when
> it's really part of the data. Is there a way to turn off the parser trying
> to expand this?
I don't think the XML spec would allow this. The correct fix is to
replace & with & (the entity reference representing &) in the XML.
Ian
--
Ian Roberts, Software Engineer DecisionSoft Ltd.
Telephone: +44-1865-203192 http://www.decisionsoft.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org