Affichage des articles dont le libellé est Active questions tagged xml - Stack Overflow. Afficher tous les articles
Affichage des articles dont le libellé est Active questions tagged xml - Stack Overflow. Afficher tous les articles

dimanche 2 août 2015

Include svg file in html vs xml

I m new to svg,

I took a look svg creation for making simple circle.

In w3schools example:

<!DOCTYPE html>
<html>
<body>

<svg height="100" width="100">
  <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
  Sorry, your browser does not support inline SVG.  
</svg> 

</body>
</html>

And some other resources,

Like this,

<!DOCTYPE html>     
<html xmlns="http://ift.tt/lH0Osb">     
  <head>

    <meta charset="UTF-8"/>     
    <title>SVG Included with <object> tag</title>

  </head>
  <body>

    <h1>An SVG rectangle (via <object> tag)</h1>

    <object type="image/svg+xml" data="web_square.svg">     
      <img src="web_square.png" alt="Blue Square"/>     
    </object>

  </body>
</html>

I want to know, here what it is web_square.svg, is it svg file? yes means, where is the content?

I want to know the way include svg file in xml and html.

Please can anyone give me your suggestions?

Thank you.

NHibernate infers incorrect type on property in hbm file

I have an existing HBM XML file to which I need to add two new properties. When I add these, NHibernate appears to infer incorrect type and reports PropertyAccessException. Explicitly setting the property also doesn't help. Code below:

Domain:

public class Centre : VersionedDomainObject
{
    public virtual DateTime? DateDeleted { get; set; }
    public virtual bool Deleted { get; set; }

    public virtual string CentreName { get; set; }
    public virtual string CentreNumber { get; set; }

    public virtual Iesi.Collections.Generic.ISet<CentreAddress> Addresses { get; set; }
    public virtual Iesi.Collections.Generic.ISet<CentreSource> CentreSources { get; set; }



    public virtual string Telephone { get; set; }
    public virtual string Fax { get; set; }
    public virtual string Url { get; set; }
    public virtual string Email { get; set; }
    public virtual bool CentreVisibleOptIn { get; set; }
    public virtual decimal? Latitude { get; set; }
    public virtual decimal? Longitude { get; set; }
...

}

HBM XML File:

<id name="Id" access="property" column="ID">
  <generator class="identity" />
</id>

<version name="_version" column="VERSION" unsaved-value="-1"  access="field"/>

<property name="LastAmended" not-null="true"/>
<property name="DateCreated" not-null="true"/>

<property name="DateDeleted" />
<property name="Deleted" />

<property name="CentreName" />
<property name="CentreNumber" />

<property name="Telephone"  />
<property name="Fax" />
<property name="Url" />
<property name="Email" />

<property name="CentreVisibleOptIn" not-null="true" />
<property name="AcceptsPrivateCandidates"/>

<property name="Contact" />

<property name="AwardingOrganisationId" not-null="true"/>

<many-to-one name="GeographicRegion" class="CommonData.Domain.Common.Location.GeographicRegion, CommonData.Domain.Common" column="GeographicRegionId" />

<many-to-one name="CategoryType" column="CategoryTypeId" class="CommonData.Domain.Centre.CategoryType, CommonData.Domain.Common.Operational" />

<property name="Latitude" />
<property name="Longitude" />

<set name="Addresses" cascade="all-delete-orphan" lazy="true" inverse="true">
  <key column="CentreId" not-null="true" />
  <one-to-many class="CommonData.Domain.Centre.CentreAddress, CommonData.Domain.Centre"/>
</set>

<set name="CentreSources" cascade="all-delete-orphan" lazy="true" inverse="true">
  <key column="CentreId" not-null="true" />
  <one-to-many class="CommonData.Domain.Centre.CentreSource, CommonData.Domain.Centre"/>
</set>

Database:

Latitude and Longitude are newly added columns in database with type decimal(9,6).

Deserializing XML attribute 'xsi:type'

This is my first time to ask on stackoverflow and also the first time to work with xml files , so I don't think it can get worse than that. I need to deserialize some long XML but the part thats bugging me is the following:

