xml

How do I get Nokogiri to understand my namespaces?

I have the following XML document: <samlp:LogoutRequest ID="123456789" Version="2.0" IssueInstant="200904051217"> <saml:NameID>@NOT_USED@</saml:NameID> <samlp:SessionIndex>abcdefg</samlp:SessionIndex> </samlp:LogoutRequest> I'd like to get the content of the SessionIndex (that is, 'abcdefg') out of it. I've tried this: XPATH_QUE...

What is an XML infoset and in what ways is it different to an XML document?

I've tried to read http://www.w3.org/TR/xml-infoset/ and the wikipedia entry. But frankly I'm still not sure what the difference is. The quote : An XML document has an information set if it is well-formed and satisfies the namespace constraints. There is no requirement for an XML document to be valid in order to have an info...

PHP XML Parser - ignoring nested/child tags

I've got a situation where I'm using an XML parser to extract data from a php://input. The data being sent in looks like:- <this>foo</this> <that>bar></that> <data><dong>zebras</dong><fong>monkeys</fong></data> Now, the issue is that because the handler:- $xml_parser = xml_parser_create(); xml_parser_set_option($xml_parser...

How to Load XML File Contents using Javascript?

I'm looking for a way to load an XML file's contents directly into a Javascript variable. Say I have the following directory structure: /index.html /loader.js /file.xml In index.html, there is a <body> tag, whose contents should be replaced with the contents of the XML file. So if the XML file contains: <element> <item>Item One</...

.NET Windows control for editing XML/XSL?

Apologies if this has been asked before. Had a quick search and there's nothing that answers my question 100%. I've got some XSL stored in the database which I want the user to be able to edit within my .NET Windows application. I could just stick it into a multi-line textbox but then I don't get anything like auto-indent, colour-coding...

Specifying structure of serialized XML using DataContractSerializer

I am creating serialized XML for a LINQ to SQL project using the DataContractSerializer class. Upon serialization and inspecting the returned object, I get XML that looks like this. - <ContentObject xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyProject.Data.Model"&gt; <_x003C_ID_...

How to parse an XHTML file that is not 100% valid?

I have XHTML files whose source is not completely valid, it does not follow the DTD of an XML document. Like there are places where for " it uses &Idquo; or for apostrophes it uses &rsquo;. This causes exceptions in my C# code. So is there any method or any weblink that i can use to get rid of this? ...

What is the best method in passing a large number of parameters in SQL Server

I'm trying to work out what the best method to passing a large number of parameters into a stored procedure. Some methods i was thinking about are; Create the relevant database objects, including a parameter object for each item and invoke the command object Pass in an XML document and have the stored procedure unpack it. (The app wil...

Convert a XML Schema (XSD) document to a tree like structure

Hi Guys, I am in real trouble. I want to convert an XML schema (XSD) document into a tree like structure. Is there any straight way of doing it? I used XMLBeans to parse the XSD document and tried to traverse the parsed document. But, handling the gory details of XSD was not easy. Thereby, I left that and searching for a much cleaner wa...

Different AJAX XML results from same PHP file with same POST parameters using JQuery

I'm using the JQuery .ajax method to get the results of a simple PHP query in XML (which I've done various times within this project without a problem). However, the XML result that I receive from within my main project is different to what I expect (as tested by simply viewing the PHP file) when viewing the results in Firebug's console...

Error when trying to load XML from a Sharepoint Web Services call into an ASP.NET Gridview

I'm getting the error: Illegal characters in path. when trying to load XML, using XPath, into a gridview's datasource in the PageLoad function in the code-behind of an ASP.NET page I'm building. Does anyone know what this error means? The XML coming in from the Sharepoint Web Services call is: <?xml version='1.0' encoding='ISO...

Can I use XSLT to parse XML into sub-files? (+ Alternative Languages/Methods)

Hey all, I have highly repetitive data with a depth of 5 nodes deep (including the root) that needs to be broken apart. (I'll include a fast sample in a minute.) What I'm looking to do is parse a ~5mb XML file into smaller sub-files based on the 3rd-depth nodes. But after that, it gets more complicated. The task's requirements are these...

XML to C struct and C struct to XML

I like to do my server side programming in C, but need to inter-operate with some XML. What I need to write is some function that, given a C structure, or nested structure, and another structure (or nested structures) that describes the elements in the C structure, spits it out as XML. And another function that reads the XML, verifies ...

How to render contents of a tag in unicode in BeautifulSoup?

This is a soup from a WordPress post detail page: content = soup.body.find('div', id=re.compile('post')) title = content.h2.extract() item['title'] = unicode(title.string) item['content'] = u''.join(map(unicode, content.contents)) I want to omit the enclosing div tag when assigning item['content']. Is there any way to render all the c...

How to validate a pick list with an XML Schema

Hi I've got this problem and I can't for the life of me find a simple solution. I am trying to codify a list of operating systems, where the XML file contains a list of the OSes that a given person has. There is a fixed list of OSes (XP, Vista, Win7, OSX and Ubuntu). I have the following piece of XML <operatingSystems> <operatin...

Why would people use pure XML databases over plain RDBMs?

How many of you are actually using pure XML databases over RDBMs? The former seem to be gaining momentum, but I don't understand the advantage. Anyone cares to explain? ...

How should I strip invalid XML characters from a stream in J2ME? org.xml.sax.SAXParseException: Invalid character

This code is running on Blackberry JDE v4.2.1 It's in a method that makes web API calls that return XML. Sometimes, the XML returned is not well formed and I need to strip out any invalid characters prior to parse. Currently, I get: org.xml.sax.SAXParseException: Invalid character '' encountered. I would like to see ideas of a fast w...

XSL Conversion XML->XML outputs only text?

Hi I have following XAML code which is the output from XamlWriter.Save(): <StackPanel Name="itemStack" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:mm="clr-namespace:MindManager;assembly=MindManager"> <mm:Item Width="Auto" Height="Auto"> <Border BorderThickness="10,10,10,10" Name="border1" Height="Auto">...

LINQ to XML - How does it work?

My question is essentially a simple one, though I'm looking for as in-depth an answer possible here: how does LINQ to XML work behind the scenes? Now, I have had a fair amount of experience working with LINQ to XML for various applications, so it's interfaces is nothing strange to me, but I am quite clueless as to how the internals oper...

Getting string content of the complex mixed element with XQuery

For, example, there is an xml: <article-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="3.xsd"> <article section="physics"> Increasing linear dynamic range of commercial digital photocamera <author>M. V. Konnik</author> <content> Methods of increasing linear optical dyna...