f



Text to XML conversion

I was wondering if anyone could possibly recommend to me a tool that
would take .txt file and convert it to XML format. Thank you very much
in advance!

Oleg.

0
oleggab (3)
5/25/2007 6:20:08 PM
comp.text.xml 8781 articles. 0 followers. Post Follow

6 Replies
524 Views

Similar Articles

[PageSpeed] 10

Thank you very much for your answer. I didn't realize there were
different XML formats out there... The text file will be somewhat
structured. It will contains entries, each on a separate line. We need
to convert it into an XML format, so the entries can be read into a
database for one of our proprietary tools...

On May 25, 3:53 pm, roy axenov <r_axe...@mail.ru> wrote:
> Oleg wrote:
> > I was wondering if anyone could possibly recommend to me a
> > tool that would take .txt file and convert it to XML
> > format. Thank you very much in advance!
>
> There's a wonderful tool called 'echo'. Used in tandem with
> its trusty sidekick, 'cat', it can convert your text files
> to XML in no time at all:
>
> > cat text.txt
>
> And enterprises of great pith and moment,
>  With this regard, their currents turn awry,
>   And lose the name of action.> echo '<text><\![CDATA[' `cat text.txt` ']]></text>' >
> text.xml
> > xmllint text.xml
>
> <?xml version="1.0"?>
> <text><![CDATA[ And enterprises of great pith and moment,
> With this regard, their currents turn awry, And lose the
> name of action. ]]></text>
>
>
>
> Seriously though, presuming you text file contains some sort
> of structured data, you shouldn't expect a canned tool to
> magically divine that structure and convert it to
> appropriate XML constructs (especially since 'appropriate'
> is rather subjective in this case).
>
> Oh, and XML is not a format per se. In case you meant one of
> the (many) XML formats for representing structured
> texts--such as DocBook--you should've said so.
>
> --
> roy axenov
>
> If only we smelled each other's asses, there wouldn't be any
> war.--Dustin Hoffman


0
oleggab (3)
5/25/2007 9:14:01 PM
Thank you very much for your answer. I didn't realize there were
different XML formats out there... The text file will be somewhat
structured. It will contains entries, each on a separate line. We need
to convert it into an XML format, so the entries can be read into a
database for one of our proprietary tools...

On May 25, 3:53 pm, roy axenov <r_axe...@mail.ru> wrote:
> Oleg wrote:
> > I was wondering if anyone could possibly recommend to me a
> > tool that would take .txt file and convert it to XML
> > format. Thank you very much in advance!
>
> There's a wonderful tool called 'echo'. Used in tandem with
> its trusty sidekick, 'cat', it can convert your text files
> to XML in no time at all:
>
> > cat text.txt
>
> And enterprises of great pith and moment,
>  With this regard, their currents turn awry,
>   And lose the name of action.> echo '<text><\![CDATA[' `cat text.txt` ']]></text>' >
> text.xml
> > xmllint text.xml
>
> <?xml version="1.0"?>
> <text><![CDATA[ And enterprises of great pith and moment,
> With this regard, their currents turn awry, And lose the
> name of action. ]]></text>
>
>
>
> Seriously though, presuming you text file contains some sort
> of structured data, you shouldn't expect a canned tool to
> magically divine that structure and convert it to
> appropriate XML constructs (especially since 'appropriate'
> is rather subjective in this case).
>
> Oh, and XML is not a format per se. In case you meant one of
> the (many) XML formats for representing structured
> texts--such as DocBook--you should've said so.
>
> --
> roy axenov
>
> If only we smelled each other's asses, there wouldn't be any
> war.--Dustin Hoffman


0
oleggab (3)
5/25/2007 9:15:21 PM
Oleg wrote:
> Thank you very much for your answer. I didn't realize there were
> different XML formats out there...

XML is essentially pure syntax. To use XML, you define an XML-based 
language/structure that describes the data.

