Skip to main content

Posts

Showing posts with the label xml

Using xsltproc style sheet in java

I would like to convert an xml to a text with java. Until now i have used xsltproc with a style sheet file. Now i would like to do this inside a java class, and i would be very happy if i can do this reusing the style sheet of xsltproc. Is there any way to do this?

How to modify XML w/o DOMDocument / SimpleXML / libxml?

<?xml version="1.0" encoding="ISO-8859-15"?> <!DOCTYPE Finvoice SYSTEM "Finvoice.dtd"> <Finvoice Version="1.2"> <BuyerPartyDetails> <BuyerOrganisationName>Example Name</BuyerOrganisationName> <BuyerPostalAddressDetails> <BuyerStreetName>Street Name</BuyerStreetName> <BuyerTownName>Town Name</BuyerTownName> <CountryCode>FI</CountryCode> <CountryName>Finland</CountryName> </BuyerPostalAddressDetails> </BuyerPartyDetails> <InvoiceDetails> <InvoiceDate Format="CCYYMMDD">20120130</InvoiceDate> </InvoiceDetails> </Finvoice> I need to make a script to update this kind of XML file with either PHP or Javascript. I made something with PHP DOMXPath , but it turned out that it's not an option - the server doesnt have the support for it. All of these elements that

Using an array (or xml) to program a function

Ultimate Goal Is to make something like Magento offers - basically a logic builder, and as shown by this post on Stackoverflow: jQuery (or any web tool) Nested Expression Builder So far I have made jQuery to build a tree and get the data that I want the builder to use, check, and set. Now I just need to parse the checks and add it into various places in a script I'm making - but I am unsure how to process it dynamically so that these checks can be performed, which will lead to some actions occurring/data being changed automatically. Maybe we can call this dynamic expression processing? Original Post Forgive me, I know what I would like to do, but have little idea how to do it - so I'm looking for some inspiration. I have allowed a multidimensional array to be generated, and the array would contain certain 'commands' and logic functions, and when a condition is true it is executed. In it's most basic form, the array would contain a set of if statements,

For loop while parsing xml in php?

I am trying to create a for loop that will parse out different elements of xml doc using php. It parses when I put the number of the entry in the line: $s = $xml->entry[0]->children($namespaces['s']); However I tried to replace the number with "i" to count through each of the entries in the xml doc and I get an error (Fatal error: Call to a member function children() on a non-object in /home/content/c/a/s/cashme/html/buylooper/xml.php on line 10). How do I resolve this? <?php $url = 'xml-file.xml'; $xml = simplexml_load_file($url); $namespaces = $xml->entry->getNameSpaces(true); for ($i = 0; $i <= 10; $i += 1){ $s = $xml->entry[i]->children($namespaces['s']); $title = $s->product->title; //print echo $retailer; } ?>

XML layout overlapping AlertDialog"s Title

I am developing an Android application where the user is asked to "setup" before recording data. This is accomplished using an AlertDialog that inflates an XML layout, using such code: final AlertDialog.Builder builder = new AlertDialog.Builder(this); LayoutInflater vi = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = vi.inflate(R.layout.setup, null); builder.setView(v); On an emulator or a 2.3.3 device, it looks fine: However, the title that reads "Configure Options" is overlapped on a 2.1.1 device (which has a smaller screen). It looks more or less like this: Does anyone know what the potential problem may be? The XML layout is scroll enabled so that if it doesn't fit in the dialog, the user can scroll (which works fine in the emulator and 2.3.3, but not 2.1.1). Perhaps there is some way to make the AlertDialog fit the whole screen using Java code? Thank you for the help. EDIT: setup.xml (with names of some thi

split action bar doesn&#39;t appear?

i want to make action bar top and down in android 4.03 make code but when i run it it doesn't appear , i don't know what is wrong , i search for reson before asking here but i didn't find anything here is menu/style.xml code: <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/first" android:icon="@drawable/cat" /> <item android:id="@+id/first" android:icon="@drawable/phone" /> <item android:id="@+id/first" android:icon="@drawable/music" /> <item android:id="@+id/first" android:icon="@drawable/dialog" /> <item android:id="@+id/first" android:icon="@drawable/file" /> <item android:id="@+id/first" android:icon="@drawable/contact" /> <item android:id="@+id/first" android:icon="@drawabl

No resource identifier found for attribute &#39;contentDescription&#39; in package &#39;android

I had this warning before "" [Accessibility] Missing contentDescription attribute on image " on ImageView and then I added this code to it: android:contentDescription="@string/desc" and now I'm facing with an error No resource identifier found for attribute 'contentDescription' in package 'android This is my code: <ImageView android:id="@+id/handle" android:layout_width="48dip" android:layout_height="48dip" android:contentDescription="@string/desc" android:src="@drawable/icon" />

Form XML string by recursively traversing an un-ordered list

I need a jQuery/JavaScript function to form an XML string from an un-ordered list This is the HTML <ul> <li> <input class="checktree" type="checkbox"/> <label>PhoneNumbers</label> <ul> <li> <input class="checktree" type="checkbox"/> <label>PhoneNumber</label> <ul> <li> <input class="checktree" type="checkbox"/> <label>number</label> </li> </ul> <ul> <li> <input class="checktree" type="checkbox"/> <label>type</label> </li> </ul> </li> </ul> </li> </ul> This is the code I have now NOTE: item i