Extra characters in files causing Invalid XML errors

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
mmdintexas
Jr. Propeller Head
Posts: 8
Joined: Wed Jul 08, 2015 1:08 pm

Extra characters in files causing Invalid XML errors

Post by mmdintexas »

Conditions and Styles are missing. Extra characters seem to be corrupting files, I see them in the HTML but the same problem seems to be happening to my conditions and variables files.

The message is: Name cannot begin with the '<' character, hexadecimal value 0x3C. I can open the HTML as text, see below:

<?xml version="1.0" encoding="utf-8"?>
<<<<<<< HEAD
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="10" MadCap:lastHeight="823" MadCap:lastWidth="875">
=======
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="10" MadCap:lastHeight="1012" MadCap:lastWidth="1018">
>>>>>>> 69c90435a75a3819d8644c8155ec882c30fb7ed0
<head>
<link href="../Resources/TableStyles/PatternedRows.css" rel="stylesheet" MadCap:stylesheetType="table" />
<link href="../Resources/TableStyles/PatternedRows.css" rel="stylesheet" MadCap:stylesheetType="table" />
<link href="../Resources/TableStyles/PatternedRows.css" rel="stylesheet" MadCap:stylesheetType="table" />
<<<<<<< HEAD
<link href="../Resources/TableStyles/PatternedRows.css" rel="stylesheet" MadCap:stylesheetType="table" />

Help please. Do I need to edit all these bad files separately?


Thanks
wclass
Propellus Maximus
Posts: 1238
Joined: Mon Feb 27, 2006 5:56 am
Location: Melbourne, Australia

Re: Extra characters in files causing Invalid XML errors

Post by wclass »

Are the bits you've highlighted in red actually part of the HTM file? Do you store your project in a source code repository?
The red bits look like the messages you get when a source code manager, like GIT, has detected differences. If so, they should not have been saved with the file, and yes, they will have to be removed.

On a different but related note, the differences look like the Flare imposed last known height/width the page was displayed as - in my opinion this should not be stored in a topic header because is causes problems when trying to compare files. I think I will raise another bug report about this.
Margaret Hassall - Melbourne
mmdintexas
Jr. Propeller Head
Posts: 8
Joined: Wed Jul 08, 2015 1:08 pm

Re: Extra characters in files causing Invalid XML errors

Post by mmdintexas »

Yes, the parts highlighted in red are in the file.
Yes, stored in a source code repository (bitbucket) with Git.
This happened yesterday after my colleague pushed some edited files and this is the result.

Is there a way to edit my conditions and styles outside of flare? Have a feeling I am better off replacing with older versions.
wclass
Propellus Maximus
Posts: 1238
Joined: Mon Feb 27, 2006 5:56 am
Location: Melbourne, Australia

Re: Extra characters in files causing Invalid XML errors

Post by wclass »

Since all the Flare project files are text, then yes, you can edit outside of Flare, but with the caveat that you have to keep the files valid yourself. Take backups! I often edit stylesheets with other editors externally.

If the changes were made only yesterday, can you roll back to an earlier version?
Margaret Hassall - Melbourne
mmdintexas
Jr. Propeller Head
Posts: 8
Joined: Wed Jul 08, 2015 1:08 pm

Re: Extra characters in files causing Invalid XML errors

Post by mmdintexas »

I am trying to roll back to an earlier version. However, we will lose some files.
Is this a bug that we've run into?
wclass
Propellus Maximus
Posts: 1238
Joined: Mon Feb 27, 2006 5:56 am
Location: Melbourne, Australia

Re: Extra characters in files causing Invalid XML errors

Post by wclass »

I'm not sure that it's a bug. I use GIT with other projects but not with Flare, so I can't speak for the Flare-Git integration, but I think it is more likely user error - saving the wrong text when doing a compare or a diff when committing/pushing the updates.
Margaret Hassall - Melbourne
mmdintexas
Jr. Propeller Head
Posts: 8
Joined: Wed Jul 08, 2015 1:08 pm

Re: Extra characters in files causing Invalid XML errors

Post by mmdintexas »

Thank you for your help. Still trying to run down those files with the nasty code.
The integration was working great there for a while and then this happened so I'm not sure where we went wrong.
mrklln
Jr. Propeller Head
Posts: 2
Joined: Tue Nov 19, 2019 5:46 am

Re: Extra characters in files causing Invalid XML errors

Post by mrklln »

Hello there,

I know it's been a while, but did you find the cause of this?

I'm getting characters:
>>>>>>> (name)-Feature-Branch-2019
<<<<<<< HEAD
and
=======

in about 16 files in a 450-topic Flare project. 3 users using one git repository, generally with no problems.
Just occasionally, a conditional tag set gets these characters and some topics too.
doloremipsum
Sr. Propeller Head
Posts: 290
Joined: Mon Aug 26, 2019 2:11 pm

Re: Extra characters in files causing Invalid XML errors

Post by doloremipsum »

The characters you are seeing is how Git marks merge conflicts within files. This happens when the same line/lines of code has been edited in both your local file and in the remote (i.e. whatever your coworkers have edited), or in two different branches. Usually whatever git manager you're using will flag the issue and direct you to a merge manager to fix it, but sometimes the process doesn't work out and you end up with this notation remaining in your file. That obviously makes it invalid XML, so you do have to fix it one way or the other.

Interpretation of the OP's code:
<<<<<<< HEAD [begin merge conflict]
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="10" MadCap:lastHeight="823" MadCap:lastWidth="875"> [local version of the line]
======= [divider]
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="10" MadCap:lastHeight="1012" MadCap:lastWidth="1018"> [remote version of line]
>>>>>>> 69c90435a75a3819d8644c8155ec882c30fb7ed0 [end merge conflict]
Note the difference between the local and remote code - both authors made changes to the same line of code!

Solution:
You should be able to pull the conflict up in Flare's internal mergetool, or whatever mergetool you are using. Alternatively, you can fix it in the code by simply deleting the excess notation and choosing which version of the line you want. e.g. OP could replace the above with simply
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="10" MadCap:lastHeight="823" MadCap:lastWidth="875">
and push the file back into the repo.

To avoid:
Easiest way to avoid this is to keep all writers working on different files, if possible.
in hoc foro dolorem ipsum amamus, consectimur, adipisci volumus.
bcjorden
Jr. Propeller Head
Posts: 5
Joined: Thu Oct 01, 2020 5:22 am

Re: Extra characters in files causing Invalid XML errors

Post by bcjorden »

We've seen this issue between Flare and GitKraken, as well. What we do to resolve is is check to see in GitKraken what files were last committed, as they most likely were the cause of the conflict. Open those files as text files and check for <<<<<HEAD and remove that content.
Post Reply