So the question is which markup you want to generate. Which in your case 
means understanding what text you're starting from, what wants to go 
into the database so your tools can access it, and what intermediate 
representation makes that easiest. Without first considering those, it's 
hard to recommend tools.

If all you want to do is turn lines into records... you should be able 
to import that into your database directly, without having to go through 
XML.



-- 
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
0
5/25/2007 10:02:52 PM
Oleg wrote:
> I was wondering if anyone could possibly recommend to me a
> tool that would take .txt file and convert it to XML
> format. Thank you very much in advance!

There's a wonderful tool called 'echo'. Used in tandem with
its trusty sidekick, 'cat', it can convert your text files
to XML in no time at all:

> cat text.txt
And enterprises of great pith and moment,
 With this regard, their currents turn awry,
  And lose the name of action.
> echo '<text><\![CDATA[' `cat text.txt` ']]></text>' >
text.xml
> xmllint text.xml
<?xml version="1.0"?>
<text><![CDATA[ And enterprises of great pith and moment,
With this regard, their currents turn awry, And lose the
name of action. ]]></text>
>

Seriously though, presuming you text file contains some sort
of structured data, you shouldn't expect a canned tool to
magically divine that structure and convert it to
appropriate XML constructs (especially since 'appropriate'
is rather subjective in this case).

Oh, and XML is not a format per se. In case you meant one of
the (many) XML formats for representing structured
texts--such as DocBook--you should've said so.

-- 
roy axenov

If only we smelled each other's asses, there wouldn't be any
war.--Dustin Hoffman
0
r_axenov (54)
5/25/2007 10:53:58 PM
Oleg wrote:
> Thank you very much for your answer. I didn't realize there were
> different XML formats out there... 

http://xml.silmaril.ie/basics/whatisxml/

> The text file will be somewhat structured. It will contains entries,
> each on a separate line. We need to convert it into an XML format, so
> the entries can be read into a database for one of our proprietary
> tools...

Without knowing what this XML format is, the question is impossible to 
answer.

But generically, if you have a file of lines, a trivial awk or sed 
script can enclose each one in markup, and add a root element to enclose 
the whole thing, eg (in awk)

cat file.txt | awk 'BEGIN {print "<stuff>"} {print "<entry>" $0 
"</entry>"} END {print "</stuff>"}' >file.xml

///Peter
-- 
XML FAQ: http://xml.silmaril.ie/
0
Peter
5/30/2007 11:51:07 PM
Oleg wrote:
> I was wondering if anyone could possibly recommend to me a tool that
> would take .txt file and convert it to XML format. Thank you very much
> in advance!
> 

Taking a wild guess as to what your really want to do ...
http://www.methods.co.nz/asciidoc/


0
scobloke2 (557)
6/14/2007 10:53:30 AM
Reply:

Similar Artilces:

file command: "XML document text" vs "XML document text"
I've just used the file command on four files of RDF-XML with the following output: augtfidf.rdf: XML document text kyoto.rdf: XML document text stuff.rdf: XML document text tfidf.rdf: XML document text What does it mean that one of them has an extra space between "XML" and "document"? -- The kid's a hot prospect. He's got a good head for merchandising, an agent who can take you downtown and one of the best urine samples I've seen in a long time. [Dead Kennedys t-shirt] On 16.10.2012 16:06, Adam Funk ...

Off Topic - Databindings and XML
Dear Group First of all, my apologies for posting here. I tried the MS groups but they're so useless. As some of you work with ASP.NET and XML I wondered if you have come across this and can give me some advice as this group is the only reliable source for an answer. Again, my apologies for posting it here. I wonder if I do something wrong and whether this is possible at all. Any hint is greatly appreciated. I have a XML file bound to a Treeview. The treenodes Text/Value properties bind and populate fine if I set them to an attribute of the XML tag. What I would like to do however is s...

