Hello,
I want to make a script in UltraEdit that copy strings from a text file and paste them in a xml file in the correct tag.
More precisely:
My idea is to put in the .txt file the same tags that are in the xml file, and put a string after those tags. Example in the .txt file:
<ref_language>give water to plants
<creator>tell me something
<release_date>i like to play chess
<fragment>dont drink and drive
etc...
Next step is to copy that string after the same tags in the xml file. The txt file and the xml have a the same name
===========================
So let me explain my concept:
1) Get the filename of the txt file in a variable for example "index_chocolat.xml" that is in a folder.
2) Tell the script to find the first tag that are in the txt file "<ref_language>" and put it in a variable. Then find the string after that tag "give water to plants" and copy it in to an other variable
3) Look for a xml file with the name "index_chocolat.xml" in a folder.
4) Find the same tag "<ref_language>" that is in the variable in the xml file, and copy the string "give water to plants" after it.
5) Find the next tag in the txt file, and make the procedure again.
Is it possible? Can you help me?
Thank you very much for your help, I am new to JavaScript...
- I use the very last version of UltraEdit currently the 13.10a+2
- I prefer the UltraEdit regex
- I use Windows XP Pro SP2
Lets get to the main thing
2 file are processed, a TXT file to extract the data, and a XML file to insert those data.
TXT FILE CONTENT (Path: C:\website\higher-tech\meta\index_en.txt, encoding utf-8 )
XML FILE CONTENT (Path: C:\website\higher-tech\xml\index_en.xml, encoding utf-8 )
The content is placed in the open xml tags. I think it will be hard to deal with the html content in the <xhtml_fragment> tags, it s not just a line, so I will deal that in an other way I think.
I want to make a script in UltraEdit that copy strings from a text file and paste them in a xml file in the correct tag.
More precisely:
My idea is to put in the .txt file the same tags that are in the xml file, and put a string after those tags. Example in the .txt file:
<ref_language>give water to plants
<creator>tell me something
<release_date>i like to play chess
<fragment>dont drink and drive
etc...
Next step is to copy that string after the same tags in the xml file. The txt file and the xml have a the same name
===========================
So let me explain my concept:
1) Get the filename of the txt file in a variable for example "index_chocolat.xml" that is in a folder.
2) Tell the script to find the first tag that are in the txt file "<ref_language>" and put it in a variable. Then find the string after that tag "give water to plants" and copy it in to an other variable
3) Look for a xml file with the name "index_chocolat.xml" in a folder.
4) Find the same tag "<ref_language>" that is in the variable in the xml file, and copy the string "give water to plants" after it.
5) Find the next tag in the txt file, and make the procedure again.
Is it possible? Can you help me?
Thank you very much for your help, I am new to JavaScript...
- I use the very last version of UltraEdit currently the 13.10a+2
- I prefer the UltraEdit regex
- I use Windows XP Pro SP2
Lets get to the main thing
2 file are processed, a TXT file to extract the data, and a XML file to insert those data.
TXT FILE CONTENT (Path: C:\website\higher-tech\meta\index_en.txt, encoding utf-8 )
Code: Select all
<language_reference>EN
<hd_short_title>Tidligere nyheder
<hd_long_title>Det europæiske informationssystem for skovbrande
<content_priority>2
<clc_creation_date>07/03/2007
<str_reference>higher-tech/news/archives
<str_title>Skift til Eurotarif
<str_language>DA
<str_document_type>57-Web home page (text, logo, image of a department)
<str_classification>16-000- Institutions and Legislation
<str_keywords>technology
<str_keywords>computer
<str_keywords>hardware
<str_keywords>cellular
<str_keywords>processor
<str_description>technology and information
XML FILE CONTENT (Path: C:\website\higher-tech\xml\index_en.xml, encoding utf-8 )
The content is placed in the open xml tags. I think it will be hard to deal with the html content in the <xhtml_fragment> tags, it s not just a line, so I will deal that in an other way I think.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<short_content>
<language_descriptor>
<language_reference></language_reference>
</language_descriptor>
<heading>
<hd_short_title></hd_short_title>
<hd_long_title></hd_long_title>
<hd_abstract>
<xhtml_r>
<xhtml_fragment/>
</xhtml_r>
</hd_abstract>
<hd_media>
<media_reference/>
<media_alternative_text/>
</hd_media>
</heading>
<content_qual>
<content_priority></content_priority>
<content_category_r>
<content_category/>
</content_category_r>
<content_life_cycle>
<clc_creation_date></clc_creation_date>
<clc_modification_date/>
</content_life_cycle>
<content_str>
<str_reference></str_reference>
<str_title></str_title>
<str_creator/>
<str_language></str_language>
<str_document_type></str_document_type>
<str_classification></str_classification>
<str_keywords></str_keywords>
<str_description></str_description>
</content_str>
</content_qual>
<content_ref_short_content>
<ref_date/>
<ref_contact_mail/>
<ref_links>
<ref_link_r>
<short_title/>
<url/>
<abstract>
<xhtml_r>
<xhtml_fragment/>
</xhtml_r>
</abstract>
</ref_link_r>
</ref_links>
<ref_target_audience/>
<ref_author/>
</content_ref_short_content>
<text>
<content_r>
<xhtml_fragment>
<h1>title of some content</h1>
<h2>subtitle of some content</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean placerat. Integer feugiat. In hac habitasse platea dictumst.
Quisque ornare, felis tempus pulvinar fringilla, enim diam tincidunt sem, eu vulputate lacus nisi euismod libero. Sed metus arcu,
posuere hendrerit, pretium ultricies, iaculis eget, odio. In at nunc. Etiam a tellus. In vehicula, felis sit amet hendrerit venenatis,
lectus massa eleifend odio, eget consectetuer augue enim ultrices libero. In sagittis vehicula sem. Nam massa turpis, laoreet vitae,
condimentum id, imperdiet eget, risus. Pellentesque nec urna sit amet ipsum facilisis bibendum. Quisque scelerisque, elit nec nonummy
semper, est lectus accumsan libero, at pellentesque eros nisl ut nulla. Vivamus faucibus, velit eu consectetuer adipiscing, metus elit
eleifend purus, quis porttitor eros felis ut quam. Cras vitae leo.</p>
<p>Nullam sed leo. Integer pede pede, placerat ac, accumsan ut, sollicitudin eget, augue. Donec consectetuer sem eget tortor. Quisque
arcu sapien, egestas a, commodo eget, vehicula in, odio. Quisque eu magna et pede laoreet cursus. Curabitur non ante. Aenean commodo
eros eu quam. Pellentesque magna. Nunc porta orci et sapien. Quisque id risus in magna vulputate gravida.</p>
</xhtml_fragment>
</content_r>
</text>
<medias>
<media_r>
<short_title/>
<media>
<media_reference/>
<media_alternative_text/>
</media>
<abstract>
<xhtml_r>
<xhtml_fragment/>
</xhtml_r>
</abstract>
<alternative_text/>
<transcript/>
</media_r>
</medias>
<links>
<link_r>
<short_title/>
<url/>
<abstract>
<xhtml_r>
<xhtml_fragment/>
</xhtml_r>
</abstract>
</link_r>
</links>
</short_content>