Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9274 > unrolled thread

Extract XLM data from in Mathematica

Started byMurta <rodrigomurtax@gmail.com>
First post2012-03-29 08:03 +0000
Last post2012-04-07 09:56 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Extract XLM data from in Mathematica Murta <rodrigomurtax@gmail.com> - 2012-03-29 08:03 +0000
    Re: Extract XLM data from in Mathematica Chris Degnen <degnen@cwgsy.net> - 2012-03-30 09:31 +0000
      Re: Extract XLM data from in Mathematica Murta <rodrigomurtax@gmail.com> - 2012-04-06 09:58 +0000
        Re: Extract XLM data from in Mathematica A Retey <awnl@gmx-topmail.de> - 2012-04-07 09:56 +0000

#9274 — Extract XLM data from in Mathematica

FromMurta <rodrigomurtax@gmail.com>
Date2012-03-29 08:03 +0000
SubjectExtract XLM data from in Mathematica
Message-ID<jl150v$lcf$1@smc.vnet.net>
Hi All

    I was trying to extract some data from a XML using Mathematica and
I discovered that it's terribly complicated, with a lot of pattern
inside pattern.
    I was using this reference to guide me:
    http://reference.wolfram.com/mathematica/XML/tutorial/TransformingXML.html
    There is some package to make life easier?

tks in advance
Murta

[toc] | [next] | [standalone]


#9319

FromChris Degnen <degnen@cwgsy.net>
Date2012-03-30 09:31 +0000
Message-ID<jl3uhv$3f1$1@smc.vnet.net>
In reply to#9274
It looks more complicated than it is.  I was able to do
everything I needed with just two commands.  E.g.

retrievedXML = ImportString[XMLdataRecord, "XML",
   "NormalizeWhitespace" -> False];

{numbers} = Cases[retrievedXML,
    XMLElement["telephonenumbers", _, _],
    Infinity] /. XMLElement[_, _, {val_}] :> val;


On Thursday, March 29, 2012 9:03:43 AM UTC+1, Murta wrote:
> Hi All
> 
>     I was trying to extract some data from a XML using Mathematica and
> I discovered that it's terribly complicated, with a lot of pattern
> inside pattern.
>     I was using this reference to guide me:
>     http://reference.wolfram.com/mathematica/XML/tutorial/TransformingXML.html
>     There is some package to make life easier?
> 
> tks in advance
> Murta

[toc] | [prev] | [next] | [standalone]


#9487

FromMurta <rodrigomurtax@gmail.com>
Date2012-04-06 09:58 +0000
Message-ID<jlmene$mdp$1@smc.vnet.net>
In reply to#9319
On Mar 30, 6:31 am, Chris Degnen <deg...@cwgsy.net> wrote:
> It looks more complicated than it is.  I was able to do
> everything I needed with just two commands.  E.g.
>
> retrievedXML = ImportString[XMLdataRecord, "XML",
>    "NormalizeWhitespace" -> False];
>
> {numbers} = Cases[retrievedXML,
>     XMLElement["telephonenumbers", _, _],
>     Infinity] /. XMLElement[_, _, {val_}] :> val;
>
>
>
>
>
>
>
> On Thursday, March 29, 2012 9:03:43 AM UTC+1, Murta wrote:
> > Hi All
>
> >     I was trying to extract some data from a XML using Mathematica and
> > I discovered that it's terribly complicated, with a lot of pattern
> > inside pattern.
> >     I was using this reference to guide me:
> >    http://reference.wolfram.com/mathematica/XML/tutorial/TransformingXML...
> >     There is some package to make life easier?
>
> > tks in advance
> > Murta
Tks for your answer Chris, but for deeper level XML the notations get
cryptcal and unreadable.
I get some tips in Mathematica Cookbook XML part (page 212 from
printed version).
One simple one that I liked was this:

cleanedXML = Apply[List,dataXML,{0,Infinity}]

It make the XML much more clean to read.

best Regards
Murta

[toc] | [prev] | [next] | [standalone]


#9494

FromA Retey <awnl@gmx-topmail.de>
Date2012-04-07 09:56 +0000
Message-ID<jlp2vj$132$1@smc.vnet.net>
In reply to#9487
Hi,

> Tks for your answer Chris, but for deeper level XML the notations get
> cryptcal and unreadable.
> I get some tips in Mathematica Cookbook XML part (page 212 from
> printed version).
> One simple one that I liked was this:
>
> cleanedXML = Apply[List,dataXML,{0,Infinity}]
>
> It make the XML much more clean to read.

while the result might be easier to read, it might also be more 
difficult to work with. I think when you actually want to extract data 
by pattern matching, the original form will be much more useful. 
Problably the problem is with XML in the first place: XML _is_ a verbose 
format...

just my 2 cents

albert

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web