Question
· Apr 5, 2023

ERROR #6301: SAX XML Parser Error: XML or TEXT declaration must start at line 1, column 1

Exported contents of a namespace on one server (classes, include files and lookup tables). Importing that code into a newly created namespace on another server. Both servers Ensemble 2018.1, same build. Export was via InterSystems Studio. Export is around 18Mb in total (XML file sizes).

When importing and compiling on the new server, getting errors as below - with #6301: SAX XML Parser error prominent - on a number of the imported files, all containing data transformations or business processes.

When I try and open the transformation or the business process through the management portal I get a related error:  
I do not get the same error on the system from which I exported the code - so I'm suspecting something about the setup of the server into which I'm importing the code. How can I go about tracking this down?

(Full compilation log for a different class than the one captured in the screenshot above included below, in case the "obvious" #6301 error is masking something else present deeper in the compilation...)


Compilation started on 04/05/2023 15:15:52 with qualifiers 'cuk /checkuptodate=expandedonly'
Compiling class TNHS.Trans.EnsDOCWebservice.EDT.Document
ERROR #6301: SAX XML Parser Error: XML or TEXT declaration must start at line 1, column 1 while processing Schema at line 2 offset 7
  > ERROR #5490: Error running generator for method 'GetSourceDocType:TNHS.Trans.EnsDOCWebservice.EDT.Document'
ERROR: Ens.DataTransformDTL.cls(GetSourceDocType) of generated code compiling subclass 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
    > ERROR #5030: An error occurred while compiling class 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
ERROR #6301: SAX XML Parser Error: XML or TEXT declaration must start at line 1, column 1 while processing Schema at line 2 offset 7
  > ERROR #5490: Error running generator for method 'GetSourceType:TNHS.Trans.EnsDOCWebservice.EDT.Document'
ERROR: Ens.DataTransformDTL.cls(GetSourceType) of generated code compiling subclass 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
    > ERROR #5030: An error occurred while compiling class 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
ERROR #6301: SAX XML Parser Error: XML or TEXT declaration must start at line 1, column 1 while processing Schema at line 2 offset 7
  > ERROR #5490: Error running generator for method 'GetTargetDocType:TNHS.Trans.EnsDOCWebservice.EDT.Document'
ERROR: Ens.DataTransformDTL.cls(GetTargetDocType) of generated code compiling subclass 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
    > ERROR #5030: An error occurred while compiling class 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
ERROR #6301: SAX XML Parser Error: XML or TEXT declaration must start at line 1, column 1 while processing Schema at line 2 offset 7
  > ERROR #5490: Error running generator for method 'GetTargetType:TNHS.Trans.EnsDOCWebservice.EDT.Document'
ERROR: Ens.DataTransformDTL.cls(GetTargetType) of generated code compiling subclass 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
    > ERROR #5030: An error occurred while compiling class 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
ERROR #6301: SAX XML Parser Error: XML or TEXT declaration must start at line 1, column 1 while processing Schema at line 2 offset 7
  > ERROR #5490: Error running generator for method 'Transform:TNHS.Trans.EnsDOCWebservice.EDT.Document'
ERROR: Ens.DataTransformDTL.cls(Transform) of generated code compiling subclass 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
    > ERROR #5030: An error occurred while compiling class 'TNHS.Trans.EnsDOCWebservice.EDT.Document'
Compiling routine TNHS.Trans.EnsDOCWebservice.EDT.Document.1
Detected 5 errors during compilation in 0.061s.
Product version: Ensemble 2018.1
Discussion (1)1
Log in or sign up to continue

For completeness / in case others come across this, turned out the XML export file was being corrupted during transfer between the two systems. It was a CR/LF corruption - in our specific case CR/LF was getting converted to CR/CR/LF !!

Highlighted that DTL's specifically appear sensitive to CR/LF changes - we've subsequently come across the same #6301 error loading DTL's get CR/LF modified in another way (we're still tracking that one down, though suspicion currently is with git...)