xml

When to CDATA vs. Escape & Vice Versa?

I'm creating XML documents with values fetched from a DB. Occasionally due to a legacy implementation, I'll pullback a value that contains a char that's invalid when not properly escaped (& for example). So the question becomes, should I CDATA or Escape? Are certain situations more appropriate for one vs. the other? Examples: <Email>f...

How to save HTML in XML file using Linq to XML?

Hi, I am trying to use Linq to XML to save & retrieve some HTML between an XML file and a windows forms application. When it saves it to the XML file the HTML tags get xml encoded and it isn't saved as straight HTML. Example HTML: <P><FONT color=#004080><U>Sample HTML</U></FONT></P> Saved in XML File: &lt;P&gt;&lt;FONT color=#00408...

Different ways for parsing XML

I'm a beginner when it comes to XML. I created a simple XML file and tried to parse it and assign the values into variables. It worked but the method I used made me wonder if there're better ways, more elegant if you will, for this task. Are there any? Here's my XML file: <start> <record> <var1>hello</var1> <var2>world</var2> </record>...

Invalid character '&#x0' encountered

Hi, I am getting following exception while parsing the xml. Fatal error at line -1 Invalid character '&#x0' encountered. No stack trace I have Xml data in string format and I am parsing it using DOM parser. I am parsing data which is a response from Java server to a Blackberry client. I also tried parsing with SAX parser,but problem ...

Using XLink to refer to nodes within same document

The general gist of a simple XLink to another node in the same document seems to be: <root xmlns:xlink="http://www.w3.org/1999/xlink"&gt; <firstChild id="ID1" /> ... <ref xlink:href="#ID1" /> </root> Without using XPointer or XPath, is this as much as you can do with XLink? Could you do an XLink which, say, referred to a customI...

How to map already existing java bean in JAXB

Castor framework (xml to java bean binder framework) provides functionality to map my existing java bean to xml. Can I achieve same thing using JAXB ? ...

Rails and XML

How do I create a XML file from a form in ruby on rails. The form elements should be converted into xml file and stored in my system at a specific location. I am a newbie. so please help me out with some codes. Thanks in advance. ...

JQuery ajax error function is executed even if query is successfull

Hello, I'm trying to learn JQuery - and I have a small problem with ajax. I'm trying to populate a javascript array with values returned from an XML response from a page. Here's my main page (ajax.html): <html> <head> <script type="text/javascript" src="jquery/jquery.js"></script> <script type="text/javascript" src="jquery/fiber.js"></...

XML CDATA Encoding

I am trying to build an XML document in C# with CDATA to hold the text inside an element. For example.. <email> <![CDATA[[email protected]]]> </email> However, when I get the InnerXml property of the document, the CDATA has been reformatted so the InnerXml string looks like the below which fails. <email> &lt;![CDATA[[email protected]]]&gt; <...

Serilializing Linq.Table to XML

Hi, I have a very simple application which currently has a single Linq to Sql class based on a single table. I need to serialize (to XML) all rows in the table using the DataContext for the Linq To Sql class. How do I go about doing this? This is my current code : var db = new MyEntityDataContext(); Stream fs = new FileStrea...

Allowing/Restricting XML Attributes based other Attributes

Is it possible to create an XML schema with the following behavior? I have an XML file that looks like the following. I'd like to either expose or restrict attributes of Object based on the value of Type. For example, if Type="Bike" I might want to expose attributes related only to Bike (i.e. Pedals, Frame, etc). If the Type="Car", I mig...

.NET client getting "not well formed" XML response from Axis web service

I have a simple .NET app that makes a SOAP call to a third party Axis web service. When I trace the HTTP traffic, I see that the Request looks fine, however I'm getting an exception: "Response is not well-formed XML." The return object is null, as it seems the XML can't be deserialized. One question regarding the various namespace decla...

Generating XSD for serialized XML

Currently, I have an xml file that looks like this... <ArrayOfService> <Service> <Name> Something </Name> <Id> 8003 </Id> </Service> </ArrayOfService> This is automatically generated from a class that looks like this... public class Service{ public string Name; public int Id; p...

What is the most state-of-the-art, pure python, XML parser available?

Considering that I want to write python code that would run on Google App Engine and also inside jython, C-extensions are not an option. Amara was a nice library, but due to its C-extensions, I can't use it for either of these platforms. ...

Scala - modifying nested elements in xml

Hi, I'm learning scala, and I'm looking to update a nested node in some xml. I've got something working but i'm wondering if its the most elegant way. I have some xml: val InputXml : Node = <root> <subnode> <version>1</version> </subnode> <contents> <version>1</version> </contents> </root> And i want...

Removing a specific XML node in TIBCO BusinessWorks

I have a "global variable" XML schema in TIBCO BusinessWorks. It's simpler than it looks - basically just a single repeatable node. Image: Tibco globals. (old URL redacted) Various processes in the system can update this list. Checking to see if they are listed is easy: $GetVariable/subscriber-list/subscriber = $_processContext/n...

ASP.NET MVC and text/xml content type

I want to return a View() from an action, and the resulting response should have a content type of text/xml instead of the default text/html. I have tried the following, with no success: Response.Content = "text/xml"; return View(); I know that you can specify the content type by returning ContentResult, but that doesn't render my V...

Null returned when selecting a node in XML document

New to XML. I have a 3rd party webservice that supplies an XML document that I have to update the element values and pass back. The core issue issue is I get an NullReferenceException error when calling the node.RemoveAll() method in the code below. I'm calling the RemoveAll() method because each element has the xsi:nil attribute whe...

XSD: ComplexType

Hi, I have a complexType like: <xsd:complexType name="NightlyRate"> <xsd:complexContent> <xsd:extension base="com:Money"> <xsd:attribute name="night" type="com:Number" use="required"/> </xsd:extension> </xsd:complexContent> </xsd:complexType> Now, I want to add a child element to "NightlyRate", whi...

Parse XML sitemap to a hierarchical data object?

Is there a quick way to get a XML sitemap into a hierarchical data object? Or maybe I'm going about this wrong from the get go. I would like to combine two XML files. The first on is a sitemap: <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode description="Pages" title="Pages"> <siteMapNode ...