Is there anything offered in Centos that might convert an XML file to a plain text file?
My hopes are that it is flexible enough to make the following type of line:
<title>Guide</title>
into something like:
title: Guide
along with all the other fields. It'd be nice if it could handle multiple lines inside a single tag line as well.
thanks
steve campbell
Steve,
Its pretty easy to do with XSLT...
On Thu, 7 Nov 2013, Steve Campbell wrote:
Is there anything offered in Centos that might convert an XML file to a plain text file?
My hopes are that it is flexible enough to make the following type of line:
<title>Guide</title>
into something like:
title: Guide
along with all the other fields. It'd be nice if it could handle multiple lines inside a single tag line as well.
thanks
steve campbell _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Scot P. Floess RHCT (Certificate Number 605010084735240) Chief Architect FlossWare http://sourceforge.net/projects/flossware http://flossware.sourceforge.net https://github.com/organizations/FlossWare
On Thu, 7 Nov 2013, Scot P. Floess wrote:
Steve,
Its pretty easy to do with XSLT...
For some definition of "easy," of course... :-)
Still, I'd agree that XSLT is probably your best bet for a long-term solution (as opposed to a simplistic regex match via a scripting language) because it allows you great future flexibility.
On Thu, Nov 7, 2013 at 4:17 PM, Paul Heinlein heinlein@madboa.com wrote:
Steve,
Its pretty easy to do with XSLT...
For some definition of "easy," of course... :-)
Still, I'd agree that XSLT is probably your best bet for a long-term solution (as opposed to a simplistic regex match via a scripting language) because it allows you great future flexibility.
Or perl with XML::Twig which gives you a full featured parser and complete control of what you do with the parsed value. If you lean more towards the java way of doing things than perl, you could use groovy for fairly painless scripting with fairly complete xml handling tools.
<SNIP> Or, the point for the OP is, try googling for an answer before posting.... Do some of the heavy lifting yourself.
mark
On Thu, Nov 7, 2013 at 4:53 PM, m.roth@5-cent.us wrote:
<SNIP> Or, the point for the OP is, try googling for an answer before posting.... Do some of the heavy lifting yourself.
You can't really blame someone for thinking there _must_ be an easier way to deal with things that are clearly text than the stuff you have to do with XML, can you? Searching google isn't going to make it less painful unless you find a complete program that already does the exact thing you are trying to do. Otherwise you are going to have to learn way more than you ever wanted to know about elements, attributes, nodes, paths and the like.
Thanks for all the answers. And thanks to Les for understanding the exact problem. I had Googled before asking. And yes, I found tons of info, even started the W3W tutorial. I'm new to XML and it's conversions.
My question was: is there anything already in Centos that handles the conversion. Not a specific solution, but the name of a package that would include what I needed to do this for me. Google doesn't always respond with Centos-specific answers, which is which I posted to this, the Centos, list.
I'll try and be more specific from now on so I don't ruffle feathers. Not sure what this list is for I guess.
steve campbell
On 11/7/2013 6:00 PM, Les Mikesell wrote:
On Thu, Nov 7, 2013 at 4:53 PM, m.roth@5-cent.us wrote:
<SNIP> Or, the point for the OP is, try googling for an answer before posting.... Do some of the heavy lifting yourself.
You can't really blame someone for thinking there _must_ be an easier way to deal with things that are clearly text than the stuff you have to do with XML, can you? Searching google isn't going to make it less painful unless you find a complete program that already does the exact thing you are trying to do. Otherwise you are going to have to learn way more than you ever wanted to know about elements, attributes, nodes, paths and the like.
On Mon, Nov 11, 2013 at 6:16 AM, Steve Campbell campbell@cnpapers.com wrote:
Thanks for all the answers. And thanks to Les for understanding the exact problem. I had Googled before asking. And yes, I found tons of info, even started the W3W tutorial. I'm new to XML and it's conversions.
My question was: is there anything already in Centos that handles the conversion.
XML is just a syntax for computer parsers - there are no standards for what the tags mean or what to do with content. You would need something specific to the program that generates the file (which I don't think you mentioned). Or you need to use a parser as already suggested for your favorite programming language to do something with the content after extraction.
Not a specific solution, but the name of a package that would include what I needed to do this for me. Google doesn't always respond with Centos-specific answers, which is which I posted to this, the Centos, list.
I'll try and be more specific from now on so I don't ruffle feathers. Not sure what this list is for I guess.
The list is 'supposed' to be for things unique to Centos - which, since it is essentially identical to RHEL should theoretically be very little. But, questions about the Red Hat way of doing things are generally tolerated, as well as many off-topic things that have simple answers. This probably isn't the place for long discussions of general programming problems or the choices made by upstream developers, although sometimes those are interesting and affect you as a Centos user.
Steve Campbell wrote:
Is there anything offered in Centos that might convert an XML file to a plain text file?
My hopes are that it is flexible enough to make the following type of line:
<title>Guide</title>
into something like:
title: Guide
along with all the other fields. It'd be nice if it could handle multiple lines inside a single tag line as well.
google: perl XML to text
Hit #4: http://www.perlmonks.org/bare/?node_id=425049
mark