<CastleConfigSub xmlns:xsi="http://ift.tt/ra1lAU" xsi:noNamespaceSchemaLocation="../xsd/c5c.xsd" Format="1">
  <ConfigFile Name="EdgeDetection">
    <Interfaces>
      <Interface Name="EdgeDetectionModule">
        <Doc />
         <Functions>
          <Function Name="MonitorNoChanges">
            <Doc>This Function checks that no edge has been detected at the specified                    digital channel for a specific time in msec
                1. DigitalChanelToWatch: This is the digital Input channel to monitor                      edges on it.
                2. TimeOut: This is the monitoring Period for the edges on the digitial                    input channel.
            </Doc>
            <Args>
              <Arg xsi:type="ArgEnum" Name="DigitalChanelToWatch"                                      Enum="DigitalInChannelID" />
              <Arg xsi:type="ArgValue" Name="TimeOut" EncodedType="uint32"                               Unit="msec" />
            </Args>
           </Function>
          </Functions>
        </Interface>
      </Interfaces>
    </ConfigFile>
  </CastleConfigSub>
public class CastleConfigSub
{
    [XmlElement("Options")]
    public Options options = new Options();

    [XmlElement("ConfigFile")]
    public ConfigFile configFile= new ConfigFile();


} 
public class ConfigFile
{
    [XmlElement("Doc")]
    public string doc {get; set;} 
    [XmlElement("History")]
    public History history = new History();
    [XmlElement("Includes")]
    public Includes includes = new Includes();
    [XmlElement("Options")]
    public Options options = new Options();
    [XmlElement("DataTypes")]
    public DataTypes dataTypes = new DataTypes();

    [XmlArray("Interfaces")]
    [XmlArrayItem("Interface")]
    public List<Interface> interfaces = new List<Interface>();


}
 public class Interface
{
    [XmlAttribute("Name")]
    public string name="";
    [XmlElement("Doc")]
    [XmlArray("Functions")]
    [XmlArrayItem("Function")]
    public List<Function> functions = new List<Function>();
}
public class Function
{

    [XmlAttribute("Name")]
    public string name="";
    [XmlElement("Doc")]
    public string doc="";
    [XmlArray("Args")]
    [XmlArrayItem("Arg")]
    public List<Arg> args = new List<Arg>();
}
public class Arg
{
    [XmlAttribute ("xsi:type")]
    public string type = "";
    [XmlAttribute("Name")]
    public string name ="";
    [XmlAttribute("EncodedType")]
    public string encodedType="";
    [XmlAttribute("Enum")]
    public string enumName ="";
    [XmlAttribute("Unit")]
    public string unit="";

}

I know everthing is so messy but i couldnt do any better :/.

Getting data from xml file and plotting in plotting in php

I'm reading through an xml file to get data. The xml looks like this:

<packet>
<item>
     <timestamp>0</timestamp>
     <<id>10</id>
     <id>14</id>
     <id>2</id>
     <id>7</id>
     <id>6</id>
</item>
<item>
     <timestamp>1</timestamp>
     <id>4</id>
     <id>4</id>
     <id>8</id>
     <id>3</id>
     <id>2</id>
     <id>12</id>
</item>
...
</packet>

I cut the xml file because its long. The number of id within each timestamp varies. I already got the code to read through the xml file

<?php
if(file_exists('myfile.xml'))
{
  $xml = simplexml_load_file ("myfile.xml");
}
else {
  exit ('Could not load the file...');
}

foreach($xml->item as $item)
{
   echo $item->timestamp.'<br>';
   {
      foreach($item->id as $id)
      {
        echo $id.' ';
      }
      echo '<br>';
      echo '<br>';
   }
}

And the result is something like this

0
10 14 2 7 6

1
4 4 8 3 2 12

I just don't know how to got about plotting this in php in such a way that the timestamp is on the x-axis and the id gets plotted on the y-axis

Reading Transformer result line by line (Java)

I'm using Transformer to prettify and to insert indentation to an XML which is originally one big line. Here is my code:

BufferedWriter br = null;
Source xmlInput = new StreamSource(inputSR);
StringWriter stringWriter = new StringWriter();
StreamResult xmlOutput = new StreamResult(stringWriter);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformerFactory.setAttribute("indent-number", 2);
Transformer transformer = transformerFactory.newTransformer(); 
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(xmlInput, xmlOutput);

