Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Viewing XML

Reply
Thread Tools

Viewing XML

 
 
MartinC
Guest
Posts: n/a
 
      12-12-2006
I am no expert on the subject but some of my translation work is being
saved as XML files by a dotnet ap. Now I would like to just "read" the
text. Is there a way to turn XML automagically into something readable?
Like:
===============================
<?xml version="1.0" encoding="utf-8"?>
<!--export-->
<editionyear="2007">
<film id="11">
<!--Bled Number One-->
<originalarticle />
<originaltitle>Bled Number One</originaltitle>
<englisharticle />
<englishtitle />
<useenglishtitle>False</useenglishtitle>
<premiere>Geen</premiere>
<productioncountry>Algeria, France</productioncountry>
<productionyear>2006</productionyear>
<color>Kleur</color>
<format>35mm</format>
<screenratio>-</screenratio>
<lengthinminutes>100</lengthinminutes>
<credits>
<director>Ameur-Zaïmeche, Rabah</director>
<producers />
<sales>Les Films du Losange</sales>
<distributors>A-Film Distribution</distributors>
<scenario>Rabah Ameur-Zaïmeche, Louise Thermes</scenario>
<photography>Lionel Sautier, Olivier Smittarello, Hakim Si
Ahmed</photography>
<editor>Nicolas Bancilhon</editor>
<artdesign />
<sound>Timothee Alazraki, Bruno Auzet, Mohamed Naman</sound>
<music>Rodolphe Burger</music>
<other />
<cast>Rabah Ameur-Zaïmeche, Meriem Serbah, Abel Jafri, Farida
Ouchani, Ramzy Bedia</cast>
</credits>
<synopsis>
<short language="dutch" length="252">
<p>Fictie als een documentaire jamsessie. De filmmaker speelt
zelf de hoofdrol van een crimineel die Frankrijk is uitgezet en terug
moet naar zijn dorp in Algerije dat hij niet voor niets ooit heeft
verlaten. Improviserend en met muzikaal gevoel gefilmd. </p>
</short>
===============================
into:
===============================
Bled Number One
Algeria, France
2006
Color
35mm
100
Ameur-Zaïmeche, Rabah
Les Films du Losange
A-Film Distribution
Rabah Ameur-Zaïmeche, Louise Thermes
Lionel Sautier, Olivier Smittarello, Hakim Si Ahmed
Nicolas Bancilhon
Timothee Alazraki, Bruno Auzet, Mohamed Naman
Rodolphe Burger
Rabah Ameur-Zaïmeche, Meriem Serbah, Abel Jafri, Farida Ouchani,
Ramzy Bedia
Fictie als een documentaire jamsessie. De filmmaker speelt zelf de
hoofdrol van een crimineel die Frankrijk is uitgezet en terug moet naar
zijn dorp in Algerije dat hij niet voor niets ooit heeft verlaten.
Improviserend en met muzikaal gevoel gefilmd.
===============================

Rgds

Martin

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      12-12-2006
MartinC wrote:
> I am no expert on the subject but some of my translation work is being
> saved as XML files by a dotnet ap. Now I would like to just "read" the
> text. Is there a way to turn XML automagically into something readable?


Yes, but.

The problem is that XML is not a single language. It's a basic syntax,
with many different languages layered on top of it. An automatic
conversion needs to understand which language you're working in, and how
it expresses what kinds of information.

There are certainly tools such as XSLT which can be used to render XML
into forms which are easier for humans to read, for example by producing
HTML from it. But to use those tools, you need to be able to describe to
them what the current structure of the XML is and how you want to map
that to the displayable version. Essentially, you're writing a program
to automate this conversion, though you're doing so in a language
designed for the purpose.

So you can get automatic rendering -- but only after someone automates
it for you. Contact whoever wrote the application you're working with,
and ask them how to obtain a rendered version of the information. Or
learn to write your own stylesheets. Or settle for reading the XML,
which *is* human-readable even when it isn't particularly human-friendly.


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
 
 
 
p.lepin@ctncorp.com
Guest
Posts: n/a
 
      12-12-2006

MartinC wrote:
> I am no expert on the subject but some of my translation
> work is being saved as XML files by a dotnet ap.


> [byte order mark removed]


Duh.

> <?xml version="1.0" encoding="utf-8"?>
> <!--export-->
> <editionyear="2007">


That's not XML.

