Answers.Body: <p>Your best bet is to validate with <a href="https://github.com/idpf/epubcheck" rel="nofollow" title="epubcheck">EPUBCheck</a>. That will catch dupe @ids and other errors. I use a command in Linux similar to:</p>
  
  <pre><code>java -jar /home/epubcheck.jar book.epub -out errors.xml
  </code></pre>
  
  <p>The errors.xml file will give you filename, line numbers, and error descriptions. </p>
  
  <p>Or you can use an online validator at <a href="http://validator.idpf.org/" rel="nofollow" title="IDPF">IDPF</a> if you don't mind uploading your work.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-26T12:33:01.533Z
Answers.LastActivityDate: 2015-09-26T12:33:01.533Z
Answers.UserDisplayName: Paulb
Answers.Body: <p>Validate the ePUB using EPUB  check 3.0.1 or if the file is less than 10 MB then you can validate the file using online ePUB validator (<a href="http://validator.idpf.org/" rel="nofollow">http://validator.idpf.org/</a>). This will definitely help in identifying the duplicate ID’s.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-18T13:27:31.043Z
Answers.Text: When I validated my home made EPUB, I believe this validator did not like the same IDs in different XHTML files, hence the user's question. Apparently EPUB does not allow the same ID in different XHTML files. This is why I include the XHTML filename in all my IDs now. So my id would be: id="ch1.xhtml_p1"
Answers.UserDisplayName: Bulrush
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-04T11:38:03.927Z
Answers.LastActivityDate: 2016-04-04T11:38:03.927Z
Answers.UserDisplayName: Leon William
Answers.Body: <p>download link validator <a href="http://lithopssoft.com/hlv/" rel="nofollow">http://lithopssoft.com/hlv/</a></p>
  
  <p>drag and drop the file into the validator and click validate button. error will show on screen.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-29T11:27:52.340Z
Answers.LastActivityDate: 2015-09-29T11:27:52.340Z
Answers.UserDisplayName: Siva Kumar
Body: <p><strong>Chapter_1.xhtml:</strong></p>
  
  <pre><code>&lt;div id="ch1_sec1"&gt;
  &lt;h1 id="level1"&gt;Section 1&lt;/h1&gt;
  &lt;p id="p1"&gt;paragraph1, see &lt;a href="Chapter_1.xhtml#f1"&gt;fig 1&lt;/a&gt;&lt;/p&gt;
  &lt;figure id="f1"&gt;
  &lt;caption&gt;Fig. 1. Caption&lt;/caption&gt;
  &lt;/figure&gt;
  &lt;p id="p2"&gt;paragraph2, see &lt;a href="Chapter_1.xhtml#f1"&gt;fig 2&lt;/a&gt;&lt;/p&gt;
  &lt;p id="p3"&gt;paragraph3&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Chapter_2.xhtml:</strong></p>
  
  <pre><code>&lt;div id="ch2_sec1"&gt;
  &lt;h1 id="level1"&gt;Section 1&lt;/h1&gt;
  &lt;p id="p1"&gt;paragraph1&lt;/p&gt;
  &lt;p id="p2"&gt;paragraph2, see &lt;a href="Chapter_1.xhtml#f1"&gt;fig 2&lt;/a&gt;&lt;/p&gt;
  &lt;figure id="f1"&gt;
  &lt;caption&gt;Fig. 2. Caption&lt;/caption&gt;
  &lt;/figure&gt;
  &lt;p id="p3"&gt;paragraph3&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Chapter_3.xhtml:</strong></p>
  
  <pre><code>&lt;div id="ch3_sec1"&gt;
  &lt;h1 id="level1"&gt;Section 1&lt;/h1&gt;
  &lt;p id="p1"&gt;paragraph1&lt;/p&gt;
  &lt;p id="p2"&gt;paragraph2&lt;/p&gt;
  &lt;p id="p3"&gt;paragraph3&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In above mentioned source file, All the IDs are same except <code>&lt;div&gt;</code> ID.
  In this case, how can i find the duplicates with different filenames (using perl, javascript or anything else).</p>
  
  <p>If you have solution for this, please help.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-17T17:44:26.970Z
Comments.Text: Could you explain why this is a problem exactly? You can have Chapter_2.xhtml#p1 and Chapter_3.xhtml#p1 without there being an ambiguous reference. Do you need this to specify a css class?
Comments.UserDisplayName: idiotprogrammer
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-18T04:23:25.167Z
Comments.Text: Hi @idiotprogrammer, For example: **Figure 1** has placed in Chapter_1.xhtml with id="f1" and **Figure 2** has placed in Chapter_2.xhtml with the same id="f1". But the fig 2 cited in the Chapter_1.xhtml, when i run the script for href links, it will be linked like `<a href="Chapter_1.xhtml#f1">Fig. 1.</a>` and `<a href="Chapter_1.xhtml#f1">Fig. 2.</a>`. because the script is finding and linking with first id with different content.
Comments.UserDisplayName: mr.apandu
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-18T19:05:31.747Z
Comments.Text: What do you mean by "when I run the script for href links." What script? Why are you running it? I am assuming that the code you list is your SOURCE code and not OUTPUT code from a script. Is that right? For the record, I use Docbook XSLT, and the output looks similar to what you have here. If it is your source, then you can change it yourself. If not, then your problem is your script/toolchain.
Comments.UserDisplayName: idiotprogrammer
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-18T19:09:58.843Z
Comments.Text: Perhaps I am not reading your comments correctly,  but in the example you gave with your figures, there is nothing wrong with the example; you just aren't providing enough information to understand your problem. That is the challenge of trying to ask a technical question :)
Comments.UserDisplayName: idiotprogrammer
Tags: <epub><html>
Title: How to find duplicate IDs in epub?
UserDisplayName: mr.apandu
ThreadText: # How to find duplicate IDs in epub?
  
  (Asked by: username_0 on 2015-09-17)
  
  Chapter_1.xhtml:
  
  Section 1
  paragraph1, see fig 1
  
  Fig. 1. Caption
  
  paragraph2, see fig 2
  paragraph3
  
  
  Chapter_2.xhtml:
  
  Section 1
  paragraph1
  paragraph2, see fig 2
  
  Fig. 2. Caption
  
  paragraph3
  
  
  Chapter_3.xhtml:
  
  Section 1
  paragraph1
  paragraph2
  paragraph3
  
  
  In above mentioned source file, All the IDs are same except  ID.
  In this case, how can i find the duplicates with different filenames (using perl, javascript or anything else).
  If you have solution for this, please help.
  
  **Tags:** epub, html
  
  > **Comments:**
  > **username_1**: Could you explain why this is a problem exactly? You can have Chapter_2.xhtml#p1 and Chapter_3.xhtml#p1 without there being an ambiguous reference. Do you need this to specify a css class?  
  > **username_0**: Hi @username_1, For example: **Figure 1** has placed in Chapter_1.xhtml with id="f1" and **Figure 2** has placed in Chapter_2.xhtml with the same id="f1". But the fig 2 cited in the Chapter_1.xhtml, when i run the script for href links, it will be linked like `<a href="Chapter_1.xhtml#f1">Fig. 1.</a>` and `<a href="Chapter_1.xhtml#f1">Fig. 2.</a>`. because the script is finding and linking with first id with different content.  
  > **username_1**: What do you mean by "when I run the script for href links." What script? Why are you running it? I am assuming that the code you list is your SOURCE code and not OUTPUT code from a script. Is that right? For the record, I use Docbook XSLT, and the output looks similar to what you have here. If it is your source, then you can change it yourself. If not, then your problem is your script/toolchain.  
  > **username_1**: Perhaps I am not reading your comments correctly,  but in the example you gave with your figures, there is nothing wrong with the example; you just aren't providing enough information to understand your problem. That is the challenge of trying to ask a technical question :)  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2015-09-26. Score: 1
  
  Your best bet is to validate with EPUBCheck. That will catch dupe @ids and other errors. I use a command in Linux similar to:
  java -jar /home/epubcheck.jar book.epub -out errors.xml
  
  The errors.xml file will give you filename, line numbers, and error descriptions. 
  Or you can use an online validator at IDPF if you don't mind uploading your work.
  
  
  ---
  
  ### Answer by username_3 on 2016-04-04. Score: 0
  
  Validate the ePUB using EPUB check 3.0.1 or if the file is less than 10 MB then you can validate the file using online ePUB validator (<http://validator.idpf.org/>). This will definitely help in identifying the duplicate ID’s.
  
  > **Comments:**
  > **username_4**: When I validated my home made EPUB, I believe this validator did not like the same IDs in different XHTML files, hence the user's question. Apparently EPUB does not allow the same ID in different XHTML files. This is why I include the XHTML filename in all my IDs now. So my id would be: id="ch1.xhtml_p1"  
  
  ---
  
  ### Answer by username_5 on 2015-09-29. Score: 0
  
  download link validator <http://lithopssoft.com/hlv/>
  
  drag and drop the file into the validator and click validate button. error will show on screen.
  
  
  ---
  
  