How can I write the xmlOutput to a file, line by line (without loading the whole string to the memory)?

Convert PHP array from XML that contains duplicate elements

Up until now, I've been using the snippet below to convert an XML tree to an array:

$a = json_decode(json_encode((array) simplexml_load_string($xml)),1);

..however, I'm now working with an XML that has duplicate key values, so the array is breaking when it loops through the XML. For example:

<users>
    <user>x</user>
    <user>y</user>
    <user>z</user>
</users>

Is there a better method to do this that allows for duplicate Keys, or perhaps a way to add an incremented value to each key when it spits out the array, like this:

$array = array(
    users => array(
        user_1 => x,
        user_2 => y,
        user_3 => z
    )
)

I'm stumped, so any help would be very appreciated.

Include multiple similar XSLT files without conflict or overriding templates

I'm trying to devise a way to store data in XSLT files, yet also process them using XSLT to produce an XML file at the end. These are my two source XSLT files, and the result I am after:

File 1:

<fruit>
    <xsl:variable name="amount">10</xsl:variable>
    <type>apple</type>
    <quantity><xsl:value-of select="$amount"/></quantity>
    <remaining><xsl:value-of select="$amount"/></remaining>
</fruit>

File 2:

<fruit>
    <xsl:variable name="amount">20</xsl:variable>
    <type>banana</type>
    <quantity><xsl:value-of select="$amount"/></quantity>
    <remaining><xsl:value-of select="$amount"/></remaining>
</fruit>

Output:

Fruit: apple 10/10
Fruit: banana 20/20

I have no problem writing the XSLT code to take a single XML file and produce the output I want, but I am stuck with how to combine the two files together. If I use <xsl:include>, then I need to wrap the files in <xsl:template> elements which is fine, but then I will have multiple templates the same so I'll either get an error, or with <xsl:import> one will be overridden by the other.

I eventually want to extend this to more than two files without having to alter my XSLT code beyond the include/import lines, so it won't work giving each template a custom name, because I want my global XSLT to be able to apply a transform to all <fruit> elements, without having to specify each template name manually.

Is there any way to achieve this?

How to implement onClickListener on a custom adapter?

I am learning to make a simple time table managing application. I have a list of courses displayed. Each item in a list is a textview + a delete button. The onClick Listener in my list item isn't working as expected. When I click on the delete button, it is working fine. However, I want to open up some other activity when user clicks on the textview of the list item.

Code:

ShowAll.java (the main activity in which I am displaying a list of classes)

package com.example.android.mytimetable;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;


public class ShowAll extends ActionBarActivity {
    private ArrayAdapter<String> adapter ;
    ArrayList <ClassDetail> classesDetail ;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_all);
        this.bindAdapter();

        ListView listView = (ListView) this.findViewById(R.id.class_list);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Log.v("Item", "clicked");
                Intent intent = new Intent(view.getContext(), ShowAllClicked.class);
                ClassDetail classDetail = classesDetail.get(i);
                Bundle bundle = new Bundle();
                bundle.putString("CLASS_NAME", classDetail.class_name);
                bundle.putString("BUILDING", classDetail.building);
                bundle.putString("MONDAY_START", classDetail.monday_start);
                bundle.putString("MONDAY_END", classDetail.monday_end);
                bundle.putString("TUESDAY_START", classDetail.tuesday_start);
                bundle.putString("TUESDAY_END", classDetail.tuesday_end);
                bundle.putString("WEDNESDAY_START", classDetail.wednesday_start);
                bundle.putString("WEDNESDAY_END", classDetail.wednesday_end);
                bundle.putString("THURSDAY_START", classDetail.thursday_start);
                bundle.putString("THURSDAY_END", classDetail.thursday_end);
                bundle.putString("FRIDAY_START", classDetail.friday_start);
                bundle.putString("FRIDAY_END", classDetail.friday_end);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });
    }

    void bindAdapter() {
        DBHelper db = new DBHelper(this);
        classesDetail = db.getClassesDetail();
        ArrayList <String> classes = new ArrayList<>();
        for(int i = 0 ; i < classesDetail.size() ; i++) {
            Log.v("Adding ", classesDetail.get(i).class_name);
            classes.add(classesDetail.get(i).class_name);
        }
        if(classes.size() == 0)
            ((TextView) this.findViewById(R.id.holiday)).setText(getString(R.string.noClass));
        CustomArrayAdapter customArrayAdapter = new CustomArrayAdapter(classes, this);
        ((ListView) this.findViewById(R.id.class_list)).setAdapter(customArrayAdapter);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_show_all, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.

        return super.onOptionsItemSelected(item);
    }
}

