xml

Illegal characters in XML document in ASP.NET Web Service

I'm going to ask and answer my own question, I hope nobody minds but I thought this might be useful to other people. If you setup a ASP.NET Web Service that returns objects that contain characters that are invalid for XML an exception will be thrown after the object is serialized in to SOAP xml and the client attempts to deserialize tha...

How can i retrieve a connectionString from a web.config file?

I am writing an client application in C# which will be supposed to change ConnectionString settings in a web.config file from another application I wrote. How can I achieve this goal? Is there a way to load the web.config file in my application and read/change its data object orientated? Or do I need to parse it as if beeing a complete ...

Date elements in XML

I guess there are two major approaches to date representations in XML: <date>1984-10-27</date> and <date> <year>1984</year> <month>10</month> <day>27</day> </date> Personally I would go for the former. It's more compact and at the same time more readable. The split-up of the second form seems overkill to me; e.g. most of the...

weird problem echoing array (PHP)

Ok so I have the following code. I'm trying to output some xml so that it can be read with jQuery, but for whatever reason, when I try to add an element in the array to a variable, it just turns the variable to 0. I did a print_r() on the array, and it's normal. Code if ($content == "tables") { $result = mysql_query("show tables");...

Attribute Value Selection in SimpleXML

Why can't I filter results on the attribute value rather than the index? Something like this fails. foreach ($portfolio->clientGroup[$id]->client['name=foo']->src as $src) { echo $src . '<br />'; } But this works. foreach ($portfolio->clientGroup[$id]->client[0]->src as $src) { echo $src . '<br />'; } ...

simple xml parsing

what is the simplest way to parse the lat and long out of the following xml fragment. There is no namespace etc. It is in a string variable. not a stream. <poi> <city>stockholm</city> <country>sweden</country> <gpoint> <lat>51.1</lat> <lng>67.98</lng> </gpoint> </poi> everything I have read so...

Efficient way of extracting specific numerical attributes from XML

The application I work uses XML for save/restore purposes. Here's an example snippet: <?xml version="1.0" standalone="yes"?> <itemSet> <item handle="2" attribute1="30" attribute2="blah"></item> <item handle="5" attribute1="27" attribute2="blahblah"></item> </itemSet> I want to be able to efficiently pre-process the XML which I read i...

Removing all \n\r characters from a node XSLT?

Hi wondered if you could help me please? I have node in xml that is as followed $LOG: 08880xbpnd $ fhdsafidsfsd df sd fsd f sd fsd I was wondering is there anyway to make all the text go on to one line so that it then can be passsed through to a javascript function? so it would turn out like this $LOG: 08880xbpnd $fhdsafidsfsddfsdf...

Creating XML from SQL Server Data that Conforms to a Specific Schema

I've got data in a SQL Server 2005 table that I need to insert into an application using a SOAP web service that takes in an XML fragment. I'm looking at different options for this and I would like to know if it is possible to get SQL Server to return me XML that conforms to a particular Schema. If it is possible, how do I do it? ...

Rationale behind SimpleXMLElement's handling of text values in addChild and addAttribute

Isn't that an inconsistent behavior? (PHP 5.2.6) <?php $a = new SimpleXMLElement('<a/>'); $a->addAttribute('b', 'One & Two'); //$a->addChild('c', 'Three & Four'); -- results in "unterminated entity reference" warning! $a->addChild('c', 'Three &amp; Four'); $a->d = 'Five & Six'; print($a->asXML()); Renders: <?xml version="1.0"?> <a...

Namespaces in XSLT

I'm using XSLT to restructure an XML file. The following code copies all child nodes to a new XML file: <!--Add all child elements of the zzz node--> <xsl:template match="zzz"> <Trade> <xsl:attribute name="ID"> <xsl:value-of select="TradeId" /> </xsl:attribute> <xsl:copy-of select="*"></xsl:copy-of> </Trade>...

XML compare tool that can "Tidy" the XML and ignore differences in attributes.

I am looking at using Beyond Compare 3 with XML Tidy compare comparison format. XML Tidy formats all the nodes with proper line breaks and indentation if an XML file is all slopped onto one line. ...So I would love a tool that can do this and can ignore differences in attributes, or not even show attributes at all (this is because attr...

How to use REST with nested resources which are represented in XML?

My aim is to create nested resources via one REST request. The REST requests is represented via a XML document. That works fine for single resources but I could not manage it for nested ones. OK I'll give you a little example next. First create a new rails project rails forrest Next we generate the scaffolds of two resources, the tre...

Opinions on using XML as a Stored Proc Parameter and Return Type.

This is new to me. I have a new boss at work who is insisting that every query we do from now on be a sproc with XML serialized parameters and return types. I've not run any tests yet but this strikes me as overkill and possibly a performance killer in many ways. What is your experience? ...

Creating an XML string in Flex (AS3) by using DOM functions

I want to create an XML string in Flex 3 in a similar way to you might approach it in Java. I only want a small piece of XML in the format <slide thumb="http://www.thumbs.com/thumb.jpg" type="static" blah="bleh" /> The only type of code I can find for doing this seems ridiculous.... private function createXML(): void { var xm:XML = <...

How do I display an XML document in a .Net web browser control?

I have an XML document and a CSS file that goes with it, which includes the page formatting style (both exported from Adobe Framemaker). I would like to import this data and display portions of the XML document in a web browser control with in Windows Forms or WPF. It's not clear to me how do make all of this work together. Any suggesti...

Large XML file, XmlDocument not feasible but need to be able to search

I am struggling with a sensible logic loop for stripping out nodes from an XML file too large to use with XPath supporting .NET classes. I am attempting to replace the single line of code I had (that called SelectNodes with an XPath query string) with code that does the same but uses an XmTextReader. I have to go several levels down as...

XPath SelectNodes in .NET

Document A B C /B /A E F C /c /F G C /C /G /E /Document If i load the above XML into an XmlDocument and do a SelectSingleNode on A using the XPath query //C XmlNode oNode = oDocument.SelectSingleNode("E"); XmlNodeList oNodeList = oNode.SelectNodes("//C"); why does it return nodes f...

Java implementation of JSON to XML conversion.

Are there existing JARs available to convert from JSON to XML? ...

XML Based UIs

What is the best/recommended generate UIs based on XML parameters? Objective is: Adding new objects/parameters to UI should easy and fast without disturbing the other elements. The UI is currently built and rendered using JSP/Servlets. ...