lundi 29 juin 2015

Why does the android studios layout preview look different

When i first create an android studio project, there should be a pre made layout preview in the activity_main.xml, but i only see a grey screen with the words 'Hello World'.

Here is what it looks like...enter image description here

but it should look like this...

enter image description here

How do i fix this? I tried restarting my computer and pressing reload in android studios, but nothing is working. Does anyone have any ideas?

Extract Root Elements Name attribute from XSD using XSL

I need to extract root element name attribute my input is as below

<?xml version = '1.0' encoding = 'UTF-8'?>
    <xsd:schema xmlns:xsd="http://ift.tt/tphNwY" elementFormDefault="qualified" xmlns:nxsd="http://ift.tt/L8WCuC"    nxsd:encoding="US-ASCII">
        <xsd:element name="car">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="wheel" type="xsd:string" />
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
        <xsd:annotation>
            <xsd:appinfo>NXSDSAMPLE=</xsd:appinfo>
            <xsd:appinfo>USEHEADER=false</xsd:appinfo>
        </xsd:annotation>
    </xsd:schema>

The XSL looks like below

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://ift.tt/tCZ8VR" version="2.0">
    <xsl:template match="/*/*[local-name()='element']">
        <xsl:value-of select="@name"></xsl:value-of>
    </xsl:template>
</xsl:stylesheet>

The required output is only "car" but the transformation is generating

      NXSDSAMPLE=
      USEHEADER=false
car

My program looks like below

 Document document;
  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  StringWriter sw = new StringWriter();
  File rootNameStyleSheet = new File("RootElementNameExtractor.xsl");
  File datafile = new File("cf1.xsd");
  try {
      DocumentBuilder builder = factory.newDocumentBuilder();
      document = builder.parse(datafile);
      TransformerFactory tFactory = TransformerFactory.newInstance();
      StreamSource stylesource = new StreamSource(rootNameStyleSheet);
      Transformer transformer = tFactory.newTransformer(stylesource);
      transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
      transformer.setOutputProperty(OutputKeys.INDENT, indent);
      DOMSource source = new DOMSource(document);
      StreamResult result = new StreamResult(sw);
      transformer.transform(source, result);
}

Any inputs on what is wrong with XSL would be helpful

how to handle errors while reading xml files R

I have a list of multiple xml files which have the same structure. Some of them have structural errors in them so they can't be read, i'm not capable of controlling them manually because there are too many files. I know that i need to imply the try or trycatch functions, i tried to understand them but i'm not understanding how to use them proberly on my case. To make the example easy i just want to transform them all into a csv.

library(XML)
k <- 1
Initial.files<- list.files("/My/Initial/Folder")
for(i in initial.files){
data<-dataTable(xmlToDataFrame(xmlParse(i)))
write.csv(data, file = paste("data",(k)".csv"))
k <- k+1
}

The error i get usually looks like:

Start tag expected, '<' not found
Error in xmlToDataFrame(xmlParse(i)) :
error in evaluation the argument 'doc' in selecting a method for function 'xmlToDataFrame': Error 1: Start tag expected, '<' not found

To handle my problem i have to rewrite my 5th line of code(i know that it is wrong):