activity_show_all.xml (the xml layout of ShowAll.java)

<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    xmlns:tools="http://ift.tt/LrGmb4" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.example.android.mytimetable.ShowAll"
    android:orientation="vertical">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/class_list"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/holiday"/>

</LinearLayout>

CustomArrayAdapter.java (The custom array adapter file)

package com.example.android.mytimetable;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.TextView;

import java.util.ArrayList;

/**
 * Created by Aman Goel on 02-08-2015.
 */
public class CustomArrayAdapter extends BaseAdapter implements ListAdapter {
    private ArrayList <String> list = new ArrayList<String>();
    private Context context;

    public CustomArrayAdapter(ArrayList <String> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int pos) {
        return list.get(pos);
    }

    @Override
    public long getItemId(int pos) {
        return 0;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        View view = convertView;
        if(view == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.list_item, null);
        }

        ((TextView) view.findViewById(R.id.list_item)).setText(list.get(position));

        Button deleteBtn = (Button) view.findViewById(R.id.delete);

        deleteBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DBHelper db = new DBHelper(context);
                db.deleteClass(list.get(position));
                list.remove(position);
                notifyDataSetChanged();
            }
        });
        return view;
    }
}

list_item.xml (The layout of each list view)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minHeight="?android:attr/listPreferredItemHeight"
        android:gravity="center_vertical"
        android:id="@+id/list_item"
        android:focusableInTouchMode="false"
        android:clickable="false"
        android:focusable="false"/>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/delete"
        android:id="@+id/delete"/>

</LinearLayout>

I tried to take help from here: Set onClickListener into custom adapter and here: Where sould I place the onClickListener on a Custom ListView?

However, I am still not able to make the adapter work. Any help would be appreciated

xml with multiple data processing in django spyne

i have a server running django and spyne, i want to configure spyne to accept xml like below:

<soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE"
xmlns:loc="http://ift.tt/1noaANI">
<soapenv:Header/>
<soapenv:Body>

<loc:sendSms>
<loc:addresses>[addresses]</loc:addresses>
<loc:senderName>[senderName]</loc:senderName>
<loc:message>[message]</loc:message>
<loc:receiptRequest>
    <endpoint></endpoint>
    <interfaceName></interfaceName>
    <correlator></correlator>
</loc:receiptRequest>
</loc:sendSms>

<loc:sendSms>
<loc:addresses>[addresses]</loc:addresses>
<loc:senderName>[senderName]</loc:senderName>
<loc:message>[message]</loc:message>
<loc:receiptRequest>
    <endpoint></endpoint>
    <interfaceName></interfaceName>
    <correlator></correlator>
</loc:receiptRequest>
</loc:sendSms>

.
.
.

</soapenv:Body>
</soapenv:Envelope>

is it possible? how should i do so?

and changing the client is impossible, so i have to work with this format.

EDIT:

what i have done till now:

model:

class ReceiptRequestItem(ComplexModel):
    __namespace__ = 'http://ift.tt/1noaANI'
    endpoint = Unicode()
    interfaceName = Unicode()
    correlator = Unicode()

service:

class MOMessageService(ServiceBase):
    @rpc(Unicode, Unicode, Unicode, ReceiptRequestItem,
         _returns=Unicode,
         _in_variable_names={'sender_name': 'senderName',
                             'receipt_request': 'receiptRequest'},
         _operation_name='sendSms')
    def send_sms(ctx, addresses, sender_name, message, receipt_request):
         print addresses, sender_name, message, receipt_request
         return

