2016-12-12 10 views
0

私はtinyxml2を使用していますが、残念ながらインデントは4つの空白として扱われます。私はタブにこれを変更したいが、私は方法を知らない。可能な方法は他にありますか? Can notepad ++は、すべての80000 xmlドキュメントを空白からタブに自動的に変換できますか?ファイルは以下の通りです。<folder>は4つのスペースの代わりにタブで表示されます。すべてのxml文書を空白からタブに変換する - ノートパッド++

<annotation> 
    <folder>train</folder> 
    <filename>004185</filename> 
    <source> 
     <database>KITTI database</database> 
    </source> 
    <size> 
     <width>1242</width> 
     <height>375</height> 
     <depth>3</depth> 
    </size> 
    <segment>0</segment> 
    <object> 
     <name>Car</name> 
     <pose>unspecified</pose> 
     <truncated>0</truncated> 
     <difficult>0</difficult> 
     <bndbox> 
      <xmin>339.49000000000001</xmin> 
      <ymin>165.49000000000001</ymin> 
      <xmax>476.13999999999999</xmax> 
      <ymax>229.97999999999999</ymax> 
     </bndbox> 
    </object> 
    <object> 
     <name>Car</name> 
     <pose>unspecified</pose> 
     <truncated>0</truncated> 
     <difficult>0</difficult> 
     <bndbox> 
      <xmin>376.77999999999997</xmin> 
      <ymin>170.11000000000001</ymin> 
      <xmax>498.54000000000002</xmax> 
      <ymax>218.25</ymax> 
     </bndbox> 
    </object> 
    <object> 
     <name>Car</name> 
     <pose>unspecified</pose> 
     <truncated>0</truncated> 
     <difficult>0</difficult> 
     <bndbox> 
      <xmin>784.83000000000004</xmin> 
      <ymin>150.27000000000001</ymin> 
      <xmax>840.88999999999999</xmax> 
      <ymax>189.50999999999999</ymax> 
     </bndbox> 
    </object> 
    <object> 
     <name>Car</name> 
     <pose>unspecified</pose> 
     <truncated>0</truncated> 
     <difficult>0</difficult> 
     <bndbox> 
      <xmin>412.88999999999999</xmin> 
      <ymin>172.94</ymin> 
      <xmax>514.10000000000002</xmax> 
      <ymax>208.41</ymax> 
     </bndbox> 
    </object> 
    <object> 
     <name>Car</name> 
     <pose>unspecified</pose> 
     <truncated>0</truncated> 
     <difficult>0</difficult> 
     <bndbox> 
      <xmin>434.24000000000001</xmin> 
      <ymin>164.97999999999999</ymin> 
      <xmax>530.09000000000003</xmax> 
      <ymax>200.84</ymax> 
     </bndbox> 
    </object> 
</annotation> 
+0

XMLファイルからサンプルをご覧ください。はい、メモ帳++はこれを行うことができますが、ファイルを見る必要があります。 –

+0

こんにちは、ありがとう!投稿を編集してxmlファイルを追加しました。基本的には、すべてのグループを「4つの空白」に置き換えようとしています。 – kong

答えて

1

Edit -> Blank Operations -> Space to TAB (Leading) 

これはあなたのタブの設定に依存しています。

Find (Ctrl-F) -> Find in Files (tab) 

Find what: <4 spaces> 
Replace with: /t 
Directory: the directory that contains the files 
Filters: if needed a means of filtering eg file extension *.xml 
Search mode: Extended 
Then Replace In Files 

あなただけの行の先頭にスペースを交換する必要がある場合は、正規表現のソリューションがあるかもしれません:複数のファイルでこれを行うには

。これは役立つ可能性があります:

perl replace space with tab

+0

しかし、私は80,000のXML文書でそれを行う必要があります。 – kong

+0

ああ、それは見つからなかった。私は私の答えを編集しました –

1

あなたは、タブと4つのスペースのすべての発生を置き換える耐えることができる場合は、次のように動作するはずです:

検索:

(type in four spaces) 

置き換え:

\t 

これを正規表現モードで検索/置き換えます(ポップアップダイアログでregexオプションを選択してください)。単一のファイルでこれを行うには

関連する問題