Question: I'm dealing with this kind of XML sequence file can you any one suggest me to parse this:

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE us-patent-grant SYSTEM "us-patent-grant-v42-2006-08-23.dtd" [ ]>
<name>ccccc</name>
<document-id>
<country>US</country>
<doc-number>D0629997</doc-number>
<kind>S1</kind>
<date>20110104</date>
</document-id>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE us-patent-grant SYSTEM "us-patent-grant-v42-2006-08-23.dtd" [ ]>
<name>dddd</name>
<document-id>
<country>US</country>
<doc-number>D0629998</doc-number>
<kind>S2</kind>
<date>20110104</date>
</document-id>

```

Answer: 
That's not a valid XML file. It looks like two files in one, but even then it is invalid. Assuming those are two separate files, you could try "tidying" them first. Assuming $xml is a string containing the xml contents:

```
$xml = tidy_repair_string($xml, array(
    'output-xml' => true,
    'input-xml' => true
)); 

```

Then you could use SimpleXml on it:

```
$xml = new SimpleXmlElement($xml);

```
I know where this XML file has come from and I find it quite strange that Google would provide some invalid XML (unless they are simply just hosting this file that they got from somewhere else). This suggestion for parsing it worked for me: [How to parse an xml file with multiple xml declaration using PHP? (A concatenation of several XML files)](https://stackoverflow.com/questions/10780560/how-to-parse-an-xml-file-with-multiple-xml-declaration-using-php-a-concatenati)