Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Merging XML

by mirod (Canon)
on Nov 27, 2001 at 22:21 UTC ( [id://127855]=note: print w/replies, xml ) Need Help??


in reply to Merging XML

You only show one file! Could you give examples of the 2 files and how you would like to merge them?

If you don't want to use modules based on XML::Parser (would you care to explain why BTW?) you can use XML::SAX::PurePerl or XML::libXML or maybe even XML::Parser::Lite. In any case please, for your own sake, use a parser, not regular expressions!

Replies are listed 'Best First'.
Re: Re: Merging XML
by artist (Parson) on Nov 27, 2001 at 22:55 UTC
    As I said, the structure of the other file is same..
    Here is another file anyway
    <A id="a1"> <B id="b2"> <C id="c1"> <D>d1</D> <D>d2</D> </C> <C id="c2"> <D>d3</D> </C> </B> <B id="b3"> <C id="c1"> <D>d1</D> <D>d2</D> </C> <C id="c2"> <D>d3</D> </C> </B> </A> <A id="a2"> <B id="b4"> <C id="c1"> <D>d1</D> <D>d2</D> </C> <C id="c2"> <D>d3</D> </C> </B> <B id="b5"> <C id="c1"> <D>d1</D> <D>d2</D> </C> <C id="c2"> <D>d3</D> </C> </B> </A>
    Where I would look for libxml? on my system..
    I have hard time installing XML::Parser on my system mainly due to expat.
    I would appriciate, if someone can put steps to install XML::Parser locally with 'exact' example.
    Thanks, Artist

      Now we have 2 files, but I still have no idea what the resulting "merged" file should look like. It could be:

      <Z><A id="a1">...</A><A id="a2">...</A></Z>

      which would be quite easy to do, you don't even need Perl for this, but it could also be a file where only D elements are added according to conditions on various tags/attributes...

      What system are you trying to install XML::Parser on? Versions up to 2.29 include expat, so all you need is a C compiler, gcc works fine, to install the module. The only problem you can find is that it can collide with the static install of expat done by Apache. So version 2.30 comes without expat, which you have to install (you can find expat on sourceforge here).

        Ok, I am trying to install XML::Parser once again.. Help me out..
        I would like to install it in ~/lib directory, where I put all my local modules.
        First question is what I should put for makefile.
        perl Makefile.PL ????

        Thanks,
        Artist
        I need perl for the same as this is going to be automatic.
        I successfully installed XML::Parser using PREFIX=~
        When I am trying to install other modules, it looks for @INC as defined by the system and cannot find the modules I just installed. How do I change that..
        Thanks..
        Artist

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://127855]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found