> <film id="11">
> <!--Bled Number One-->
> <originalarticle />
> <originaltitle>Bled Number One</originaltitle>
> <englisharticle />
> <englishtitle />
> <useenglishtitle>False</useenglishtitle>
> <premiere>Geen</premiere>
> <productioncountry>Algeria,
> France</productioncountry>
> <productionyear>2006</productionyear>
> <color>Kleur</color>
> <format>35mm</format>
> <screenratio>-</screenratio>
> <lengthinminutes>100</lengthinminutes>
> <credits>
> <director>Ameur-Zameche, Rabah</director>
> <producers />
> <sales>Les Films du Losange</sales>
> <distributors>A-Film Distribution</distributors>
> <scenario>Rabah Ameur-Zameche, Louise
> Thermes</scenario>
> <photography>Lionel Sautier, Olivier Smittarello,
> Hakim Si
> Ahmed</photography>
> <editor>Nicolas Bancilhon</editor>
> <artdesign />
> <sound>Timothee Alazraki, Bruno Auzet, Mohamed
> Naman</sound>
> <music>Rodolphe Burger</music>
> <other />
> <cast>Rabah Ameur-Zameche, Meriem Serbah, Abel
> Jafri, Farida
> Ouchani, Ramzy Bedia</cast>
> </credits>
> <synopsis>
> <short language="dutch" length="252">
> <p>Fictie als een documentaire jamsessie. De
> filmmaker speelt
> zelf de hoofdrol van een crimineel die Frankrijk is
> uitgezet en terug
> moet naar zijn dorp in Algerije dat hij niet voor niets
> ooit heeft
> verlaten. Improviserend en met muzikaal gevoel gefilmd.
> </p>
> </short>


You just saved a few bytes of bandwidth and a few seconds
of your time by omitting the closing tags. By doing that,
you've also wasted several seconds of time for every person
who decided to try and help you. That's not very kind of
you. Not very smart, either.

> Now I would like to just "read" the text. Is there a way
> to turn XML automagically into something readable?


Not reliably. The default transformation does something
close to what you seem to be wanting:

<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="text"/>
</xsl:stylesheet>

Stuff into default.xsl or somesuch, then add the following
processing instruction:

<?xml-stylesheet type="text/xsl" href="default.xsl"?>

after the XML declaration in your XML file.

If that isn't what you really need, ask your resident XML
expert to create a transformation for you.

--
Pavel Lepin

 
Reply With Quote
 
Juergen Kahrs
Guest
Posts: n/a
 
      12-12-2006
MartinC wrote:

> I am no expert on the subject but some of my translation work is being
> saved as XML files by a dotnet ap. Now I would like to just "read" the
> text. Is there a way to turn XML automagically into something readable?
> Like:
> ===============================
> <?xml version="1.0" encoding="utf-8"?>
> <!--export-->
> <editionyear="2007">


First you have to correct this line to

<edition year="2007">

Then you can use a parser to verify well-formedness

xmllint --noout file.xml

> Bled Number One
> Algeria, France
> 2006
> Color
> 35mm


Looks like you want some parts of the XML file to be
displayed and others to be ignored. I usually do such
kind of processing with xgawk. For example this script

http://home.vrweb.de/~juergen.kahrs/...character-sets

@load xml
XMLCHARDATA { printf $0 }

will print all character data (text) and ignore comments
and attributes. Maybe this helps you.
 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      12-13-2006
MartinC wrote:
> I am no expert on the subject but some of my translation work is being
> saved as XML files by a dotnet ap. Now I would like to just "read" the
> text. Is there a way to turn XML automagically into something readable?


No, not automatically, unless someone has done it before for this type
of file and is prepared to let you have their code. XML documents
typically contain no information about how the text is to be used
(displayed, typeset, spoken, etc). You have to specify (in some
transformation language, eg XSLT) how each element is to be represented.
This isn't difficult, but it does mean learning how to do it, or
employing someone who does.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
viewing xml SilentCry ASP .Net 2 04-16-2009 03:09 PM
Viewing one XML using multiple XSL files Toby Newman XML 13 01-29-2007 10:25 AM
Viewing xml as SVG via XSLT directly shaun XML 2 05-18-2006 06:47 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
PC Viewing vs DVD Player Viewing - MP3 play very fast Ray Donzdorf Computer Support 0 12-11-2004 01:07 PM



Advertisments