Non-XML tagged value text to XML
I would like to use XSLT to translate some tagged value text to XML elements like this: Input Doc: <data>x=1.234 y=ABC z="Hello World"</data> Output Doc: <x>1.234</value> <y>ABC</y> <z>&quot;Hello World&quot;</z> Is XSLT up to the task? What would it look like? Most of the XSLT string processing code I've seen looks very verbose - can't be too efficient. mikea_59 wrote: > I would like to use XSLT to translate some tagged value text to XML > elements like this: > > Input Doc: > > <data>...

XML to XML conversion
Hello, I vageuly remember a standard that allowed for an XML document using one tag vocabulary to be translated to a diffirent XML document using a diffirent tag vocabulary using the information provided in a kind of dictionary XML pointed to in an URL present in the original XML file. I am very interested in trying it out for various applications, but I can't find anything on the internet about it, since I don't remember it's name, only the general appearance. Can anyone help me with this? What I remember, approximately: The idea is that you have one XML file, in which th...

text to xml conversion #2
Hi Everyone, I am trying to send a XML file via SFTP staying completely in UNIX. The data in the file will vary everytime I create and send it. This is not a simple address book dump. This is what I am trying to do: 1. Access my Unix DataBase 2. Depending on the situation, different data, some of it repeating, gets dumped into a UNIX text file. Because of the potential combinations of required data, I am embedding the corresponding data tags around the individual data items when I am deciding which data should be sent. The data comes from several related DB Files. My first line in my text ...

XML DOM: XML/XHTML inside a text node
In my program, I get input from the user and insert it into an XHTML document. Sometimes, this input will contain XHTML, but since I'm inserting it as a text node, xml.dom.minidom escapes the angle brackets ('<' becomes '&lt;', '>' becomes '&gt;'). I want to be able to override this behavior cleanly. I know I could pipe the input through a SAX parser and create nodes to insert into the tree, but that seems kind of messy. Is there a better way? Thanks. On Thu, 2 Nov 2005 noahlt@gmail.com wrote: > In my program, I get input from the us...

xml wrongly views as text extracted from the xml tags
we have a java framework, where we feed a request xml. this request xml is forwarded through the framework, tomcat and axis, for the backend processing, and the processing results are again received by the internet explorer, after they are transformed with an xslt by the framework. now the problem that we are facing is like - the explorer extracts the text inside all xml tags of the response xml and shows it as simple text. but, if you view the source of the 'text', it will show it all as well-formed xml. moreover, if you save the source as an xml file, and again open it through inte...

XML to XML
I have a gnucash file that I'm trying to transform into an identical XML file without the invoices. I've been at this for a while now. The gnucash file is in XML and the element I'm looking into is: <gnc:transaction> I want to ignore those that contain <slot:key>gncInvoice</slot:key> which is a child of slot which is a child of slots which is a child of transactions. Any help you're willing to provide would be greatly appreciated. Thanks. Classic application for XSLT. Start with the identity transformation, then add a template which matches the ones yo...

text + text
What is "text + text" supposed to do right now? It doesn't seem very useful to me. What about making "text + text" as an equivalent for "text || text"? Most strongly-typed programming languages do this. And MS SQL Server too, I think (CMIIW). -- dave ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org Am Freitag, 8. Oktober 2004 12:57 schrieb David Garamond: > What is "text + text" supposed to do right now? Nothing. > What a...

text-text
Wondering how what I input to my UTF-8 terminal gets passed along through my patched [1] trn ... Cyrillic: А Б В Г Д Е Ж З И Й К Л М Н О П а б в г д е ж з и й к л м н о п IPA: ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ [1] https://groups.google.com/d/msg/comp.sys.raspberry-pi/7Z37Hdrm0DM/6aqD-reXFzAJ ...

XML or not XML?
I am developing a simple MySQL database editor, and am looking into creating an PHP/AJAX app as the GUI. A lot of this in new ground, and much more is dusting off things I haven't used in a while. My question though involves whether or nor to employ XML. I did some XML a few years back, but don't typically bother anymore. As I see it XML is great when I need to have an app with a standard data presentation that other developers can easily interface. I.E. like a bank statement that may feed a variety of applications developed by a variety of clients. However, if I am develo...

