You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "EXTERNAL Taminidi Ravi (ETI, Automotive-Service-Solutions)" <ex...@us.bosch.com> on 2014/02/21 18:08:10 UTC

& in XML Node Getting Error

Hi, I am getting Error if any of the field in the xml file has & as value.

How can I fix this issue

FYI I changed & to &amp; in the field but still has issues

e.g <filed name="Name">AT&T</field> or <field name="Name">AT&amp;T</field>

Above both gives error, DO I need to change something in the configuration. 

Thanks

Ravi

RE: & in XML Node Getting Error

Posted by Chris Hostetter <ho...@fucit.org>.
: ERROR org.apache.solr.core.SolrCore [com.ctc.wstx.excwstxLazyEception] 
: com.ctc.wstx.exc.WstxParsingException: Undeclared general entity "nbsp"

"nbsp" is not a legal XML entity unless you have an enty declaration that 
defines it.

it sounds like you don't have valid xml -- it sounds like you maybe 
you have some HTML that someone cut/paste into a file that they called XML 
but isn't really.

you said "the field in the xml file" suggesting that someone/something 
attempted to build up a "file" in containing the xml messages for adding 
documents to solr -- what software created this file?  if it's just doing 
string manipulations to try and hack together some XML, you're going to 
keep running into pain.  You really want to be using a true XML library to 
generate correct XML.

Alternatively: don't generate files, or even XML at all -- make that 
software use a client API to talk directly to Solr via java obects, or 
json, or csv, etc....



-Hoss
http://www.lucidworks.com/

Re: & in XML Node Getting Error

Posted by Shawn Heisey <so...@elyograg.org>.
On 2/21/2014 10:31 AM, EXTERNAL Taminidi Ravi (ETI, 
Automotive-Service-Solutions) wrote:
> I am getting something like
>
> ERROR org.apache.solr.core.SolrCore [com.ctc.wstx.excwstxLazyEception] com.ctc.wstx.exc.WstxParsingException: Undeclared general entity "nbsp"
>
> The filed content is "&nbsp;"  or "&amp;"

If you have "nbsp" entities, then it's not actually XML, it's a hybrid 
of HTML and XML.  There are exactly five legal entities in XML, and nbsp 
isn't one of them:

http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML

You'll need to clean up the XML.  As far as I know, there is no way to 
declare a permissive mode.  Solr uses standard and common XML libraries.

Thanks,
Shawn


RE: & in XML Node Getting Error

Posted by "EXTERNAL Taminidi Ravi (ETI, Automotive-Service-Solutions)" <ex...@us.bosch.com>.
I am getting something like

ERROR org.apache.solr.core.SolrCore [com.ctc.wstx.excwstxLazyEception] com.ctc.wstx.exc.WstxParsingException: Undeclared general entity "nbsp"

The filed content is "&nbsp;"  or "&amp;"


-----Original Message-----
From: Greg Walters [mailto:greg.walters@answers.com] 
Sent: Friday, February 21, 2014 12:16 PM
To: solr-user@lucene.apache.org
Subject: Re: & in XML Node Getting Error

Ravi,

What's the error you're getting?

Thanks,
Greg

On Feb 21, 2014, at 11:08 AM, "EXTERNAL Taminidi Ravi (ETI, Automotive-Service-Solutions)" <ex...@us.bosch.com> wrote:

> Hi, I am getting Error if any of the field in the xml file has & as value.
> 
> How can I fix this issue
> 
> FYI I changed & to &amp; in the field but still has issues
> 
> e.g <filed name="Name">AT&T</field> or <field name="Name">AT&amp;T</field>
> 
> Above both gives error, DO I need to change something in the configuration. 
> 
> Thanks
> 
> Ravi


Re: & in XML Node Getting Error

Posted by Greg Walters <gr...@answers.com>.
Ravi,

What's the error you're getting?

Thanks,
Greg

On Feb 21, 2014, at 11:08 AM, "EXTERNAL Taminidi Ravi (ETI, Automotive-Service-Solutions)" <ex...@us.bosch.com> wrote:

> Hi, I am getting Error if any of the field in the xml file has & as value.
> 
> How can I fix this issue
> 
> FYI I changed & to &amp; in the field but still has issues
> 
> e.g <filed name="Name">AT&T</field> or <field name="Name">AT&amp;T</field>
> 
> Above both gives error, DO I need to change something in the configuration. 
> 
> Thanks
> 
> Ravi