0
Keep getting xml parsing error
How can I solve the problem I'm having with a xml code any with knowledge should help cause i need it urgently i keep getting parsing error each time I try to get the new template I downloaded installed and this is what blogger is showing :Error parsing XML, line 4197, column 70: The entity "office" was referenced, but not declared. And this is what they are referring to :SCHOOL &OFFICE; So please if you have any solution please share
30 Réponses
+ 3
abraham chukwukelu I think what Sandra Meyer is referring to is the use case for when it's appropriate to declare a custom entity.
Declaring a custom entity relates to defining data structure ahead of loading the data.
Typically, you wouldn't declare a custom entity just to address an unescaped special character. These are meant to define an actual entity that has some domain specific meaning for the data being defined and therefore it would have some significant meaning in the data structure... which would be known before attempting to load the data into an XML parser.
The proper way to handle this would be using either Option 1 or Option 2 as these are appropriate for when the data content is being prepared.
I hope this makes sense.
+ 3
abraham chukwukelu It would be easier to help if we can see the XML in question.
My guess is your XML contains HTML content that isn't in CData.
+ 2
abraham chukwukelu Your question doesn't give much to work with to answer definitively.
Based on what you have provided, it sounds like you are attempting to parse some XML file that is failing to validate against some referenced XML Schema.
In others words, your XML contains an element for <office /> which is not declared in a corresponding schema.
+ 2
abraham chukwukelu When I originally read your question, I thought the following was some sort of reference to the type of XML elements:
:SCHOOL &OFFICE;
Upon revisiting this, I now realize this is the content from your XML at the specified line and column in your error.
I recommend clarifying this in future questions should you have similar problems again.
That said, the issue you are running into is due to the unescaped ampersand in your XML content.
You can resolve this with any of the following options:
--------
Option 1: Escape the ampersand:
----
... SCHOOL &OFFICE; ...
--------
Option 2: Use CDATA to avoid having to escape special characters like ampersand:
----
<![CDATA[
... SCHOOL &OFFICE; ...
]]>
--------
Option 3: Declare an Entity:
----
<!ENTITY OFFICE "&OFFICE;">
...
... SCHOOL &OFFICE; ...
DISCLAIMER: You'll need to test if the third option works.
+ 2
Thanks David Carroll
abraham chukwukelu basically you can try it to define something on your own in this XML file, but your chances to success is very small if you don't know the (actual or intended) data model. So try 1&2, if they don't work, you shouldn't proceed.
+ 1
David Carroll depending on the question I guess option three and I don't think, that he will be too successful using a self-defined entity without knowing it's designated structure and content...
+ 1
https://stackoverflow.com/questions/62458816/xml-parsing-error-the-entity-office-was-referenced-but-not-declared David Carroll
abraham chukwukelu
Replace:
&
With:
\\&
Edit: Replace all occurrences.
Best solution: throw it away and use a template of somebody who knew what he / she did. There are many more errors within it, as far as I can see in this little screenshot at least 3 more.
+ 1
abraham chukwukelu Save the entire XML in a code bit using any of the languages.
This looks like XHTML. I would need to see the entire XML to give you any meaningful feedback.
0
Dependent on your information that this is a AddOn XML file, which should be consistent and valid - if this all is correct: Your template requires another XML file, as precondition for installation, where the object "office" is defined.
0
Please can you provide a more detailed explanation
0
Not really. You need to look up the requirements for that plugin u wanna use. Can't help you with that, I don't even know what tool you're using. It's just a simple, typical XML error.
0
Sandra Meyer well if by designated structure and content you mean it function and for what am using it for, well it supposed to be a menu bar for a new template I just want to install on a site that I and my cousin are trying to start
0
Thanks David Carroll option 1 worked but don't know if I would call it a total success cause now it unto another parse error entirely
Am asked now to provide a matching end-tag "" for the element "li" , meanwhile the code highlighted is not containing "li"
But </div>
0
It's absolutely normal to have follow-up bugs when fixing something in a definition more or less blind. You can try to fix them now all (probably more will occur) or just try to find out, if there's already a patch. Did you ask the provider of this template or Google for errors occurring with its installation?
0
Provider doesn't even reply messages both on whatsapp or any other medium you try to communicate with him and about asking Google how do I do that please David Carroll
0
Please Sandra Meyer how do I go about asking Google for errors occurring with its installation? ,or how do I get the patch if the is ?
0
Just copy & paste the complete original (before fixing anything) error message to google. You're quite sure not the first person with this issue.
0
Please Sandra Meyer do you mean I should copy and paste the original template to Google, and is it going to be on search or is there any Google platform that can help me with this, and on the issue of being sure of being the first person with this issue I don't know but what I do know is that people have been having one difficulties to the other on installing the said template
0
Okay David Carroll am going to try what you said by sending a copy of the XML here
0
This is all I could copy here@ David Carroll