data<- if(try(dataTable(xmlToDataFrame(xmlParse(i)))!= "try-error")
else{ haven't looked close to this because i didn't got that far...}...

I would like it to read the files and give me a list of the files path which didn't work to be read.

XML Parsing in OS X Terminal for MobileConfig file

I am working on generating (actually editing) a mobileconfig file (aka iOS profile, XML) via bash script.

The script fetch data from a MS Database and has now to inject/replace this data in my mobileconfig file (XML).

The XML file has the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://ift.tt/vvUEPL">
<plist version="1.0">
<dict>
    <key>PayloadContent</key>
    <array>
        <dict>
            <key>Host</key>
            <string>outlook.office365.com</string>
            <key>MailNumberOfPastDaysToSync</key>
            <integer>7</integer>
            <key>Password</key>
            <string>ActiveSyncPassword</string>
            <key>PayloadDescription</key>
            <string>Configures an Exchange account</string>
            <key>PayloadDisplayName</key>
            <string>Exchange ActiveSync</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
            <key>SSL</key>
            <true/>
            <key>UserName</key>
            <string>xxxxxxx@xxx.com</string>
            <key>disableMailRecentsSyncing</key>
            <false/>
        </dict>
        <dict>
            <key>AutoJoin</key>
            <true/>
            <key>EncryptionType</key>
            <string>WPA</string>
            <key>HIDDEN_NETWORK</key>
            <true/>
            <key>IsHotspot</key>
            <false/>
            <key>Password</key>
            <string>WEPWPAWPSPEAPTLS</string>
            <key>PayloadType</key>
            <string>com.apple.wifi.managed</string>
            <key>PayloadVersion</key>
            <real>1</real>
            <key>ProxyType</key>
            <string>None</string>
            <key>SSID_STR</key>
            <string>SSID</string>
        </dict>
        <dict>

I would like to replace the WiFi Password but also ActiveSync "Password" fields between the < string> < /string> using any native (xmllint, sed) or non-native tool.

Can anyone please help ?

How to handle xml missing ns in Java SOAP WS

I'm writing a Java SOAP web service that works as follows: I'm receiving messages from 2 clients. The difference between them two is in the body of a specific field where there is a ns tag. I have implemented the web service using wsimport from a WSDL.

Client 1:

<soapenv:Envelope...>
...
    <ns9:StackOverFlow xmlns:ns9="...example...">
        ...
    </ns9:StackOverFlow>
... 
</soapenv:Envelope>

Client 2:

<soapenv:Envelope...>
...
    <StackOverFlow xmlns="...example...">
        ...
    </StackOverFlow>
... 
</soapenv:Envelope>

client1 works fine, but in client2 there is a field, StackOverFlow for example, that always converts to null in my Java web service. After debugging and looking into it, I have figured out it is because the missing ns.

Is there a way to support those 2 clients without asking them to change the xml they are sending me?

How to recognize 0 and null value in nillable element

I have xsd:

<xs:complexType name="RobZmenObyvateleDataType">
    <xs:annotation>
        <xs:documentation xml:lang="cs">Oprava referenčních údajů fyzické osoby v ROB.
        </xs:documentation>
    </xs:annotation>
    <xs:sequence>
        <xs:element name="AdresaPobytu" type="rob:AdresaPobytuStavType" minOccurs="0" nillable="true" />
    </xs:sequence>
</xs:complexType>

<xs:complexType name="AdresaPobytuStavType">
    <xs:annotation>
        <xs:documentation xml:lang="cs">Adresa místa pobytu v ČR včetně stavu a času poslední změny.
        </xs:documentation>
    </xs:annotation>
    <xs:simpleContent>
        <xs:extension base="AdresaPobytuType">
            <xs:attribute name="stav" type="xs:string" />
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="KodAdresniMistoType">
    <xs:annotation>
        <xs:documentation xml:lang="cs">Identifikátor adresního místa v RUAIN.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:int">
        <xs:minExclusive value="-10"/>
        <xs:maxExclusive value="999999999"/>
    </xs:restriction>
</xs:simpleType>

this generate class:

public class AdresaPobytuStavType
    implements Serializable
{

    @XmlValue
    protected int value;
    @XmlAttribute(name = "stav")
    protected String stav;

}

You can see value is int and not Integer. So I add binding to cast it to Integer because I need to recognize null value:

<jaxb:bindings schemaLocation="../MyXsd.xsd">
    <jaxb:bindings node="//xs:simpleType[@name='KodAdresniMistoType']">
        <jaxb:javaType name="java.lang.Integer" />
    </jaxb:bindings>
</jaxb:bindings>

so now It look good:

@XmlValue
@XmlJavaTypeAdapter(Adapter2 .class)
protected Integer value;

problem is that is not working.

when I send xml:

<urn2:RobZmenObyvateleData>
<urn3:AdresaPobytu xmlns:xsi="http://ift.tt/ra1lAU" xsi:nil="true" stav="spravny"/>
</urn2:RobZmenObyvateleData>

it return 0 instead of null.

<urn2:RobZmenObyvateleData>
<urn3:AdresaPobytu stav="spravny">0</urn3:AdresaPobytu stav="spravny">
</urn2:RobZmenObyvateleData>

and this also return 0

So now how should I recognize 0 and null value ?

Run two templates for same node (XSLT)

I have some xml files like the following. They contain all different tree structures and some elements do have attributes.

<root>
  <element n="A">
    <element n="B">
      <attribute a="1"/>
      <attribute a="2"/>
    </element>
    <element n="C">
      <element n="D">
        <attribute a="3"/>
      </element>
    </element>
  </element>
</root>

I want to transform these files using XSLT to get the following output. I have to keep the tree structure and also create a list of all elements with their attributes:

<root>
  <structure>
    <newElement n="A">
      <newElement n="B">
        <newAttribute a="1"/>
        <newAttribute a="2"/>
      </newElement>
      <newElement n="C">
        <newElement n="D">
          <newAttribute a="3"/>
        </newElement>
      </newElement>
    </newElement>
  </structure>
  <list>
    <listElement n="A"/>
    <listElement n="B">
      <listAttribute a="1"/>
      <listAttribute a="2"/>
    </listElement>
    <listElement n="C"/>
    <listElement n="D">
      <listAttribute a="3"/>
    </listElement>
  </list>
</root>

I try to run two different templates "e1" and "e2" for one node "element" but it doesn't work. It seems that the first template is ignored. So what do I have to change?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">

<xsl:template match="/">
  <root>
    <structure>
      <xsl:apply-templates name="e1"/>
    </structure>
    <list>
      <xsl:apply-templates name="e2"/>
    </list>
  </root>
</xsl:template>

<xsl:template match="element" name="e1">
  <newElement>
    <xsl:attribute name="n">
      <xsl:value-of select="@n"/>
    </xsl:attribute>
    <xsl:apply-templates name="a1"/>
    <xsl:apply-templates name="e1"/>
  </newElement>
</xsl:template>

<xsl:template match="attribute" name="a1">
  <newAttribute>
    <xsl:attribute name="a">
      <xsl:value-of select="@a"/>
    </xsl:attribute>
  </newAttribute>
</xsl:template>

<xsl:template match="element" name="e2">
  <listElement>
    <xsl:attribute name="n">
      <xsl:value-of select="@n"/>
    </xsl:attribute>
    <xsl:apply-templates name="a2"/>
  </listElement>
  <xsl:apply-templates select="element"/>
</xsl:template>

<xsl:template match="attribute" name="a2">
  <listAttribute>
    <xsl:attribute name="a">
      <xsl:value-of select="@a"/>
    </xsl:attribute>
  </listAttribute>
</xsl:template>

</xsl:stylesheet>

dimens file in values-sw360dp clashes with nexus4 & nexus5 UI

Creating an application in portrait mode where I have to align Button on image based on top margin. I'm using dimens file in values-sw360dp which is looking proper in nexus 5 but the same values is not aligning the Buttons in nexus 4 as both of the devices using values-sw360dp folder for dimens file.

Can you please suggest the solution for this. Also can any one provide list of all possible values folder that should be integrated to support multiple screens

Following is the code:

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/windowBackground">


    <ImageView
        android:id="@+id/bc_logo"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitStart"
        android:src="@drawable/bc_imgbc_logo" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/bc_logo"
        android:orientation="horizontal"
        android:weightSum="1"
        android:layout_alignParentTop="true"
        android:layout_marginTop="@dimen/bc_img_margin_top">

        <Button
            android:id="@+id/login_btn"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="@drawable/signing_tab_btn"
            android:text="SIGN IN"
            android:textColor="@color/colorAccent" />

        <Button

            android:id="@+id/registration_btn"
            style="?android:attr/buttonBarButtonStyle"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:text="REGISTER"
            android:textColor="#FFFFFF" />


    </LinearLayout>
</RelativeLayout

In above code I need to align the LinearLayout on the ImageView so using android:layout_marginTop="@dimen/bc_img_margin_top"for setting margin.

error Error parsing XML mismatched tag in string.xml

Log Type : Recompiling

Log Recorded At : Mon 29-06-2015 16:13:44.53

Log Recorded By : Advanced ApkTool v4.1.0 By BDFreak


max res 19, skipping drawable-v21 max res 19, skipping layout-v21 max res 19, skipping values-v21 F:\Downloads\Compressed\apkmanager\3-Out\Suspended_menu_3.3.3.apk\res\values\strings.xml:40: error: Error parsing XML: mismatched tag

error: Error parsing XML: mismatched tag

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="abc_action_bar_home_description">Navigate home</string>
    <string name="abc_action_bar_up_description">Navigate up</string>
    <string name="abc_action_menu_overflow_description">More options</string>
    <string name="abc_action_mode_done">Done</string>
    <string name="abc_activity_chooser_view_see_all">See all</string>
    <string name="abc_activitychooserview_choose_application">Choose an app</string>
    <string name="abc_searchview_description_clear">Clear query</string>
    <string name="abc_searchview_description_query">Search query</string>
    <string name="abc_searchview_description_search">Search</string>
    <string name="abc_searchview_description_submit">Submit query</string>
    <string name="abc_searchview_description_voice">Voice search</string>
    <string name="abc_shareactionprovider_share_with">Share with</string>
    <string name="abc_shareactionprovider_share_with_application">Share with %s</string>
    <string name="UMAppUpdate">App updating</string>
    <string name="UMBreak_Network">Please make sure you are connected to internet,update failed</string>
    <string name="UMDialog_InstallAPK">The lastest version has been downloaded, install now ?</string>
    <string name="UMGprsCondition">(Warning: Not WIFI Condition)</string>
    <string name="UMIgnore">Ingore this</string>
    <string name="UMNewVersion">Latest version:</string>
    <string name="UMNotNow">Not now</string>
    <string name="UMTargetSize">Target size:</string>
    <string name="UMToast_IsUpdating">Updating....</string>
    <string name="UMUpdateCheck">2.4.2.20140520</string>
    <string name="UMUpdateContent">Update Content</string>
    <string name="UMUpdateNow">Update now</string>
    <string name="UMUpdateSize">Update size:</string>
    <string name="UMUpdateTitle">New version found</string>
    <string name="abc_action_bar_home_description_format">%1$s, %2$s</string>
    <string name="abc_action_bar_home_subtitle_description_format">%1$s, %2$s, %3$s</string>
    <string name="abc_search_hint">Search…</string>
    <string name="abc_toolbar_collapse_description">Collapse</string>
    <string name="about_title">About</string>
    <string name="accesibility_service">""Analog return key", "news tips", need to set up - auxiliary functions, the list of services to open the menu service suspension. (At the top or bottom)

If the service is "unexpectedly shut down", please check whether the background management software to clean up, and then the software whitelisted。"</string>
    <String name ="accesibility_service_close">service unexpectedly turned off, check whether the background management software cleanup. If yes, please whitelist software</String>
    <string name="add">add value</string>
    <String name ="any_click_read_msg_introduction">When turned on click any gesture column can read the message</string>
    <String name ="any_click_read_msg_summary"> after opening, when there is a message, click the icon or click the sidebar suspension can quickly read the message to ignore the current click Action Settings </string>
    <String name ="any_click_read_msg_title"> Click to read the message </string>
    <String name ="app_name"> suspension Menu </string>
    <String name ="auto_hind_app_list"> Auto-hide the list of program </string>
    <String name ="auto_hind_app_list_introduction"> if the current application is an application, the suspension will be automatically hide menu "list" within </string>
    <String name ="auto_start_title"> boot </string>
    <String name ="backup"> Backup </string>
    <String name ="backup_autp_info"> There are currently no backup files, automatic backup is restored? </String>
    <String name ="backup_exist_info"> Backup file already exists, whether or not covered? </String>
    <String name ="backup_fail"> backup failed </string>
    <String name ="backup_info"> "backup file will be saved in:
Document / FloatMenu / back "</string>
    <String name ="backup_setting_title"> Backup Restore </string>
    <String name ="backup_suc"> backup success </string>
    <String name ="cancel"> Cancel </string>
    <String name ="cata_base_setting_title"> Basic Settings </string>
    <String name ="cata_experimental_features"> experimental features </string>
    <String name ="cata_float_view_feature_setting"> Appearance Settings </string>
    <String name ="cata_gesture_setting"> Gesture Settings </string>
    <String name ="cata_other_title"> Other settings </string>
    <String name ="cata_right_top_gesture_setting"> "top right corner" Gesture Settings </string>
    <String name ="cata_top_left_gesture_setting"> "upper left corner" Gesture Settings </string>
    <String name ="cata_view_feature_setting_title"> Appearance Settings </string>
    <String name ="caution"> Note: </string>
    <String name ="choose_feedback_way"> select the feedback mode </string>
    <String name ="clear_function"> Clear All </string>
    <String name ="click_for_restore_float_view"> Click the icon to restore suspended </string>
    <String name ="click_for_restore_light"> Click to close the screen long light </string>
    <String name ="click_for_restore_side"> Click to restore the sidebar </string>
    <String name ="click_to_del"> Tip: Click to delete the contents of </string>
    <String name ="combine_list_introduction"> When performing "key combination" function, the function "List" will be performed once within </string>
    <String name ="combine_list_summary"> function key combination will be performed once within </string>
    <String name ="combine_list_title"> key combination </string>
    <String name ="confirm"> OK </string>
    <String name ="countdown_close_flash"> To protect the flash automatically turns off two minutes after </string>
    <String name ="d_defalut_menu"> [{name: Set, type: 0, packageName: com.android.settings, className: com.android.settings.Settings, menuId: 0}, {name: return key, type: 1 , order: back_key_no_root, menuId: 0}, {name: Home key, type: 1, order: home_key, menuId: 0}, {name: Mute, type: 1, order: mute_toggle, menuId: 0}, {name: lock screen, type: 1, order: lock_screen, menuId: 0}, {name: display the notification bar, type: 1, order: toggle_notifaction, menuId: 0}, {name: Hide Icons, type: 1, order: switch_floatview, menuId: 0}] </string>
    <String name ="d_float_click"> [{name: default menu, type: 2, menuId: 2}] </string>
    <String name ="d_float_down"> [{name: Home key, type: 1, order: home_key, menuId: 0}] </string>
    <String name ="d_float_left"> [{name: return key, type: 1, order: back_key_no_root, menuId: 0}] </string>
    <String name ="d_float_right"> [{name: Task button, type: 1, order: recent_key, menuId: 0}] </string>
    <String name ="d_float_up"> [{name: show | hide suspension icon, type: 1, order: switch_floatview, menuId: 0}] </string>
    <String name ="d_no_root_content"> Current features require Root permission, if it is determined the phone has Root, Root can install the management software to manage Root privileges, whether to download and install? </String>
    <String name ="d_no_root_down"> Download </string>
    <String name ="d_no_root_title"> Unable to get Root privileges </string>
    <String name ="d_side_left_down_click"> [{name: Home key, type: 1, order: home_key, menuId: 0}] </string>
    <String name ="d_side_left_down_down"> [{name: display the notification bar, type: 1, order: toggle_notifaction, menuId: 0}] </string>
    <String name ="d_side_left_down_right"> [{name: return to the previous program, type: 1, order: switch_app, menuId: 0}] </string>
    <String name ="d_side_left_up_click"> [{name: Home key, type: 1, order: home_key, menuId: 0}] </string>
    <String name ="d_side_left_up_right"> [{name: return key, type: 1, order: back_key_no_root, menuId: 0}] </string>
    <String name ="d_top_right_click"> [{name: running the program, type: 2, menuId: 1}] </string>
    <String name ="defaultMenuName"> default menu </string>
    <String name ="define_FloatingActionButton" />
    <String name ="del"> Delete </string>
    <String name ="del_confirm"> Delete OK? </String>
    <String name ="del_suc"> deleted successfully </string>
    <String name ="double_home_title"> Double-click the Home button to lock the screen </string>
    <String name ="drawer_close"> draw close </string>
    <String name ="drawer_open"> draw open </string>
    <String name ="dynamic_position"> dynamic menu position </string>
    After <string name = "dynamic_position_introduction"> Open, pop-up menus dynamically adjusted based on the location of the sidebar position </string>
    <String name = "dynamic_position_summary"> After opening, the position of the pop-up menu will be dynamically adjusted based on the position of the gesture bar </string>
    <String name = "erro_menu_name_duplicate"> same menu name already exists </string>
    <String name = "erro_menu_name_is_null"> Enter the correct menu name </string>
    <String name = "erro_menu_name_null"> menu name can not be empty </string>
    <String name = "error_menu_has_been_del"> menu has been deleted </string>
    <String name = "error_net"> failed to load, please check your network </string>
    <String name = "error_no_root_access"> without root privileges </string>
    <String name = "evaluate_setting_title"> evaluation </string>
    <String name = "exclude_apps_summary"> When you run these programs, hide icons, and other gestures suspension bar </string>
    <String name = "exit"> Exit </string>
    <String name = "expired"> software expires, go to the store to download the latest version. </String>
    <String name = "extra_setting"> More Settings </string>
    <String name = "feedback_setting_title"> Feedback recommendation </string>
    <String name = "feedback_title"> suggestion feedback </string>
    <String name = "float_extra_setting_summary"> position fix, move freely, automatically and transparently, edge absorption </string>
    <String name = "float_tu"> "" Click ": the pop-up menu
"Press": Move Icon "</string>
    <String name = "float_view_auto_side_model"> edge absorption </string>
    <String name = "float_view_auto_trans_model"> Auto transparent </string>
    <String name = "float_view_freedom_move_model"> freedom of movement </string>
    <String name = "float_view_lock_model"> position lock </string>
    <String name = "float_view_touch_feedback"> Touch Animation </string>
    <String name = "function_click"> click </string>
    <String name = "function_double_click"> double click </string>
    <String name = "function_down"> fell </string>
    <String name = "function_left"> Left slide </string>
    <String name = "function_long_pressed"> long press </string>
    <String name = "function_right"> right slide </string>
    <String name = "function_up"> slide </string> on
    <String name = "gesture_setting_title"> Gesture Settings </string>
    <String name = "hind_into_statebar"> to hide the status bar </string>
    <String name = "home_show_float_title"> Home key to display the suspended icon </string>
    <String name = "ignore"> Ignore </string>
    <String name = "info_long_pressed_pop"> [press] icon menu inside, you can "Select menu style" and "Edit Menu" </string>
    <String name = "input_menu_name"> Enter the menu name </string>
    <String name = "input_new_menu_name"> Please enter a new menu name </string>
    <String name = "internal_theme"> Built </string>
    <String name = "introduction_native_theme"> "No custom skin found
The Picture folder on the SD card / FloatMenu / custom / file
Skin formats: PNG, size not larger than 200x200 "</string>
    <String name = "is_out_up_dismiss_summary"> After opening, if the slide gesture triggers the menu, lift your finger outside the menu, the menu disappears </string>
    <String name = "is_out_up_dismiss_title">, raising his hand to close the menu </string>
    <String name = "is_undo"> Are Undelete? </String>
    <String name = "item_menu_help"> Help </string>
    <String name = "item_menu_setting"> Other settings </string>
    <String name = "keep_light_close"> screen long bright close </string>
    <String name = "keep_light_open"> screen long bright open </string>
    <String name = "keyboard_cover_summary"> Special Note: After opening SmartBar cause some applications display is not normal, such as SMS interface unrealistic send button, please use discretion. </String>
    <String name = "keyboard_cover_title"> input method covering </string>
    <String name = "landscape_auto_hind_title"> horizontal screen Auto-hide </string>
    <String name = "left_and_right_to_del"> sliding around deleted </string>
    <String name = "library_FloatingActionButton_author"> Oleksandr Melnykov </string>
    <String name = "library_FloatingActionButton_authorWebsite"> http://ift.tt/1tAerbF </string>
    <String name = "library_FloatingActionButton_isOpenSource"> true </string>
    <String name = "library_FloatingActionButton_libraryDescription"> Android Google+ like floating action button which reacts on the list view scrolling events. Becomes visible when the list view is scrolled up and invisible when scrolled down. </String>
    <String name = "library_FloatingActionButton_libraryName"> FloatingActionButton </string>
    <String name = "library_FloatingActionButton_libraryVersion"> 1.0.0 </string>
    <String name = "library_FloatingActionButton_libraryWebsite"> http://ift.tt/1tAerbF </string>
    <String name = "library_FloatingActionButton_licenseId"> mit </string>
    <String name = "library_FloatingActionButton_repositoryLink"> http://ift.tt/1tAerbF </string>
    <String name = "like_this_one"> Like </string>
    After <string name = "lock_model_summary"> Open, you can set a long press gesture </string>
    <String name = "lock_notification_title"> lock screen message prompts </string>
    <String name = "lock_screen"> a key lock screen </string>
    <String name = "long_pressed_disable_summary"> mobile suspension icon </string>
    <String name = "long_pressed_to_edit"> prompt: "Press" menu list can be edited menu </string>
    <String name = "menu_edit"> Edit Menu </string>
    <String name = "menu_transparency"> Transparency </string>
    <String name = "native_theme"> local </string>
    <String name = "need_high_api"> currently feature only supports Android4.1 and above </string>
    <String name = "need_position_lock_switch_on"> The suspension icon positions locked or free to move the switch is turned to set </string>
    <String name = "need_service_on"> In order to ensure the normal operation of the software, you need to open the menu service suspension. </String>
    <String name = "no_backup"> no backup file </string>
    <String name = "no_email_app"> Email is not installed </string>
    <String name = "no_flash_permission"> no camera (pictures / videos) permission, please give appropriate permissions system settings </string>
    <String name = "no_notification"> There is currently no message notification </string>
    <String name = "no_running_apps"> is not currently running program </string>
    <String name = "no_sdcard"> can not be loaded SD card, make sure the available </string>
    <String name = "no_warm"> has opened </string>
    <String name = "not_support_this_function"> The current system does not support this feature </string>
    <String name = "notification_all_switches_closed"> all current switch is turned off </string>
    <String name = "notification_bluetooth_close"> Bluetooth turned off </string>
    <String name = "notification_bluetooth_open"> Bluetooth Open </string>
    <String name = "notification_can_not_launch_short_cut"> Unable to start fast program </string>
    <String name = "notification_dismiss_title"> 10S ignore the message after the prompt </string>
    <String name = "notification_force_show_float"> mandatory message prompts </string>
    After <string name = "notification_force_show_float_introduction"> Open, regardless suspension icon switch is turned on, will be forced to display a message prompts </string>
    <String name = "notification_gprs_close"> Data flow shutdown </string>
    <String name = "notification_gprs_open"> Data traffic open </string>
    After <string name = "notification_introduction"> Open, notification bar when there is news, suspension icon will prompt No message read </string>
    <String name = "notification_mute_close"> Mute Off </string>
    <String name = "notification_mute_open"> Mute On </string>
    <String name = "notification_not_install_mms"> you have not yet installed pop information, please download and install </string>
    <String name = "notification_not_install_profile"> You have not installed the Magic with the change, please download and install </string>
    <String name = "notification_not_install_query_charges"> you have not yet installed a key inquiry calls, please download and install </string>
    <String name = "notification_not_install_quick_clean"> You have not installed or cheetah cleanup LBE Masters, please download and install </string>
    <String name = "notification_rotation_close"> screen rotation Close </string>
    <String name = "notification_rotation_open"> screen rotation Open </string>
    <String name = "notification_summary"> icon suspension prompt QQ, micro letters and other news, click Read </string>
    <String name = "notification_title"> message prompts </string>
    <String name = "notification_vibreate_close"> Vibrate Off </string>
    <String name = "notification_vibreate_open"> vibration open </string>
    <String name = "notification_white_list_introduction"> only when the application "white list" have a notification message within, will have a message prompts </string>
    <String name = "notification_white_list_title"> message whitelist </string>
    <String name = "notification_wifi_close"> Wi-Fi turned off </string>
    <String name = "notification_wifi_open"> Wi-Fi to open </string>
    <String name = "nvg_float"> suspension icon </string>
    <String name = "nvg_menu"> Menu Settings </string>
    <String name = "nvg_notification"> message prompts </string>
    <String name = "nvg_other"> Other settings </string>
    <String name = "nvg_side"> Gestures side bar </string>
    <String name = "nvg_top"> gesture top bar </string>
    <String name = "official_version"> official version </string>
    <String name = "online_theme"> online </string>
    <String name = "open"> to open </string>
    <String name = "open_accessibility_service_title"> ○ Settings -> Accessibility -> "suspension Menu" under the list of services </string>
    <String name = "open_notification_service_title"> ○ Settings -> Security -> Notification Read permission -> "suspension Menu" </string>
    <String name = "open_service_title"> need to open the following services to run properly </string>
    <String name = "open_tip"> Tip: If the service is frequently shut down, make sure the software is added to the white list system or other back office management software </string>.
    <String name = "opened"> turned </string>
    <String name = "over_write"> cover </string>
    <String name = "p_add_menu_title"> "Add Menu" </string>
    <String name = "p_notification_title"> "prompt message" </string>
    <String name = "p_online_theme_title"> "Live Skin" </string>
    <String name = "p_point_cost_content"> Current Total% 1 $ d points, unlock% 2 $ s% 3 $ d consumed points left after unlocking% 4 $ d integration, whether unlock? </String>
    <String name = "p_point_get_content"> Current Total% 1 $ d points, unlock% 2 $ s% 3 $ d consumed points, just under% 4 $ d integral unlock function, whether free access points? </String>
    <String name = "p_point_item_get_points"> Get Points </string>
    <String name = "p_point_item_unlock"> unlocked </string>
    <String name = "p_point_loading_content"> Points get in ... </string>
    <String name = "p_title"> Tip </string>
    <String name = "p_unlock_failed"> Unlock failed </string>
    <String name = "p_unlock_suc"> unlock success </string>
    <String name = "pop_auto_kill_tip"> If you can not "show suspension icon," go to System Settings Open "floating window Permissions" suspension of the menu. </String>
    <String name = "pop_auto_kill_tip_for_meizu"> "1. If the software" automatic shutdown ", set the software to join the white list cleaning software.

2. If the "unable to boot", make sure the software has permission to boot. "</String>
    <String name = "pop_auto_kill_tip_for_xiaomi"> "detected in your mobile phone MIUI system, you need the following settings to normal use:

MIUI V5 System:
Settings - Applications - suspension Menu
Open the "Display floating window" rights.

MIUI V6 system:
Security Center - Application Management - suspension Menu
Open the "Display floating window" rights. "</String>
    <String name = "pref_float_view_size_title"> size </string>
    <String name = "pref_float_view_theme"> Skin </string>
    <String name = "pref_float_view_trans_title"> Transparency </string>
    <String name = "purchase_official"> buy the official version </string>
    <String name = "questions"> Frequently Asked Questions list </string>
    <String name = "rename"> Rename </string>
    <String name = "restore"> Recovery </string>
    <String name = "restore_suc"> successful recovery </string>
    <String name = "running_app"> Running Programs </string>
    <String name = "running_switch_app_black_list_summary"> list within the program will not be displayed or switched </string>
    <String name = "running_switch_app_black_list_title"> Running Programs / handover procedure blacklist </string>
    <String name = "save_comfirm_title"> Enter to save? </String>
    <String name = "scr_menu_style_title"> menu style </string>
    <String name = "scr_other_setting_title"> Other settings </string>
    <String name = "screen_shot_auto_hind"> Screenshot hide </string>
    <String name = "screen_shot_auto_hind_summary"> via software screenshots, icons and sidebar hidden suspension </string>
    <String name = "screen_shot_show_summary"> only for the screenshot feature within the program </string>
    <String name = "screen_shot_show_title"> Screenshot Hide suspension icons </string>
    <String name = "screen_shot_tip"> "will have vibration feedback after successful shots, pictures will be saved to:
SDCard / Pictures / ScreenShots / "</string>
    <String name = "service_describe"> case of non-ROOT "Analog return key", "the message tips", need to open this service </string>
    <String name = "service_destroy"> suspension menu service shut down unexpectedly, check that background management software has been added to the whitelist </string>
    <String name = "show_notification_msg_summary"> After opening, if [the message] whitelist program has a message notification, suspension icon automatically becoming an icon for the program to prompt a new message arrives, click to read the message </string>
    <String name = "show_notification_msg_switch_title"> message prompts </string>
    After <string name = "show_side_introduction"> turned back to the desktop will continue to display the sidebar </string>
    After <string name = "show_side_summary"> open, exit the program continues to display the location of the next portion of the sidebar </string>
    <String name = "show_side_title"> Sidebar </string>
    <String name = "side_distinguish_up_down_title"> distinguish between upper and lower portions </string>
    <String name = "side_gesutre_setting_title"> sidebar Gesture Settings </string>
    <String name = "side_left_down_setting"> "at the left part of" gesture </string>
    <String name = "side_left_up_setting"> "on the left part of the" gesture </string>
    <String name = "side_left_view_switch_title"> left side of the gesture column switch </string>
    <String name = "side_left_width"> left side width </string>
    <String name = "side_length"> length </string>
    <String name = "side_position"> Location </string>
    <String name = "side_right_down_setting"> "under the right part of the" gesture </string>
    <String name = "side_right_up_setting"> "on the right-hand part of the" gesture </string>
    <String name = "side_right_view_switch_title"> on the right gesture column switch </string>
    <String name = "side_right_width"> on the right width </string>
    <String name = "slide_del_running_app"> slide Remove the running program </string>
    <String name = "slide_del_running_app_attention"> "Note:
After opening, the surface may appear not click on the pop-up menu on some phones, please caution. "</String>
    After <string name = "slide_del_running_app_introduction"> Open, when the pop-up menu to "running program - a vertical", you can slide around the end of the program, you need Root privileges. </String>
    <String name = "start"> began to experience </string>
    <String name = "style"> style </string>
    <String name = "switch_anim"> start / switch procedural animation </string>
    Applications within the <string name = "switch_black_list_introduction"> "list" does not appear in the running list and will not be switched </string>
    <String name = "switch_float_view_title"> suspension icon switch </string>
    <String name = "switch_off_freedom_model_first"> Turn off the free movement of switch </string>
    <String name = "switch_off_lock_model_first"> Turn off location lock switch </string>
    <String name = "switch_on_service"> Open </string>
    <String name = "t_notification_float_msg"> When the notification bar when the news: \ u0009 </string>
    <String name = "t_notification_float_normal"> suspension icon looks like a normal time: \ u0009 </string>
    <String name = "t_start_float_like_this"> long suspension icon like this: \ u0009 </string>
    <String name = "test"> <font color = "red"> update settings </font> </string>
    <String name = "test_modle"> beta </string>
    <String name = "test_version"> Trial </string>
    <String name = "toggle_screen_func_introduction"> "1. Trigger pull-down screen automatically restored after hovering five seconds.


 2. fix some functions require permission prompt unprivileged Bug.

 3. Repair other known Bug.

 4. Input coverage options. "</String>
    <String name = "update_title"> Update Logs </string>
    <String name = "vibrate_time_title"> vibration intensity </string>
</resources>

values not getting updated in webparam.mode.INOUT in JAXWS web services

I'm calling a web service which is a void web method. The request/response elements are marked as webparam.mode.INOUT. When I call this web method with my request and response as same objects, I'm not able to get the response from the Holder(Is it because the request and response are of the same object). My pseudocode is something like below.

A a = new A();    
B b = new B();    
Holder<A> aHolder = new Holder<A>(a); // JAXWS Holder  
Holder<B> bHolder = new Holder<B>(b);// JAXWS Holder  
InService inservice = new InService();    
InPortType inPortType = inservice.getPortType();    
inPortType.getInfo(aHolder,bHolder);     

How do I get the response from aHolder?

XML to CSV in C# newbie

Hello Guys i need help with this xml data.

<?xml version="1.0" encoding="utf-8"?>
<xml-data xmlns="http://ift.tt/1Npy4gj">
<form>catalog://Unternehmen/ust/ZM_Formular_online</form>
<instance>

<dataset id="tbl_ZM_tabelle">
  <datarow>
    <element id="knre1">AT</element>
    <element id="knre2">U18713701</element>
    <element id="umsatz_art">0</element>
    <element id="betrag">7605</element>
    <element id="zeile_m">1</element>
  </datarow>

I want to write a csv data by using the knre1,knre2 and "betrag" id's. Its always the same name. It should be looking like this

AT;U18713701;7605

Iam a totally newbie in c# and i need the help.

Cordova App Access SD Card

I'm preparing a cordova app for ios and android. On android, my app downloading a zip file and extract it into sdcard. This zip file contains some xml files and some jpegs. But unfortunately i cant access to xml files via $.ajax.

i tried following paths;

'cdvfile://sdcard/webservice/Resim/Kategori.xml'

'cordova.file.externalRootDirectory + /Resim/Kategori.xml'

And my ajax looks like;

$.ajax({
   url: 'cdvfile://sdcard/webservice/Resim/Kategori.xml',
   dataType: 'xml',
   async:false,
   cache:false,
   success: parseMenu
});

What is wrong with my ajax request? I tried send xml file into www directory before i build app and it works with this path '../webservice/Resim/Kategori.xml'

How can i access my downloaded xml via $.ajax or should i download it into android_asset/www/webservice path, if yes how can i download it to there?

PS: My download and extract function executes good, if needed;

function appReady(){
                alert('tamam');
            }
            var filePath = "/sdcard/";

            //İndirelecek dosyanın URL yolu
            var zipURL = "http://ift.tt/1U03mPE";

            //İndirilen dosyanın alacağı isim.
            var fileName = "webservice.zip";

            function downloadZip() {
                var options = new FileUploadOptions();
                var fileTransfer = new FileTransfer();

                fileTransfer.download(
                    encodeURI(zipURL),
                    filePath + fileName,
                    function(entry) {

                        zip.unzip(filePath+ fileName, filePath, appReady, null);
                        alert("download complete: " + entry.fullPath);
                    },
                    function(error) {
                        alert(error);
                        alert("download error source " + error.source);
                        alert("download error target " + error.target);
                    },
                    false,
                    {

                    }
                );

            }
            function init(){

                // eğer indirilmediyse..
                if(localStorage.getItem('downloaded') != "yes") {
                    alert('inmemiş inecek..');
                    // uygualama ana klasörünü dosya yolu olarak belirledim siz değişebilirsiniz.
                    alert(filePath);
                    // zip dosyasını indir
                    downloadZip();

                } else {
                    alert('İnmiş gözüküyor');
                    // uygulamanızı çalıştıran fonksiyon olduğunu varsaydım.
                    appReady();
                }      

            }
            document.addEventListener("deviceready", init, false);

xml data feeds to mysql. ? but link is time out error occure. see attached link

 hello my problem is different then my qestion.. please see below url

http://ift.tt/1dseraz

but " You have exceded your download limit for Feed ID 363. Please try again in 327 minutes"

this error occure and if i use http://ift.tt/1U03kai

then csv file download.. but i want to download product feeds to mysql 

i already use code for XMl and CSV but problem is fetching data..

code for xml

     $response = file_get_contents($url, true);
 $pxml = simplexml_load_string($url);


`foreach($pxml->Products->Product as $product )
{
echo $id= $product ->ProductID, "<br>"; 
echo $description = $product ->ProductDescription, "<br>";
}`

 below code for csv..

see `if (($handle = fopen($url, "r")) !== FALSE)
{
    while (($data = fgetcsv($handle, 2048, ",")) !== FALSE)
    {

      print_r($data);


    }  
}


`

if any solution then tell me.. if url is exceded your download limit then try after limit

how i would add new book information on book.xml file using javascript or jquery

I wanted to insert new record for employee on in employee.xml as I am taking XML file as my database.

manager.xml:

<?xml version="1.0"?>
<Employees>
    <Employee>
        <Id>1</Id>
        <EmployeeId>EMP001</EmployeeId>
        <Name>Thirumalai</Name>
        <Role>Architect</Role>
    </Employee>
</Employees>

I wanted to add new employee with an id of EMP002, name of John and Role of manager in mamaanger.xml file.

How to validate the SignedXML for the following code?

I am working on one project where I need to check if the XML provided is valid or not. For this purpose, I am using code to verify the XML using the signedXmlclass in c#.

Please find the below code for the verify() Method:

    public bool Verify(XmlDocument signedDocument)
{
    // create a signed xml object from xml 
    SignedXml signedXml = new SignedXml(signedDocument);
    // get the signature node and load the signature tag
    XmlNodeList nodeList = signedDocument.GetElementsByTagName("Signature");
    signedXml.LoadXml((XmlElement)nodeList[0]);

    // define and create the encryption key
    CspParameters CSPParam = new CspParameters();
    CSPParam.Flags = CspProviderFlags.UseMachineKeyStore;
    RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(CSPParam);
    rsa.FromXmlString(@"<RSAKeyValue><Modulus>03COUbx8JI6jkkmxrQ3N//67tgMt+ak1SKSXbGO3+4vVGFGhyGICJS8C+W6ON6dUdcm2/uxC5q4wyPRyFWMf8v8oslGOWJdADPnP8rvcy8PL3Nf67f8fMnTyHoEoZTfZjKuEoyhmPi6rfAX4QQA+OYhk4Qb1FJyOB3fpZ1QiTxX2k=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");

    // load encryption key to the xml
    KeyInfo keyInfo = new KeyInfo();
    keyInfo.AddClause(new RSAKeyValue(rsa));
    signedXml.KeyInfo=keyInfo;
    // check if the signature provided in signature tag is valid with the key info
    bool b = signedXml.CheckSignature();
    return b;
}

and the xml data provided to the method is:

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://ift.tt/ra1lAU" xmlns:xsd="http://ift.tt/tphNwY" xmlns:soap="http://ift.tt/sVJIaE">

<Signature xmlns="http://ift.tt/uq6naF" id="MySignature">
    <SignedInfo>
      <CanonicalizationMethod Algorithm="http://ift.tt/11kTCUR" />
      <SignatureMethod Algorithm="http://ift.tt/zf1Wx4" />
      <Reference URI="#_ea559faf-417b-407f-bdc2-bccc76dab76c">
        <Transforms>
          <Transform Algorithm="http://ift.tt/A1C4L2" />
          <Transform Algorithm="http://ift.tt/11kTCUR">
          </Transform>
        </Transforms>
        <DigestMethod Algorithm="http://ift.tt/yuvO4a" />
        <DigestValue>fvQx+J90ZGKhwj8Mfhg6v/esOtI=</DigestValue>
      </Reference>
    </SignedInfo>
    <SignatureValue>fvQx+J90ZGKhwj8Mfhg6v/esOtI=</SignatureValue>
  <KeyInfo type="http://ift.tt/1GUYsMV">    
   <RSAKeyValue><Modulus>03COUbx8JI6jkLrQ3N//67tgMt+ak1SKSXbGO3+4vVGFGhyGICJS8C+W6ON6dUdcm2/uxC5q4wyPRyFWMf8v8oslGOWJdADPnP8rvcy8PL3Nf67f8fMnTyHoEoZTfZjKuEoyhmPi6rfAX4QQA+OYhk4Qb1FJyOB3fpZ1QiTxX2k=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>
  </KeyInfo >   
</Signature>
</soap:Envelope>

I am not able to trace out which tag value in xml I am setting wrong. The result of signedXml.CheckSignature() is always getting false.

Can anyone help me to sort out this problem?

Thanks in advance. Please let me know if any more information is needed.

Controller 404 Page Not Found using Magento

I created this files... based on TutsPlus Premium Magento Tutorial I am using the latest Magento right now.

file path

\app\code\local\TutsPlus\Demo\etc

this is the codes... for config.xml

<config>
    <global>
        <models>
            <demo>
                <class>TutsPlus_Demo_Model</class>
            </demo>
        </models>

        <blocks>
            <demo>
                <class>TutsPlus_Demo_Block</class>
            </demo>
        </blocks>

        <helpers>
            <demo>
                <class>TutsPlus_Demo_Helper</class>
            </demo>
        </helpers>

    </global>

    <frontend>
        <routers>
            <tutsplus_demo>
                <use>standard</use>
                <args>
                    <module>TutsPlus_Demo</module>
                    <frontName>demo</frontName>
                </args>
            </tutsplus_demo>
        </routers>
    </frontend>

</config>


app\code\local\TutsPlus\Demo\controllers

this is the codes... for IndexController.xml

<?php

class TutsPlus_Demo_IndexController extends Mage_Core_Controller_Front_Action {

    public function sayHelloAction() {
        echo "Hello Junar";
    }

}

The Output must be: Hello Junar but it gives me 404 Page Not Found

My android banner ad not showing?

this my main activity xml code i dont know whats wrong with this please help me anyone?

<!-- Framelayout to display Fragments -->
<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

 <com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>

<!-- Listview to display slider menu -->
<ListView
    android:id="@+id/list_slidermenu"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@color/list_divider"
    android:dividerHeight="1dp"        
    android:listSelector="@drawable/list_selector"
    android:background="@color/list_background"/>

i added all permissions also in manifest too

How to read a xml file in android without internet connection?

I would be glad if you help me. I have an app. When I open the app, writing XML file to "sdcard/example.xml". (with internet connection) But when I open the app without internet connection, the app does not read XML file. Here is my code;

class RetrieveFeedTask extends AsyncTask<String, Void, String> {

    private Exception exception;

    protected String doInBackground(String... urls) {
        try {
            File xmlWriteSd = new File("/sdcard/example.xml");
            FileOutputStream fos = new FileOutputStream(xmlWriteSd);
            xmlDownload(fos,"http://ift.tt/1BQfs81");
            xmlRead();
            return null;
        } catch (Exception e) {
            this.exception = e;
            return null;
        }
    }

    protected void onPostExecute(String feed) {
    }
}

And the xmlDownload function is

public void xmlDownload(FileOutputStream fout, final String urlString) throws MalformedURLException, IOException {
    BufferedInputStream in =null;
    File file = new File("/sdcard/example.xml");
    if(!file.exists())//control
        return;
    try {

        in = new BufferedInputStream(new URL(urlString).openStream());

        final byte data[] = new byte[1024];
        int count;
        while ((count = in.read(data, 0, 1024)) != -1) {
            fout.write(data, 0, count);
        }
    } finally {
        if (in != null) {
            in.close();
        }
        if (fout != null) {
            fout.close();
        }
    }
}

and xmlRead function is;

private void xmlRead() {
    try {
        File fXmlFile = new File("/sdcard/example.xml");
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        Document doc = dBuilder.parse(fXmlFile);
        doc.getDocumentElement().normalize();

        NodeList nList = doc.getElementsByTagName("item");

        for (int temp = 0; temp < nList.getLength(); temp++) {
            final ExampleObject  = new YemekNesne();

            Node nNode = nList.item(temp);

            if (nNode.getNodeType() == Node.ELEMENT_NODE) {

                Element eElement = (Element) nNode;

                ExampleObject .setDate(eElement.getElementsByTagName("Date").item(0).getTextContent());
                ExampleObject .setmain(eElement.getElementsByTagName("main").item(0).getTextContent());
                ExampleObject .setsecond(eElement.getElementsByTagName("second").item(0).getTextContent());
                ExampleObject .setextra(eElement.getElementsByTagName("extra").item(0).getTextContent());
                ExampleObject .setExample(eElement.getElementsByTagName("Example").item(0).getTextContent());
                listOfExample.put(ExampleObject .getDate(),ExampleObject );//hash map
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

How can i (ONLY) read xml file without internet?

How do I process 3 separate XSLT files from a single XML to a single output?

I have an XSLT file that works with an XML to process a HTML (currently using X-trans & Notepad++). What I want to do is split it into 3 files, The Header, the body and the footer.

So far I have tried to use xsl:import & xsl:include but whenever I try to process it says the file is not valid. I'm clearly missing something can anyone help?

Header XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
    <html lang="en-GB">
        <body style="font-family:'Praxis Com Light'; color:#632423; width:100%; font-size:14px !important;">


            <xsl:variable>variable1</xsl:variable>
            <xsl:variable>variable2</xsl:variable>
            <xsl:variable>variable3</xsl:variable>

            <div>Header</div>

        </body>
    </html>
</xsl:template>

Body XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
    <html lang="en-GB">
        <body style="font-family:'Praxis Com Light'; color:#632423; width:100%; font-size:14px !important;">


            <xsl:include href="Header.xsl"/>

            <xsl:variable>variable1</xsl:variable>
            <xsl:variable>variable2</xsl:variable>
            <xsl:variable>variable3</xsl:variable>

            <table>Main XSL file</table>

            <xsl:include href="Footer.xsl"/>


        </body>
    </html>
</xsl:template>

Footer XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
    <html lang="en-GB">
        <body style="font-family:'Praxis Com Light'; color:#632423; width:100%; font-size:14px !important;">


            <xsl:variable>variable1</xsl:variable>
            <xsl:variable>variable2</xsl:variable>
            <xsl:variable>variable3</xsl:variable>

            <p>Footer</p>


        </body>
    </html>
</xsl:template>

Diagram to help Illustrate

I/O error when reading XML

I'm reading a XML file and get a i/o error when reading the node <kamerkant/>. I use the following statement for reading the node:

Lclvalue = Sel.Selectnode('//Gordijn[1]/Kamerkant[1]/node()').nodeValue

XML

<Gordijn>
    <StofNaam>Aroma 211004</StofNaam>
    <Kleur>211</Kleur>
    <Gordijnsoort>streepgordijn</Gordijnsoort>
    <Vertrek>Woonkamer voor</Vertrek>
    <Kamerkant/>
    <Hoogte>100.0</Hoogte>
</Gordijn>

Jasper studio with datasource as XML not working on Sub reports

I have a XML from which I want to create a Jasper report keeping XML as datasource. Report contains a Sub report so I set tag in main report because I need to iterate through all but as root is now set as for Main report , i am unable to sent another tag which is not inside , to make things more clearer please see the XML bellow.

<Root>
  <containerInfo>...</containerInfo>
  <containerInfo>...</containerInfo>
  <containerInfo>...</containerInfo>
  <StuffingInfo>...</StuffingInfo>
  <StuffingInfo>...</StuffingInfo>
  <StuffingInfo>...</StuffingInfo>
  <StuffingInfo>...</StuffingInfo>
</root>

I need to set ContainerInfo as Root for main report and send StuffingInfo in "Data Source Expression" in sub report , which I can't do as Root is ContainerInfo and its not allowing Expression "../StuffingInfo" for subreports.

I have set Root node as ContainerInfo in main Report , so main report detail are working fine and I tried setting everything in "Data Source Expression" of sub report but nothing seems to work , data for sub report is coming all NULL.

Please let me know if my question is not clear enough. any help is most appreciated.

How to match chars like %19?

this is my scenario: I extract data from a file and I have to control for each line if it matches a regex. This regex is write on a configuration xml file. Some of this lines contains the %19 () char and I'm not able to match this, cause the char  isn't valid in xml.

E.g If I don't write the regex in xml this one match my line

(?<Numeri>\d{0,3}(&#x19;){0,1}(\s*?\d\d\d)*,\d{2})

With which string I have to replace  in xml?

Error in xpath compile evaluate query

I have a following XML:

<data>
<DataType1>
<val1/>
<val2/>
</DataType1>
<DataType2>
<val21/>
<val22/>
<RetrieveThis1>test1</RetrieveThis1>
<RetrieveThis2>test2</RetrieveThis2>
<RetrieveThis3>test3</RetrieveThis3>
</DataType2>
</data>

I need to retrive values test1, test2 and test3 in java. I am trying to use xPath queries as follows:

String test1Value = xpath.compile("/data/DataType2/RetrieveThis1").evaluate(inputXML);
String test2Value = xpath.compile("/data/DataType2/RetrieveThis2").evaluate(inputXML);
String test3Value = xpath.compile("/data/DataType2/RetrieveThis3").evaluate(inputXML);

It is not giving the result. Could you please suggest if XPathExpresstion I am passing in compile query is correct.

Thank you so much in advance.

OSM to DIRECTED Graph (python-igraph / networkx)

I am using this python script to download OSM data and convert it to an undirected networkx graph:

http://ift.tt/1g1rfGF

However,in the ideal case, I would like to generate a directed graph from it in order to refelct the directionality of the osm street network.

First of all, can you confirm that as stated here and here in OSM raw xml data, the order of the nd-entries in the way is what matters for the direction?

And secondly, how would you suggest to implement the generation of a directed graph from the osm raw data, give the the above gist code snippet as a template?

many thanks!

Create empty object from XML schema using JSONIX

is it somehow possible to generate an empty object from an XML schema with JSONIX? I generally have problems creating new JS objects that fit to the XML schema. Thus, this would be really helpful. Any example would be very appreciated. I tried the following to create a new object. NodeType is a complex type name in this case.

{name: {localpart: nodeType}, value:{}};

Then I tried to fill values (I traverse through the schema mappings to find out all possible properties for each type). However, I get e.g. the following error that does not help me very much: Element [ELEMNAME] is not known in this context

If this is not possible, how do I in general create a new object that is supposed to be conform to the schema?

Thanks a lot for any idea!

Xml reading and writing

I want to read a XML file and the requirement is to read it and write it in desired new format. XML to be read:

<?xml version="1.0" encoding="utf-8"?>
<Document>
    <Sitemap>
        <TreeMap>
            <RootNodes>
                <TreeMapNode>
                    <NodeType>PackageHandle</NodeType>
                    <NodeValue>Page</NodeValue>
                    <ChildNodes />
                </TreeMapNode>
            </RootNodes>
        </TreeMap>
    </Sitemap>

    <Mastermap>
        <TreeMap>
            <RootNodes>
                <TreeMapNode>
                    <NodeType>Folder</NodeType>
                    <NodeValue>Template</NodeValue>
                    <ChildNodes>
                        <TreeMapNode>
                            <NodeType>PackageHandle</NodeType>
                            <NodeValue>Master Page</NodeValue>
                            <ChildNodes />
                        </TreeMapNode>
                    </ChildNodes>
                </TreeMapNode>
            </RootNodes>
        </TreeMap>
    </Mastermap>

    <Pages>
        <Page>
            <Diagram>
                <Widgets>
                    <Image>
                        <Name/>
                        <Rectangle>
                            <Rectangle X="0" Y="4" Width="130" Height="28" />
                        </Rectangle>
                        <Bold>False</Bold>
                        <BorderColor>Color(argb) = (255, 0, 0, 0)</BorderColor>
                        <BorderWidth>-1</BorderWidth>
                        <FillColor>Color(argb) = (255, 255, 255, 255)</FillColor>
                        <FontName>Arial</FontName>
                        <FontSize>9.75</FontSize>
                        <ForeColor>Color(argb) = (255, 0, 0, 0)</ForeColor>
                        <HorizontalAlignment>Center</HorizontalAlignment>
                        <Italic>False</Italic>
                        <Underline>False</Underline>
                        <VerticalAlignment>Center</VerticalAlignment>
                        <Widgets>
                            <TextPanel>
                                <Html>&lt;p style="font-size:13px;text-align:center;line-height:normal;"&gt;&lt;span style="font-family:'Arial Regular', 'Arial';font-weight:400;font-style:normal;font-size:13px;color:#000000;text-align:center;line-height:normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;</Html>
                                <Name />
                                <Rectangle>
                                    <Rectangle X="2" Y="6" Width="126" Height="16" />
                                </Rectangle>
                                <Bold>False</Bold>
                                <BorderColor>Color(argb) = (255, 0, 0, 0)</BorderColor>
                                <BorderWidth>-1</BorderWidth>
                                <FillColor>Color(argb) = (255, 255, 255, 255)</FillColor>
                                <FontName>Arial</FontName>
                                <FontSize>9.75</FontSize>
                                <ForeColor>Color(argb) = (255, 0, 0, 0)</ForeColor>
                                <HorizontalAlignment>Center</HorizontalAlignment>
                                <Italic>False</Italic>
                                <Underline>False</Underline>
                                <VerticalAlignment>Center</VerticalAlignment>
                            </TextPanel>
                        </Widgets>
                    </Image>
                    <Shape>
                        <ShapeType>Paragraph</ShapeType>
                        <Name />
                        <Rectangle>
                            <Rectangle X="184" Y="2" Width="483" Height="28" />
                        </Rectangle>
                        <Bold>True</Bold>
                        <BorderColor>Color(argb) = (0, 255, 255, 255)</BorderColor>
                        <BorderWidth>-1</BorderWidth>
                        <FillColor>Color(argb) = (0, 255, 255, 255)</FillColor>
                        <FontName>MS Gothic</FontName>
                        <FontSize>21</FontSize>
                        <ForeColor>Color(argb) = (255, 0, 0, 0)</ForeColor>
                        <HorizontalAlignment>Near</HorizontalAlignment>
                        <Italic>False</Italic>
                        <Underline>False</Underline>
                        <VerticalAlignment>Near</VerticalAlignment>
                        <Widgets>
                            <TextPanel>
                                <Html>&lt;p style="font-size:28px;text-align:left;line-height:normal;"&gt;&lt;span style="font-family:'MS Gothic Bold', 'MS Gothic';font-weight:700;font-style:normal;font-size:28px;color:#000000;text-align:left;line-height:normal;"&gt;YNA Best PRACTIC&lt;/span&gt;&lt;span style="font-family:'MS Gothic Bold', 'MS Gothic';font-weight:700;font-style:normal;font-size:28px;color:#000000;text-align:left;line-height:normal;"&gt;E&lt;/span&gt;&lt;/p&gt;</Html>
                                <Name />
                                <Rectangle>
                                    <Rectangle X="0" Y="0" Width="483" Height="28" />
                                </Rectangle>
                                <Bold>True</Bold>
                                <BorderColor>Color(argb) = (0, 255, 255, 255)</BorderColor>
                                <BorderWidth>-1</BorderWidth>
                                <FillColor>Color(argb) = (0, 255, 255, 255)</FillColor>
                                <FontName>MS Gothic</FontName>
                                <FontSize>21</FontSize>
                                <ForeColor>Color(argb) = (255, 0, 0, 0)</ForeColor>
                                <HorizontalAlignment>Near</HorizontalAlignment>
                                <Italic>False</Italic>
                                <Underline>False</Underline>
                                <VerticalAlignment>Near</VerticalAlignment>
                            </TextPanel>
                        </Widgets>
                    </Shape>
                    <Shape>
                        <ShapeType>Rectangle</ShapeType>
                        <Name />
                        <Rectangle>
                            <Rectangle X="0" Y="65" Width="1024" Height="21" />
                        </Rectangle>
                        <Bold>False</Bold>
                        <BorderColor>Color(argb) = (255, 121, 121, 121)</BorderColor>
                        <BorderWidth>1</BorderWidth>
                        <FillColor>Color(argb) = (255, 93, 148, 229)</FillColor>
                        <FontName>MS Gothic</FontName>
                        <FontSize>9</FontSize>
                        <ForeColor>Color(argb) = (255, 255, 255, 255)</ForeColor>
                        <HorizontalAlignment>Center</HorizontalAlignment>
                        <Italic>False</Italic>
                        <Underline>False</Underline>
                        <VerticalAlignment>Center</VerticalAlignment>
                        <Widgets>
                            <TextPanel>
                                <Html>&lt;p style="font-size:12px;text-align:center;line-height:normal;"&gt;&lt;span style="font-family:'MS Gothic Regular', 'MS Gothic';font-weight:400;font-style:normal;font-size:12px;color:#FFFFFF;text-align:center;line-height:normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;</Html>
                                <Name />
                                <Rectangle>
                                    <Rectangle X="2" Y="2" Width="1020" Height="16" />
                                </Rectangle>
                                <Bold>False</Bold>
                                <BorderColor>Color(argb) = (255, 121, 121, 121)</BorderColor>
                                <BorderWidth>1</BorderWidth>
                                <FillColor>Color(argb) = (255, 93, 148, 229)</FillColor>
                                <FontName>MS Gothic</FontName>
                                <FontSize>9</FontSize>
                                <ForeColor>Color(argb) = (255, 255, 255, 255)</ForeColor>
                                <HorizontalAlignment>Center</HorizontalAlignment>
                                <Italic>False</Italic>
                                <Underline>False</Underline>
                                <VerticalAlignment>Center</VerticalAlignment>
                            </TextPanel>
                        </Widgets>
                    </Shape>
                    <Shape>
                        <ShapeType>Paragraph</ShapeType>
                        <Name />
                        <Rectangle>
                            <Rectangle X="841" Y="0" Width="180" Height="11" />
                        </Rectangle>
                        <Bold>True</Bold>
                        <BorderColor>Color(argb) = (0, 255, 255, 255)</BorderColor>
                        <BorderWidth>-1</BorderWidth>
                        <FillColor>Color(argb) = (0, 255, 255, 255)</FillColor>
                        <FontName>MS Gothic</FontName>
                        <FontSize>8.25</FontSize>
                        <ForeColor>Color(argb) = (255, 0, 0, 0)</ForeColor>
                        <HorizontalAlignment>Center</HorizontalAlignment>
                        <Italic>False</Italic>
                        <Underline>False</Underline>
                        <VerticalAlignment>Near</VerticalAlignment>
                        <Widgets>
                            <TextPanel>
                                <Html>&lt;p style="font-size:11px;text-align:center;line-height:normal;"&gt;&lt;span style="font-family:'MS Gothic Bold', 'MS Gothic';font-weight:700;font-style:normal;font-size:11px;color:#000000;text-align:center;line-height:normal;"&gt;UserName[&lt;/span&gt;&lt;span style="font-family:'MS Gothic Bold', 'MS Gothic';font-weight:700;font-style:normal;font-size:11px;color:#000000;text-align:center;line-height:normal;"&gt;Company Name&lt;/span&gt;&lt;span style="font-family:'MS Gothic Bold', 'MS Gothic';font-weight:700;font-style:normal;font-size:11px;color:#000000;text-align:center;line-height:normal;"&gt;]&lt;/span&gt;&lt;/p&gt;</Html>
                                <Name />
                                <Rectangle>
                                    <Rectangle X="0" Y="0" Width="180" Height="11" />
                                </Rectangle>
                                <Bold>True</Bold>
                                <BorderColor>Color(argb) = (0, 255, 255, 255)</BorderColor>
                                <BorderWidth>-1</BorderWidth>
                                <FillColor>Color(argb) = (0, 255, 255, 255)</FillColor>
                                <FontName>MS Gothic</FontName>
                                <FontSize>8.25</FontSize>
                                <ForeColor>Color(argb) = (255, 0, 0, 0)</ForeColor>
                                <HorizontalAlignment>Center</HorizontalAlignment>
                                <Italic>False</Italic>
                                <Underline>False</Underline>
                                <VerticalAlignment>Near</VerticalAlignment>
                            </TextPanel>
                        </Widgets>
                    </Shape>
                    <Shape>
                        <ShapeType>Paragraph</ShapeType>
                        <Name />
                        <Rectangle>
                            <Rectangle X="777" Y="22" Width="244" Height="11" />
                        </Rectangle>
                        <Bold>True</Bold>
                        <BorderColor>Color(argb) = (0, 255, 255, 255)</BorderColor>
                        <BorderWidth>-1</BorderWidth>
                        <FillColor>Color(argb) = (0, 255, 255, 255)</FillColor>
                        <FontName>MS Gothic</FontName>
                        <FontSize>8.25</FontSize>
                        <ForeColor>Color(argb) = (255, 170, 0, 0)</ForeColor>
                        <HorizontalAlignment>Near</HorizontalAlignment>
                        <Italic>False</Italic>
                        <Underline>False</Underline>
                        <VerticalAlignment>Near</VerticalAlignment>
                        <Widgets>
                            <TextPanel>
                                <Html>&lt;p style="font-size:11px;text-align:left;line-height:normal;"&gt;&lt;span style="font-family:'MS Gothic Bold', 'MS Gothic';font-weight:700;font-style:normal;font-size:11px;color:#AA0000;text-align:left;line-height:normal;"&gt;|Config | Help | Top Page |&lt;/span&gt;&lt;span style="font-family:'MS Gothic Bold', 'MS Gothic';font-weight:700;font-style:normal;font-size:11px;color:#AA0000;text-align:left;line-height:normal;"&gt; Logout&lt;/span&gt;&lt;span style="font-family:'MS Gothic Bold', 'MS Gothic';font-weight:700;font-style:normal;font-size:11px;color:#AA0000;text-align:left;line-height:normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;</Html>
                                <Name />
                                <Rectangle>
                                    <Rectangle X="0" Y="0" Width="244" Height="11" />
                                </Rectangle>
                                <Bold>True</Bold>
                                <BorderColor>Color(argb) = (0, 255, 255, 255)</BorderColor>
                                <BorderWidth>-1</BorderWidth>
                                <FillColor>Color(argb) = (0, 255, 255, 255)</FillColor>
                                <FontName>MS Gothic</FontName>
                                <FontSize>8.25</FontSize>
                                <ForeColor>Color(argb) = (255, 170, 0, 0)</ForeColor>
                                <HorizontalAlignment>Near</HorizontalAlignment>
                                <Italic>False</Italic>
                                <Underline>False</Underline>
                                <VerticalAlignment>Near</VerticalAlignment>
                            </TextPanel>
                        </Widgets>
                    </Shape>
                    <Textbox>
                        <Text />
                        <Name />
                        <Rectangle>
                            <Rectangle X="877" Y="43" Width="101" Height="22" />
                        </Rectangle>
                        <Bold>False</Bold>
                        <BorderColor>Color(argb) = (255, 121, 121, 121)</BorderColor>
                        <BorderWidth>1</BorderWidth>
                        <FillColor>Color(argb) = (255, 255, 255, 255)</FillColor>

... /*****************************************************************************/

My code to read is:

public class Parse1 {
    static int uniqueNum=1;

    public static void main(String[] args) throws SAXException, IOException,ParserConfigurationException, TransformerException 
    {
        LinkedHashMap hm=new LinkedHashMap();
        //create the DocumentBuilder object.
        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
        Document document = docBuilder.parse(new File("C:/Users/ve00p5199/Desktop/Axure.xml"));
        document.getDocumentElement().normalize();

        NodeList nodeList = document.getElementsByTagName("*");
        System.out.println("total nodes="+nodeList.getLength());

        for (int i = 0; i < nodeList.getLength(); i++) 
 {
            Node node = nodeList.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                // do something with the current element
                System.out.print(node.getNodeName() + "= ");
                NodeList childNodes = node.getChildNodes();
                for (int j = 0; j < childNodes.getLength(); j++) {
                    Node cN = childNodes.item(j);
                    if (cN.getNodeType() == Node.TEXT_NODE) {
                        hm.put(node.getNodeName() + "-" + uniqueNum + ":",cN.getTextContent());
                        uniqueNum++;
                        System.out.println(cN.getTextContent());
                    }
                }
            }
        }
/*              System.out.println("*****writing in files*******"); 
        PrintWriter f0 = new PrintWriter(new FileWriter("C:/Users/ve00p5199/Desktop/values.txt"));
        Iterator iterator = hm.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry mapEntry = (Map.Entry) iterator.next();
            //System.out.println(mapEntry.getKey()+" :" + mapEntry.getValue());
            f0.println(mapEntry.getKey()+" :" + mapEntry.getValue());
        }*/

    }
}

Now i need to write it again in desired XML format.. Suggest me a best way to read the XML A and write it in XML B which will have diffrerent formatting and tags. 1) Above code is able to read the XML but it produces lots of whitespaces when i print it. 2)I want it to store it in a datastuctue(or any way to achieve it) so that I can reuse it for writting purpose according to the requirement.

How to count a specific tags in xml file?

XML:

<chapter>
<openr><title><num aid:pstyle="_CN">1</num></openr>
<media.block id="fig001"><media type="image"/><caption aid:pstyle="Caption"><num>FIG. 1.1&#x2002;</num><para><txt>some text</txt></para></caption></media.block>
<txt>some</txt>
<media.block id="fig002"><media type="image"/><caption aid:pstyle="Caption"><num>FIG. 1.2&#x2002;</num><para><txt>some text</txt></para></caption></media.block>
</chapter>

I need to extract the count of <media.block(to get the no.of figures in a document) and the content of <num aid:pstyle="_CN">1</num>(here ans=1).

I don't know how to access XML element using extendscript. Atleast a hint would be more than enough

How to load and extract xml file data into phpmyadmin database?

I have an xml file with multiple nodes sub nodes and attributes and I want to load its data into phpmyadmin database. Is it necessary to first create tables before loading data? What is the simplest way to carry out this task? Any hep is highly appreciated.

Thanks In Advance :)

comparing two xml files irrespective of their order

I am currently working on a python project and stuck in one little problem related to comparison of two XML files using python. Now for instance assume that we have two xml files:

A file:

<m1:time timeinterval="5">
   <m1:vehicle distance="40" speed="5"\>

   <m1:location hours = "1" path = '1'\>
      <m1:feature color="2" type="a">564</m1:feature>
      <m1:feature color="3" type="b">570</m1:feature>
      <m1:feature color="4" type="c">570</m1:feature>
   <\m1:location>

   <m1:location hours = "5" path = '1'\>
      <m1:feature color="6" type="a">560</m1:feature>
      <m1:feature color="7" type="b">570</m1:feature>
      <m1:feature color="8" type="c">580</m1:feature>   
   <\m1:location>

   <m1:location hours = "9" path = '1'\>
      <m1:feature color="10" type="a">560</m1:feature>
      <m1:feature color="11" type="b">570</m1:feature>
      <m1:feature color="12" type="c">580</m1:feature>   
   <\m1:location>
</m1:time>

B file:

<m1:time timeinterval="6">
   <m1:vehicle distance="40" speed="5"\>

   <m1:location hours = "5" path = '1'\>
      <m1:feature color="6" type="a">560</m1:feature>
      <m1:feature color="7" type="b">570</m1:feature>
      <m1:feature color="8" type="c">580</m1:feature>   
   <\m1:location>

   <m1:location hours = "1" path = '1'\>
      <m1:feature color="2" type="a">564</m1:feature>
      <m1:feature color="3" type="b">570</m1:feature>
      <m1:feature color="4" type="c">570</m1:feature>
   <\m1:location>

   <m1:location hours = "9" path = '1'\>
      <m1:feature color="10" type="a">560</m1:feature>
      <m1:feature color="11" type="b">570</m1:feature>
      <m1:feature color="12" type="c">580</m1:feature>   
   <\m1:location>

</m1:time>

The thing which i want to ask is how to compare A file with B file making sure that though the order of "location" element is different in both the files, still they are same. I have tried all kinds of approach and also tried referring to this question, but in this project i want to develop an approach of my own and I cant use any already available tools.

The approach which I have tried so far is:

I am working with LXML and I am getting the individual attributes of children from A file and storing them in list. then I am comparing B file's elements and children attributes with the values stored in that list.

First all, this approach is not working and neither I am able to think of any efficient procedure to accomplish this task. Can you guys shed some light over this?

Thank you.

Date format read from XML file

That's my problem: I read the date from a xml file in the yyyy-mm-ddThh:mm:ss format. Example: 2015-06-10T08:56:44

Then I want to write this date in a new file but only in this format: 06/10/2015 (that is "MM/dd/yyy, without the time).

What I tried at first it was:

Date_Creation = Date.Parse(noeudEnf.InnerText.ToString)

But then I get the time and I don't want it. So I tried to do this:

Date_Creation = DateTime.ParseExact(Date_Creation, "dd/MM/yyyy", CultureInfo.InvariantCulture)

I thought the problem was the "-" instead of "/" in the xml file. I replaced them but I got the same. I don't know what's next! Please, help. Thank you!

Read in large amount of XML files with inconsistent namespace

I am trying to read in data from a large amount of XML files into a pandas dataframe. There are more than 40k files, with their file size varying between 1MB and 10MB. This is what the file structure looks like:

xml = '''
<ns2:GetProfile xmlns:ns2="http://ift.tt/1RKNso9">
  <StatusMessage/>
  <StatusCode>0</StatusCode>
  <ns2:Profile>
    <ns2:stObservation>
      <Date>2014-11-25</Date>
      <Sequence>18</Sequence>
      <Value>226</Value>
      <NullStatus>0</NullStatus>
      <Peak>true</Peak>
    </ns2:stObservation>
    <ns2:stObservation>
      <Date>2014-01-04</Date>
      <Sequence>13</Sequence>
      <Value>557</Value>
      <NullStatus>0</NullStatus>
      <Peak>false</Peak>
    </ns2:stObservation>
  </ns2:Profile>
</ns2:GetProfile>
'''

Each file represents time series data of a single object. I'm using the objectify function from lxml, like so:

from lxml import objectify, etree
root = objectify.fromstring(xml)

However, there is an unused namespace declared, but not for all nodes. So when trying to acces Date, it throws an error.

print root.Profile.stObservation.Date 
#AttributeError: no such child: {http://ift.tt/1HrtxeD

Then, when I remove the namespace, it works.

xml_no_ns2 = '''
<GetProfile> 
    <StatusMessage/>
    <StatusCode>0</StatusCode>
    <Profile>
        <stObservation>
            <Date>2014-11-25</Date>
            <Sequence>18</Sequence>
            <Value>226</Value>
            <NullStatus>0</NullStatus>
            <Peak>true</Peak>
        </stObservation>
        <stObservation>
            <Date>2014-01-04</Date>
            <Sequence>13</Sequence>
            <Value>557</Value>
            <NullStatus>0</NullStatus>
            <Peak>false</Peak>
        </stObservation>
    </Profile>
</GetProfile>
'''
root_no_ns2 = objectify.fromstring(xml_no_ns2)
print root_no_ns2.Profile.stObservation.Date 

Due to the large amount of files I am not so flexibel for work-arounds. But I am sure there should be a proper solution.

XSLT - templates not applied to some nodes

I have a xml like this,

<?xml version="1.0" encoding="UTF-8"?>
<catalog>
    <cd>
        <title>Empire Burlesque</title>
        <artist>Bob Dylan</artist>
        <country>USA</country>
        <company>Columbia</company>
        <price>10.90</price>
        <year>1985</year>
    </cd>
    <cd>
        <title>Hide your heart</title>
        <artist>Bonnie Tyler</artist>
        <country>UK</country>
        <company>CBS Records</company>
        <price>9.90</price>
        <year>1988</year>
    </cd>
    <cd>
        <title>Unchain my heart</title>
        <artist>Joe Cocker</artist>
        <country>USA</country>
        <company>EMI</company>
        <price>8.20</price>
        <year>1987</year>
    </cd>
</catalog>

What I need to do is remove <year> node from original xml, change <artist> node as <name> and add new nodes(<time>, <version>) at the end of final <cd> node.

I've written following XSLT code,

<xsl:variable name="time" as="xs:dateTime" select="current-dateTime()"/>
<xsl:variable name="version" as="xs:double" select="1.0"/>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="catalog/cd/artist">
        <name><xsl:apply-templates/></name>
    </xsl:template>

    <xsl:template match="catalog/cd/year"/>

    <xsl:template match="catalog/cd[last()]">
        <xsl:copy-of select="."/>
        <time><xsl:value-of select="$time"/></time>
        <version><xsl:value-of select="$version"/></version>
    </xsl:template>

Output is follows,

<?xml version="1.0" encoding="UTF-8"?><catalog>
    <cd>
        <title>Empire Burlesque</title>
        <name>Bob Dylan</name>
        <country>USA</country>
        <company>Columbia</company>
        <price>10.90</price>

    </cd>
    <cd>
        <title>Hide your heart</title>
        <name>Bonnie Tyler</name>
        <country>UK</country>
        <company>CBS Records</company>
        <price>9.90</price>

    </cd>
    <cd>
        <title>Unchain my heart</title>
        <artist>Joe Cocker</artist>
        <country>USA</country>
        <company>EMI</company>
        <price>8.20</price>
        <year>1987</year>
    </cd>
    <time>2015-06-29T13:41:49.885+05:30</time>
    <version>1</version>
</catalog>

As you see, code is working fine but only final node seems not applied the templates (in final node <artist> node has not changed <year> node appears).

How can I solve this problem.

Retrieve Attributes and NameID from a SAML Response (XML)

SAML Response

<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_8e8dc5f69a98cc4c1ff3427e5ce34606fd672f91e6" Version="2.0" IssueInstant="2014-07-17T01:01:48Z" Destination="http://ift.tt/1Hpln6h" InResponseTo="ONELOGIN_4fee3b046395c4e751011e97f8900b5273d56685">
  <saml:Issuer>http://ift.tt/1GTWPPF;
  <samlp:Status>
    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
  </samlp:Status>
  <saml:Assertion xmlns:xsi="http://ift.tt/ra1lAU" xmlns:xs="http://ift.tt/tphNwY" ID="_d71a3a8e9fcc45c9e9d248ef7049393fc8f04e5f75" Version="2.0" IssueInstant="2014-07-17T01:01:48Z">
    <saml:Issuer>http://ift.tt/1GTWPPF;
    <saml:Subject>
      <saml:NameID SPNameQualifier="http://ift.tt/1Hpln6j" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient">_ce3d2948b4cf20146dee0a0b3dd6f69b6cf86f62d7</saml:NameID>
      <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
        <saml:SubjectConfirmationData NotOnOrAfter="2024-01-18T06:21:48Z" Recipient="http://ift.tt/1Hpln6h" InResponseTo="ONELOGIN_4fee3b046395c4e751011e97f8900b5273d56685"/>
      </saml:SubjectConfirmation>
    </saml:Subject>
    <saml:Conditions NotBefore="2014-07-17T01:01:18Z" NotOnOrAfter="2024-01-18T06:21:48Z">
      <saml:AudienceRestriction>
        <saml:Audience>http://ift.tt/1GTWRae;
      </saml:AudienceRestriction>
    </saml:Conditions>
    <saml:AuthnStatement AuthnInstant="2014-07-17T01:01:48Z" SessionNotOnOrAfter="2024-07-17T09:01:48Z" SessionIndex="_be9967abd904ddcae3c0eb4189adbe3f71e327cf93">
      <saml:AuthnContext>
        <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml:AuthnContextClassRef>
      </saml:AuthnContext>
    </saml:AuthnStatement>
    <saml:AttributeStatement>
      <saml:Attribute Name="uid" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
        <saml:AttributeValue xsi:type="xs:string">test</saml:AttributeValue>
      </saml:Attribute>
      <saml:Attribute Name="mail" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
        <saml:AttributeValue xsi:type="xs:string">test@example.com</saml:AttributeValue>
      </saml:Attribute>
      <saml:Attribute Name="eduPersonAffiliation" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
        <saml:AttributeValue xsi:type="xs:string">users</saml:AttributeValue>
        <saml:AttributeValue xsi:type="xs:string">examplerole1</saml:AttributeValue>
      </saml:Attribute>
    </saml:AttributeStatement>
  </saml:Assertion>
</samlp:Response>

Need to retrieve attribute from above xml


array (
  'uid' => 
  array (
    0 => 'test',
  ),
  'mail' => 
  array (
    0 => 'test@example.com',
  ),
  'eduPersonAffiliation' => 
  array (
    0 => 'users',
    1 => 'examplerole1',
  ),
)

What i tried

$p = xml_parser_create();
xml_parse_into_struct($p, $http_result_arr_data, $vals, $index);
xml_parser_free($p);
print_r($index);

The above is not much user friendly and it is more over not simple to handle, because keys get diff when we refresh every time.

Please suggest best approach to get attribute from saml response