I am trying to make script to parse the install.rdf files found in firefox xpi extentions to isolate the extention ID so I can name a directory and automate installation of system-wide extension.
I am very facile with the command line, but not with programming languages (esp object-oriented ones). I have been working on learning python.
I would like to use minidom from xml.dom.
Here are two examples of different formats of install.rdf files:
The first code above has em:id as a tag.
I have discovered that if one parses it:
It will spit out the id. However, I need to automate this and spit out the em:id for the element which also contains the em:name element.
I need help in figuring out how to iterate through this and testing if that node (if that is the right terminology) also contains the em:name tag as that is the em:id that I need (you may notice there is more than one em:id tag)
One the second code section above, it is stranger, as em:id doesn't seem to be in a normal tag and getElementsByTagName doesn't work, let alone the childNodes.data methods.
How does one access the element (if that is what it is called in the rendition) in the second code? It also needs to iterate and test to see if that section has the em:name tag?
I know this is a big complex, but I am stuck. I've not found any tutorials at all for the second code formating.
Adding to the problem, I need to know how to tell the two formats apart to start the parsing. Ideas for that, too?
Your help is greatly appreciated (as is being pointed to where I can also learn more about this).
I have an xml file where the format looks like below
<SESSIONCOMPONENT REFOBJECTNAME ="pre_session_command" REUSABLE ="NO" TYPE ="Pre-session command">
<TASK DESCRIPTION ="" NAME ="pre_session_command" REUSABLE ="NO" TYPE ="Command" VERSIONNUMBER ="1">
... (8 Replies)
HI
I want to parse below file in to two output :-
Input :-
?xml version="1.0" encoding="UTF-8"?>
<bulkCmConfigDataFile xmlns:un="utranNrm.xsd"
<configData dnPrefix="Undefined">
<xn:SubNetwork id="ONRM_ROOT_MO_R">
<xn:MeContext id="C136">
... (3 Replies)
I am trying to parse the XML Google contact file using tools like xmllint and I even dived into the XSL Style Sheets using xsltproc but I get nowhere.
I can not supply any sample file as it contains private data but you can download your own contacts using this script:
#!/bin/sh
# imports... (9 Replies)
Hi there!
I'd like to parse and compare 2 XML files with the minidom parser as follows:
I have 2 XML files with loads of data. One is in English (the source file), the other one the corresponding French translation (the target file).
E.g.:
source file:
<macro>
<id> 123</id>
... (0 Replies)
I am trying to parse an xml file and trying to grab certain values and inserting them into database table. I have the following xml that I am parsing:
<dd:service name="locator" link="false">
<dd:activation mode="manual" />
<dd:run mode="direct_persistent" proxified="false" managed="true"... (7 Replies)
I had a big XML and from which I have to make a layout as below
*TOTAL+CB | *CB+FX | CS |*IR | *TOTAL |
--------------------------------------------------------------------------------------------------
|CB FX | | | |
DMFXNY EMSGFX... (6 Replies)
Hello,
I am writing a python code. The output of the python code needs a little bit of parsing. From the output of python code, which has a lot of redundant data, I need to cut only those words or numbers which end with &. for example: if the output is--
"This is an example of tgbn123& what i... (0 Replies)
Hi,
I've a python script called aaa.py and passing an command line option " -a" to the script like, ./aaa.py -a
& Inside the script if the -a option is given I do some operation if not something else.
code looks like
./aaa.py -a
.
.
if options.a
---some operation---
if not options.a... (1 Reply)
Hi
I want to take an XML file and transform it into a pipe-delimited format. What is the best tool to use for this? I have libxml2 which seems to be the best xml parser around.
The xml file will have the following format.
<Txn>
<Date>120504</Date>
<id>99</id>
<Items>
<Item>... (1 Reply)