application:

mo_message_app = Application([MOMessageService],
                             'http://ift.tt/1noaANI',
                             in_protocol=Soap11(validator='soft'),
                             out_protocol=Soap11(), )

mo_message_service = csrf_exempt(DjangoApplication(mo_message_app))

this works when there is just one

<loc:sendSms>

though there is a problem with namespaces and lxml validator will result in error.

the question is how to change the code to accept multiple tags.

P.S: also i will be grateful if someone tell me how to fix my problem with namespaces. :)

EDIT2:

this is the error I encounter while using lxml validator:

<?xml version='1.0' encoding='UTF-8'?>
<senv:Envelope xmlns:senv="http://ift.tt/sVJIaE">
    <senv:Body>
        <senv:Fault>
            <faultcode>senv:Client.SchemaValidationError</faultcode>
            <faultstring>:1:0:ERROR:SCHEMASV:SCHEMAV_ELEMENT_CONTENT: Element 'endpoint': This element is not expected.
                Expected is one of ( {http://ift.tt/1gArPvF,
                {http://ift.tt/1OIdesO,
                {http://ift.tt/1gArRUy ).
            </faultstring>
            <faultactor></faultactor>
        </senv:Fault>
    </senv:Body>
</senv:Envelope>

How to increment month in java xml (using DOM parsing)

I am currently working on xml data project. So far I have successfully connect my data.xml file to my java project using dom parser. Furthermore. I am also able to get the node values and print in on the console. What I am struggling with now is I want to write a logic loop at the end of the main class which the purpose is to increase the month of the start date by one such as 1/1/2002 -> 2/1/2002 ->3/1/2002. My date format is MM/dd/yyyy. I have part of my code below to show what I currently have. Help will be appertained. Thanks.

data.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<data>
   <username>theBigAristotle</username>
   <startdate>01/01/2002</startdate>
   <enddate>01/31/2002</enddate>
</data>

main.java

 public class main
        {      
          public static void main(String[] args) 
          {
              Calendar cal =null;

              String username = null;
              String startdate = null;
              String enddate = null;
              String date = null;
              String date_end = null;

            try {   

                  //read the xml file 

                  File data = new File("data.xml");  
                  DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();         
                  DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();           
                  Document doc = dBuilder.parse(data);         
                  doc.getDocumentElement().normalize();

                  NodeList nodes = doc.getElementsByTagName("data");      

                    for (int i = 0; i < nodes.getLength(); i++) {      
                  Node node = nodes.item(i);           
                      if (node.getNodeType() == Node.ELEMENT_NODE) {       
                           Element element = (Element) node;    

                           username = getValue("username", element);
                           startdate = getValue("startdate", element);
                           enddate = getValue("enddate", element);
                         }
                     }

           date = startdate;    

           //initial date
           Date date_int = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH).parse(date);
           cal = Calendar.getInstance();
           cal.setTime(date_int);

           //end date
           Date end_date = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH).parse(enddate);
           Calendar end_date_cal = Calendar.getInstance();  
           end_date_cal.setTime(end_date);

           date = date_end; 

              //write the content in xml file
                TransformerFactory transformerFactory = TransformerFactory.newInstance();
                Transformer transformer = transformerFactory.newTransformer();
                DOMSource source = new DOMSource(doc);
                StreamResult result = new StreamResult(new File("data.xml"));
                transformer.transform(source, result);

        } catch (Exception ex) {    
          log.error(ex.getMessage());       
          ex.printStackTrace();       
        }


      private static String getValue(String tag, Element element) {  
            NodeList nodes = element.getElementsByTagName(tag).item(0).getChildNodes();   
            Node node = (Node) nodes.item(0);   
            return node.getNodeValue();   
          }

      private static void setValue(String tag, Element element , String input) {  
            NodeList nodes = element.getElementsByTagName(tag).item(0).getChildNodes();   
            Node node = (Node) nodes.item(0); 
            node.setTextContent(input);


          } 

What is the best way or approach to create an Android app User Interface? (see details below)

  1. We can create all of the View objects in Java code.
  2. We can create an XML file and have the system convert it to objects at run time. OR
  3. We can use the Designer (Android Studio) to interactively create the XML file. Please describe the best way to build android app UI.

How to Set Scroll View to this XML File?

I'm beginner in android and write this code for my activity XML file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="4"
    >
    <ImageView
        android:id="@+id/ExplainImage"
        android:layout_gravity="center"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:src="@drawable/abc_btn_check_material">
    </ImageView>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/MAINLABEL"
        android:layout_weight="3"
        android:layout_gravity="center"
        android:height="2dp" />
  </LinearLayout>


and show and work good,but i want scroll text view in big text and change text view part to this:

<ScrollView
        xmlns:android="http://ift.tt/nIICcg"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        >
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/MAINLABEL"
        android:layout_weight="3"
        android:layout_gravity="center"
        android:height="2dp" />
   </ScrollView>


but not show text to me or image,what happen?how can i solve that?thanks.

How to convert HTML into Blogger XML Template?

I am a newbie web developer and I mainly work on HTML templates (site templates) I have created some blogger templates but very classic I mean old type. I am good at creating html files and I have created lots of now my Client wants one of my html template to be used on her blogger blog.

I know blogger parses xml type so my question is I want to convert HTML into XML for blogger with all read more scripts etc correctly.

Android How can i make a gradient of this EditText

This colour code is given to me .

  background-image:-moz-linear-gradient(53% 0% -90deg,rgb(255,255,255) 0%,rgb(204,204,204) 100%); 
    background-image:linear-gradient(-90deg,rgb(255,255,255) 0%,rgb(204,204,204) 100%);
    width:787px;
    height:142px;
    border-color:rgb(221,221,221);
    border-width:1px;
    border-style:solid;\

And ask for this this is a preview I try This code in my background of edittext

<?xml version="1.0" encoding="utf-8"?>
<!--  res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://ift.tt/nIICcg"
    android:shape="rectangle" android:padding="10dp">
    <solid android:color="#FFFFFF"/>

    <corners
        android:bottomRightRadius="20dp"
        android:bottomLeftRadius="20dp"
        android:topLeftRadius="20dp"
        android:topRightRadius="20dp"/>
    <gradient
        android:startColor="#ffcccccc"
        android:centerColor="#e7e7e8"
        android:type="linear"
        android:endColor="#ffcccccc"
        android:angle="90" />
</shape>

Now I want same as picture but i cant get It. How can i set this ?

How to update xml files in java

I have a xml file call data.xml like the code below. The project can run from client side no problem and it can read the xml file. The problem I have now is I I want to write a function that can update the startdate and enddate. I have no idea how to get start. Help will be appreciated.

  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<data>
       <username>admin</username>
       <password>12345</password>
       <interval>1</interval>
       <timeout>90</timeout>
       <startdate>01/01/2013</startdate>
       <enddate>06/01/2013</enddate>
       <ttime>1110</ttime>
    </data>

my main.java

    public class main
    {
     public static void main(String[] args) 
      {

    try {   

              //read the xml      
              File data = new File("data.xml");  
              DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();         
              DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();           
              Document doc = dBuilder.parse(data);         
              doc.getDocumentElement().normalize();

     for (int i = 0; i < nodes.getLength(); i++) {     
              Node node = nodes.item(i);           
                if (node.getNodeType() == Node.ELEMENT_NODE) {     
                    Element element = (Element) node;   
                    username = getValue("username", element);
                    startdate = getValue("startdate", element);
                    enddate = getValue("enddate", element);
                  }
       }


  date = startdate; 
  Date date_int = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH).parse(date); 
  cal2 = Calendar.getInstance(); 
 cal2.setTime(date_int); 


     //loop the child node to update the initial date
              for (int i = 0; i < nodes.getLength(); i++) {    
                  Node node = nodes.item(i);           
                    if (node.getNodeType() == Node.ELEMENT_NODE) {     
                        Element element = (Element) node;

                        setValue("startdate", element , date_int.toString());
                  }
              }

            //write the content in xml file
                TransformerFactory transformerFactory = TransformerFactory.newInstance();
                Transformer transformer = transformerFactory.newTransformer();
                DOMSource source = new DOMSource(doc);
                StreamResult result = new StreamResult(new File("data.xml"));
                transformer.transform(source, result);

        } catch (Exception ex) {    
          log.error(ex.getMessage());       
          ex.printStackTrace();       
        }
    }


      private static void setValue(String tag, Element element , String input) {  
            NodeList nodes = element.getElementsByTagName(tag).item(0).getChildNodes();   
            Node node = (Node) nodes.item(0); 
            node.setTextContent(input);

    }

how do i validate xml against dtd using python?

I have a xml file "sample.xml" as:

<?xml version="1.0" encoding="UTF8" ?>
< !DOCTYPE nodedescription SYSTEM "sample.dtd" >
<node_description>
    <target id="windows 32bit">
        <graphics>nvidia_970</graphics>
        <power_plug_type>energenie_eu</power_plug_type>
        <test>unit test</test>
   </target>
   <target id="windows 64bit">
       <graphics>nvidia_870</graphics>
       <power_plug_type>energenie_eu</power_plug_type>
       <test>performance test</test>
   </target>
</node_description>

and respective dtd as "sample.dtd":

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT node_description (target)*>
<!ATTLIST target id CDATA #REQUIRED>
<!ELEMENT target (graphics, power_plug_type, test)>
<!ELEMENT graphics (#PCDATA)*>
<!ELEMENT power_plug_type (#PCDATA)*>
<!ELEMENT test (#PCDATA)*>

I want "sample.xml" to get validated against "sample.dtd" by making use of python script. How will i achieve this? kindly help.

Binding to XML doc in XAML with multiple indexes

I am binding to an XML document in an XAML TextBlock statement and here is my XML document:

<Library>
    <Category Name="fiction">
        <Author Name="john Doe"/>
            <Book Title="Book A"/>
            <Book Title="Book B"/>
        <Author Name="Jane Doe"/>
    </Category>
    <Category Name="non-fiction"/>
    <Category Name="reference"/>
</Library>

In my xaml code, I can successfully bind to the Author "John Doe" using the following

Text="{Binding XPath=(/Library/Category/Author)[1]/@Name}" // Returns 'John Doe'.

However, if I try and bind to the first Book title (Book A) by John Doe using any of the following XPath statements, I get nothing.

Text="{Binding XPath=(/Library/Category/Author)[1]/(Book)[1]/@Title}" // Empty

Text="{Binding XPath=((/Library/Category/Author)[1]/Book)[1]/@Title}" //  Empty

Text="{Binding XPath=(/Library/Category/Author)[1]/Book[1]/@Title}" // Empty

Can someone tell me the correct syntax? Ideally, I want to be able to specify the Author by name rather index. Something like:

Text="{Binding XPath=((/Library/Category/Author)[@Name='John Doe']/Book)[1]/@Title}" //  Empty

samedi 1 août 2015

How to show tree in frontend of website Odoo8?

I added [![this tree which is selected field(one2many field) in backend of website Odoo8], now I want to show this tree to frontend of website Odoo8. How can I do it?

Thank you :)

Eclipse Android Error with appcompat_v7 values-14 and values-11

Im trying to see if I can get my Android App running with API 8. I've changed the build target for the project to 2.2 and I've changed the java compiler to 1.6. In problems I'm getting an error where R cant be resolved (I've checked to make sure my files don't contain import android.R) and in the console I'm getting a lot of red text that says:

[2015-08-02 16:12:13 - my app] /home/myname/workspace/appcompat_v7/res/values-v14/styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar'.

I wont paste the whole console but it goes on like that for almost everything in styles_base.xml and themes_base.xml for values-v14 and values-v11

The only suggestions I have found are to change to a higher build target but I want to see if I can make my program compatible with API 8

I dont know if it's relevant but, I've searched through my project and I'm not using Holo anything either as far as I can tell.

Android SDK Manager Not Getting Packages

I just installed the android SDK, I opened SDK Manager in order to download and install some packages and I got the error below, when closing it, it only showed the package "Android SDK Tools", and showed it as installed. I've tried running as administrator, clearing the cache and tried forcing http, none worked.

The Error: http://ift.tt/1JF02W9