xml

os.walk() python: xml representation of a directory structure, recursion

Hello, So I am trying to use os.walk() to generate an XML representation of a directory structure. I seem to be getting a ton of duplicates. It properly places directories within each other and files in the right place for the first portion of the xml file; however, after it does it correctly it then continues traversing incorrectly. I a...

WPF advice on XML data binding: XmlDataPresenter vs custom class?

Hello there, I'm just starting out in WPF and I'm building a simple movie library as a test project to help me find my feet. I'm storing my movie information in XML, for example: <movie id="1" title="Back To The Future" date="1985" ... /> The movies appear in a list and when clicked the fields will become editable. I've got that w...

How to exclude specific fields from a Rails XML output

I am working on a RoR project which outputs XML to RESTful requests. The problem is it includes the "updated-at" and "created-at" fields in the output. I have tried using: :exclude -> [ :created_at, :updated_at ] and :exclude -> [ 'created-at', 'updated-at' ] but the output still renders them. How do I exclude them from the ren...

Parsing iCalendar data with XPath/XSLT

I am working with a XML driven CMS, and before I run off and either write or implement a module that parses the iCal format, I was wondering if there was any way to parse it using just XSLT or ideally just an XPath expression, as this is a built in function of the CMS. ...

PHP simplexml_load_file catch 403

I am using the following PHP: $xml = simplexml_load_file($request_url) or die("url not loading"); I use: $status = $xml->Response->Status->code; To check the status of the response. 200 bening everything is ok, carry on. However if I get a 403 access denied error, how do I catch this in PHP so I can return a user friendly warning?...

Using XDocument to write raw XML

I'm trying to create a spreadsheet in XML Spreadsheet 2003 format (so Excel can read it). I'm writing out the document using the XDocument class, and I need to get a newline in the body of one of the <Cell> tags. Excel, when it reads and writes, requires the files to have the literal string &#10; embedded in the string to correctly sho...

xml to sql using linq and C#

I have an xml file from an external system that looks like this. <?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"&gt; <Body> <Element1> <Element2 day="2009-10-18"> <Element3 name="Joe"> <Element4 time="1"> ...

Form Authentication and XmlDocument.Load

I'm running an asp.net web application with c#. The following is used: - Windows 2003 server - IIS6.0 - .net Framework 2.0.50727 I'm trying to implement Forms Authentication and have entered the following code in the Web.Config file: <authentication mode="Forms"> <forms loginUrl="01_Login.aspx" name=".ASPXFORMSAUTH" ...

PHP: Find XML node and insert child

I have an xml document with the following structure: <?xml version="1.0" encoding="UTF-8"?> <items> <item> <id>1</id> <url>www.test.com</url> </item> <item> <id>2</id> <url>www.test2.com</url> </item> </items> I would like to be able to search for a node value, such as the value of 1 for the id field. Then, on...

XmlnsDefinition for recursive namespaces

Hi all, i have a project that is structured with a .net namespace called ViewParts. This, on the other hand, consists of many different subfolder with wpf usercontrols in them. I have added an XmlnsDefinition attribute to my AssemblyInfo.cs file to map that .net namespace to a uri for use in other window/usercontrol files. But i would r...

Simplexml is giving me the wrong results

I have a simple xml below: <?xml version="1.0" encoding="utf-8"?> <catalogue> <category name="textbook" id="100" parent="books"> <product id="20000"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publis...

Give parent elements a class when children is active with XSLT

Until recently XSLT was completely new to me, and I've been working on a menu/submenu in XSLT for a little while with a danish CMS called Dynamicweb. I don't know if this is a Dynamicweb specific question or a XSLT related question, but I'll ask anyway. My current XSLT document looks like this: <xsl:template match="//Page"> <xsl:p...

DbUnit and binary data

I use DbUnit for unit-testing of my DAO objects. It works great so far. I have a problem, I have field ob type byte[] which is stored as BLOB in the database. The column is not-null. How can I specify the value for this column in the XML dataset file, that DbUnit uses? The value can be nothing fancy, 5 bytes will be enough. I would lik...

How to remove closing tag of an XmlDocument in C#, .NET 1.1?

How can I remove the closing tag of element c in a XML document? The converted XML will go through a schema validation and it is rejected because it has a whitespace within. I'm using C#, .NET 1.1 (I'm updating a legacy application :-( ). Note: I must not resort to string manipulation to convert the XML document. Current: <main> <...

Dealing with XML in ASP.NET MVC

I have a block of XML in a database which is easy enough to pull out using ASP.NET MVC, however I would like to access and modify the XML in an way more consistent with class instances. Is there a way to get the MVC (or any other model) to generate a data access (or perhaps Entity) class set from the DB-stored XML? If the above is rathe...

How to update xml file using lxml and python?

<example> <login> <id>1</id> <username>kites</username> <password>kites</password> </login> </example> How can i update password using lxml? and now can i add one more record to the same file? please provide me a sample code ...

XML Schema order indicators confusion

I've been studying up how to write an XML Schema and I'm stumped on XSD ordering indicators like xs:sequence, xs:all, xs:choice. There seem to be only 3 of them and they're required in complex types. But what if I have the XML like the following: <row> <name>John</name> <city>LA</city> <country>France</country> </row> In w...

xml utf-16 issue

Hi I am receiving a xml through a http request. The format is like this "<.?.x.m.l. .v.e.r.s.i.o.n.=.\".1...0.\". .e.n.c.o.d.i.n.g.=.\".u.t.f.-.1.6.\".?.>| etc Then i'm getting an error: {"Name cannot begin with the '.' character, hexadecimal value 0x2E. Line 1, position 2."} Trying to convert it to ascii like this, doesn't solve the ...

globalize2 with xml/json support

I'm implementing a distributed application, server with rails and mobile clients in objective c (iPhone). To enable internationalization, I use the rails plugin 'globalize2' by joshmh. However, it turned out that this plugin does not translate attributes when calling to_xml or to_json on an ActiveRecord. Does anyone know of a workaround...

PHP deepening XML structure

given the following XML structure (i have this in an XML-file, with lots of other content - the <p> tags are just there to indicate that other tags may follow): <TITEL1>...</TITEL1> <p>..</p> <TITEL2>...</TITEL2> <TITEL3>...</TITEL3> <TITEL3>...</TITEL3> <P>...<P> is there a way to get to this using PHP (write it to a new file...