Error: XML document structures must start and end within the same entity
Your XML is not well-formed. In general, this error indicates that something is wrong with the range of the start and end tags.
In particular in your case, you have a stray s
in one of the closing access2
tags:
<access2>115AL<s/access2>
Here is your XML with the problem resolved; it is now well-formed (and indented to improve readability):
<?xml version="1.0" encoding="ISO-8859-1"?><root> <test> <access1>113AL</access1> <access2>119AL</access2> </test> <test> <access2>115AL</access2> <access3>116AL</access3> </test> <test> <access4>118AL</access4> <access5>119AL</access5> </test> <copies> <test2> <access>113AL</access> <Copy>Y</Copy> </test2> <test2> <access>113AX</access> <Copy>N</Copy> </test2> </copies></root>
If your xml
is well formed, as fixed in kjhughes answer, you can always run xmllint
to prettify it as:
[nsaunders@rolly ~]$ [nsaunders@rolly ~]$ cat foo.xml <?xml version="1.0" encoding="ISO-8859-1"?><root><test><access1>113AL</access1><access2>119AL</access2></test><test><access2>115AL</access2><access3>116AL</access3></test><test><access4>118AL</access4><access5>119AL</access5></test><copies><test2><access>113AL</access><Copy>Y</Copy></test2><test2><access>113AX</access><Copy>N</Copy></test2></copies></root>[nsaunders@rolly ~]$ [nsaunders@rolly ~]$ xmllint --format foo.xml --output foo.xml[nsaunders@rolly ~]$ [nsaunders@rolly ~]$ cat foo.xml <?xml version="1.0" encoding="ISO-8859-1"?><root> <test> <access1>113AL</access1> <access2>119AL</access2> </test> <test> <access2>115AL</access2> <access3>116AL</access3> </test> <test> <access4>118AL</access4> <access5>119AL</access5> </test> <copies> <test2> <access>113AL</access> <Copy>Y</Copy> </test2> <test2> <access>113AX</access> <Copy>N</Copy> </test2> </copies></root>[nsaunders@rolly ~]$
Just as an FYI.
Of course, xmllint
is primarily for validating a document.