xml

php simplexml_load_file

I'm new to PHP and this may be a stupid question to ask, so don't vote me down just because I don't understand something... php -r "print_r(simplexml_load_file('http://twitter.com/statuses/user_timeline/31139114.rss'));" let's take this for an example, by running this command i get (on screen) XML output. my question is it possible t...

Transforming XML with ant

I need to modify certain XML files, and possibly generate XML, in our build and deploy process, which runs on ant. Examples of what I might need to do would be eliminating certain elements based on the value of particular attributes, changing the values of attributes, adding attributes, and adding all new elements. I'm pretty familiar ...

Is there an Alternative to XSLT

is there anything that competes with XSLT. I really just cannot wrap my head around XSLT. ...

building objects from xml file at runtime and intializing, in one pass?

I have to parse the XML file and build objects representation based on that, now once I get all these data I create entries in various database for these data objects. I have to do second pass over that for value as in the first pass all I could do is build the assets in various databases. and in second pass I get the values for all the ...

Can the content of an XML element be bounded?

Hi I am trying to write a DTD, and I want to define an element BOOKTYPE, that can be either ONE, TWO or THREE. Is there a way I can ensure that only one of these values can be entered inside the element? Note: 1. I know how to do this in an attribute, but not sure how to accomplish with elements. 2. I want a way of doing this INSIDE the...

How fast is simplexml_load_file()?

Hi. I'm fetching lots of user data via last.fm's API for my mashup. I do this every week as I have to collect listening data. I fetch the data through their REST API and XML: more specifically simplexml_load_file(). The script is taking ridiculously long. For about 2 300 users, the script takes 30min to fetch only the names of artists....

(E)BNF Parsing to XML

Is there any (E)BNF parser out there which is able to generate XML trees of the AST? Rephrasing: what is the quickest way to compile an (E)BNF defined language into some sort of XML? Bonus: Using Javascript :-) ...

Why is CakePHP inserting a space before my xml layout?

I am having a really frustrating problem in CakePHP where a space keeps coming up at the beginning of my KML file layout which causes Google Earth to reject the KML file! <?php header("Content-disposition: attachment; filename=area.kml"); header("Content-Type: application/vnd.google-earth.kml+xml kml; charset=utf8"); header("Content-Tra...

WCF Xml Serialization and AutoImplemented Properties

I'm experimenting with WCF RESTful web services and I'm having a problem with Auto-Implemented properties. I have a class called DeviceDescriptor, defined as follows: public class DeviceDescriptor { public string DeviceId { get; set; } public string DisplayName { get; set; } } I have a RESTful WCF service that is supposed to ...

Post to twitter using oauth with from

I am unclear on how to post to twitter using oauth. Please do not just post a link on this page for me to look at because chances are I have already seen it. I have the section where they go to twitter and approve the app and come back to my site. I then store the information in access key and access secret key in the database from the u...

WinForms - Custom XML Editor

I've created a small HTML/JavaScript based mini-web app that reads data from an XML file. Now, I need to create an offline WinForms editor for this XML file. I'm fully aware that using an XML file to store data in the fashion that I do is far from ideal, but the requirements are such that I can only use static files for the web site, th...

XML Schema - How do I model many-many relationships (i.e. Photos/Tags)

I need an XML schema for Albums/Photos/Tags where Photos & Tags have many-many relationships. I'd like to have a generalized xml schema solution for the following: 1 container (Album) of PhotoType elements, and 1 container (Tags) of TagType elements. 1 instance document with only a single occurance of Photo/Tag element data But how...

Updating Twitter background via API

I'm having a little trouble updating backgrounds via Twitter's API. $target_url = "http://www.google.com/logos/11th_birthday.gif"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_URL,$target_url); curl_setopt($ch, CURLOPT_FAILONERROR, tr...

How to make any tag mandatory in xml schema

My xml tag is given below <ADCNT> <EM> <RUID> </ADCNT> I can make EM tag as mandatory also the same thing I can do with RUID by providing minOccurs = 1 (<EM minOccurs=1>). But I want if both of them are not present then do not validate the xml against schema. If any one of them is present then validate the xml against sche...

Apply XSL to External XML

Currently I use: <?xml-stylesheet type="text/xsl" href="XSL.xsl"?> To link XSL to XML. If my xml was here: www.externaldomain.com/rss.xml (Outside of my domain) how can i get the XSL linked to the XML? Can i point the XSL to a File or Link? ...

Is there a way to allow 'this' attribute or 'this other' attribute, but not both?

I am trying to allow for two attribute values for one element. This is how I have it done now, but I only want to allow 1 of the 2, but not both. <contact phoneH="cell">8025550000</contact> <contact phoneW="work"> 8025550094</contact> I am looking to be able to do something like this: <xsd:attribute name="phoneH|phoneW" type="xsd:st...

Best way to use XmlSerializer with XML field and LinqToSQL?

Is it possible to make LinqToSql use XmlSerializer to deserialize a typed XML field to an C# object? Currently I have the following code: (note that I had to use XElement.ToString() to use XmlSerializer) protected static T Deserialize<T>(string xmlString) where T : class { var xmlSerializer = new XmlSerializer(typeof(T)...

Parsing XML with PHP and SimpleXML where items are named <long>, <float> or <int>

I'm trying to parse data from Archive.org's search functionality. The data looks like this: <doc> <float name="avg_rating">5.0</float> <arr name="collection"><str>U-Melt</str><str>etree</str></arr> <arr name="format"><str>Checksums</str><str>Flac</str><str>Flac FingerPrint</str> <str>Metadata</str><str>Ogg Vorbis</str><st...

How to access a property file using "javascript"

How do I access a property file using javascript. Normally property file is a xml based file. I java we access a property file like this: Properties prop = new Properties(); fis = getClass().getResourceAsStream("props.xml"); if (fis != null) { prop.loadFromXML(fis); } String dbUrl = ...

å in xml file is valid or not?

Hi all, IE doesn't like the å character in an XML file to display. Is that an IE problem or are å and alike chars indeed invalid XML and do i have to create the xx; values for all these letters? Michel by the way: the chars are inside a CDATA tag The declaration is this: hmm, can't seem to get the xml declaration pasted in my post, i...