To XML or not to XML?
Ok, it has been a while since I've needed to make an involved web page. Coming back on the scene now is a bit confusing, what with all the cool stuff to use like XML, PHP, MySQL, etc... So here is my question. I'm in search of a good dynamic way to generate web pages which separates content from presentation. I am seeking to create a web site that, to put it succinctly, has a list of users and sets of information corresponding to each user. I am familiar with how to do this using PHP, MySQL, and regular old HTML. I maintain the user database in MySQL and dynamically present it and th...

SOAP envelope change from Content-Type: text/xml to text/html
Hello, I'm running PHP 5.2 on gentoo distribution. I'm testing SOAP new extensions, but I'm facing a strange problem... I built a little class and used setClass() and handle() to make PHP handle interconnectivity, but for some ugly reason when I update a public method, the SOAP envelope changed from: HTTP/1.1 200 OK ..=2E. Content-Type: text/xml; charset=3Dutf-8 to: HTTP/1.1 200 OK ..=2E. Content-Type: text/html; charset=3DISO-8859-1 In other words, the Content-Type changed from XML to HTML !! Has anyone hit with this ?? Thanks, Sebasti=E1n Araya Sebastian Araya wr...

OT: Text editors (was Re: Search and replace text in XML file?)
On Sat, Jul 28, 2012 at 6:29 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote: > I highly recommend the use of notepad++. If anyone knows of a better text > editor for Windows please let me know :) My current preference is SciTE, available on Linux and Windows both. It's configured using Lua, has lexers (and thus syntax highlighters and auto-indenters) for a huge list of languages (including Python, or I wouldn't mention it), and isn't RAM-hungry. It's not bug-free (but what isn't), and has a few limitations (eg it only really supports UTF-8), but I&...

Web resources about - Text to XML conversion - comp.text.xml

Conversion (law) - Wikipedia, the free encyclopedia
Its criminal counterpart is theft . Examples are seen in cases where trees are cut down and the lumber hauled from the land by someone not having ...

Nintendo alters ‘gay conversion’ scene in new video scene
NINTENDO has altered a controversial “gay conversion” scene from a video game that’s already been released in Japan.

Zero tolerance: Andrews to crack down on gay 'conversion' therapy
The state government will attempt to crack down on so-called gay conversion therapy through a new public watchdog with the power to investigate ...

Emphasis Shifts to Conversions Over Clicks for Facebook Advertisers in Q4 2015
... with the lowest eCPC among all ad types and high CTRs. The opposite was true for link ads , however, due to advertisers’ emphasis on conversions ...

Ex-gay conversion therapists flee US, find home in Israel
Ex-gay conversion “therapy” is in retreat throughout much of the United States. Not only is momentum building to ban it on a state -by- state ...

Nintendo removes controversial “gay conversion” scene in Fire Emblem: Fates
Nintendo has altered a controversial scene for the western version of Fire Emblem: Fates , a 3DS RPG originally released in Japan last year. ...

Doro PDF printer adds color conversion, page rotation controls
Lightweight virtual PDF printer Doro has been updated with new color conversion and page rotation settings. If the default "UseDeviceIndependentColor" ...

5 Crystal Clear Translation Services That Will Boost WordPress Site Conversions
... scale. A big competitor in India or London could be targeting your local audience in Los Angeles. How Can You Increase eCommerce Conversions ...

Andrew Cuomo announces regulations to prevent gay 'conversion therapy' - CNNPolitics.com
New York Gov. Andrew Cuomo on Saturday announced regulations to prevent "conversion therapy," a practice aimed at changing an individual's sexual ...

How Important Is Site Performance For Traffic And Conversions?
When it comes to on-site factors for SEO, content marketing, and other inbound strategies, most people pay attention to structural elements and ...

Resources last updated: 2/11/2016 5:50:15 PM