Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Thursday, January 18, 2018

Python script to parse attribute names of XML file

------------------------------------------------------------------------------------

import xml.etree.ElementTree as ET
import csv

tree = ET.parse("ResidentData.xml")
root = tree.getroot()

# open a file for writing

Resident_data = open('/tmp/ResidentData.csv', 'w')

# create the csv writer object

csvwriter = csv.writer(Resident_data)
resident_head = []

count = 0
for member in root.findall('Resident'):
resident = []

name = member.get('name_value')
resident.append(name)
csvwriter.writerow(resident)

Resident_data.close()




______________________________________________________________________________________
XML
_________________________________________________________________

<State>
<Resident Id="100">
<Name name_value="Name123">Sample Name</Name>
<PhoneNumber name_value="Phone123">1234567891</PhoneNumber>
<EmailAddress name_value="Email123">sample_name@example.com</EmailAddress>

</Resident>
<Resident Id="101">
<Name name_value="12name1234">Sample Name1</Name>
<PhoneNumber name_value="12Phone1234">1234567891</PhoneNumber>
<EmailAddress name_value="12Email1234">sample_name1@example.com</EmailAddress>

</Resident>
</State>



________________________________________________________________________________
Sample Output
________________________________________________________________________________

Name123
12name1234



Reference:

https://docs.python.org/2/library/xml.etree.elementtree.html

http://blog.appliedinformaticsinc.com/how-to-parse-and-convert-xml-to-csv-using-python/

Monday, February 1, 2016

Custom ADF Skinning

       
<!-- trinidad-config.xml-->
     <?xml version="1.0" encoding="windows-1252"?>
      <trinidad-config xmlns="http://myfaces.apache.org/trinidad/config"> 
       <skin-family>CustomSkin</skin-family>
      </trinidad-config>  
 
       
<!-- trinidad-skins.xml (create this file in the same parent folder as trinidad-config.xml)-->
       <?xml version="1.0" encoding="windows-1252"?>
<skins xmlns="http://myfaces.apache.org/trinidad/skin">
    <skin>
        <id>Custom.desktop</id>
        <family>Custom</family>
        <extends>skyros-v1.desktop</extends>
        <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
        <style-sheet-name>skins/Custom/Custom.css</style-sheet-name>
        <bundle-name>com.fm.demoapp.view.skinBundle</bundle-name>
    </skin>
    <skin>
        <id>CustomSkin.desktop</id>
        <family>CustomSkin</family>
        <extends>alta-v1.desktop</extends>
        <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
        <style-sheet-name>resources/Skins/CustomSkin.css</style-sheet-name> <!--create css file and specify the folder path-->
          <bundle-name>com.fm.demoapp.view.skinBundle</bundle-name> <!--create skinBundle.properties in the package defined-->

    </skin>
</skins>
 
Oracle Fusion Middleware Tag Reference for Oracle ADF Faces Skin Selectors 

Update (web.xml) this context-param to true (make sure you change it back to false...before deploying the app to production environment); this reflects the changes made in 'css' without being to redeploy the ear again

 <context-param>
        <description>If this parameter is true, there will be an automatic check of the modification date of your JSPs,
                     and saved state will be discarded when JSP's change. It will also automatically check if your
                     skinning css files have changed without you having to restart the server. This makes development
                     easier, but adds overhead. For this reason this parameter should be set to false when your
                     application is deployed.</description>
        <param-name>org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION</param-name>
        <param-value>true</param-value> <!--by default it's false-->
    </context-param>