xml

What is the set of valid first characters in an XML document?

I'm working on some code to determine the character encoding of an XML document being returned by a web server (an RSS feed in this particular case). Unfortunately, sometimes the web server lies and tells me that the document is UTF-8 when in fact it's not, or the boilerplate XML generation code on the server has <?xml encoding='UTF-8'?...

Mapping collection to XML in Castor

Hi, I'm trying to map a POJO to XML using Castor. Let's say I have a Order that has a collection of Items... is there any way of achieving an xml like the following: <order> ...order attributes <items> <item> ..item attributes </item> <item> ..other item </item> </items> </order> I could make something similar but wit...

Rails XML builder with no pretty-printing (i.e. minified XML)

I am using Builder::XmlMarkup to produce data structures in XML format for a RESTful API server. Recently, I discovered a bug where the pretty-printing from Builder::XmlMarkup produced an element full of whitespace text instead of an empty element as it should. For example, this code: xml.outertag do xml.list do # Some code whic...

Bad Request when posting xml to REST-like service - specal characters

Hi I am integrating an app with a service (iContact), that describes its API as "rest-like". I post XML, and everything works fine... Until I send special characters like æøå - then I get a "bad request" error from the server. <contacts> <contact> <firstname>Søren</firstname> <lastname>ÆbleTårn</lastname> </contact> </conta...

A C++ code generator from an XML spec.

Hi, I'd like to know if there's a tool which allows you to do class definition based on an XML format. I'm not looking for data binding. Anyone can help ? Thanks ...

NSXMLParser Question

I am trying to figure out NSXMLParser for my iPhone app and while I generally understand how it works, I am still a little confused about how to extract the values I need. The XML result that I am parsing is very basic. it is like so: <start> <status>300</status> <record> <title>The Title</title> <content>Some content</content> ...

How can I change the namespace on every node in a DOM?

How can I, given a w3c DOM (Java's default implementation, specifically) change the namespace of every element/attribute/node in that DOM? Efficiently, preferably. The DOM doesn't seem to have a setNamespaceURI method on it, which is inconvenient. I've tried XSL approaches, but they've failed to work in the JAXP transformers (although...

Writing an XML schema that allows qualified attributes from other namespaces

Is there a way to create an XSD that allows an attribute from a different namespace, but only if it's qualified? An example of an XML file that would be valid according to the schema is <d:document dx:size="a5" xmlns:d="http://example.com/documents" xmlns:dx="http://example.com/document-extensions"/&gt; The schema should enfor...

Returning C/C++ structure array in XML/XSD format

Hi all: I am writing a native C/C++ .dll program which calls to .dll functions of many third party C/C++ libraries and returns a c/c++ structure array (SA) of 18 columns by 0-n lines. This returned value is then captured by a WCF C# web service program which "interop" with my .dll and, using .net xml library, serialize the result before...

How can I turn my Perl array to XML?

How can I take a Perl array like this @categories = ( ["Technology", "Gadgets"], ["TV &amp; Film"] ); and generate this XML snippet? <itunes:category text="Technology"> <itunes:category text="Gadgets"/> </itunes:category> <itunes:category text="TV &amp; Film"/> I can change the array if there's an easier way to get to the same ...

XSLT: tricky transformation, need help!

hi! i have to build an XSLT stylesheet that transforms an xml like this: <message> <line/> <silence/> <dot/><line/><line/> <silence/> <dot/> <silence/> <line/><dot/><dot/><dot/> </message> into something like this: <complexMessage> <word code="-"/> <word code=".--"/> <word code="."/> <word code="-..."/> </compl...

How to serialize a string holding nothing but "\r\n" to XML correctly?

We're using DataContractSerializer to serialize our data to XML. Recently we found a bug with how the string "\r\n" gets saved and read back - it was turned into just "\n". Apparently, what causes this is using an XmlWriter with Indent = true set: // public class Test { public string Line; } var serializer = new DataContractSerializer(...

Finding xmlns with xsl/xpath

I'm trying to obtain a list of information for the root element of an xml document using a transformation. The pieces I can't figure out are: How do I obtain the default namespace url? How can I obtain a list of every xmlns prefix and its related url? Here's my xml file: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="t...

which .jar file has javax.xml.stream.* ?

Going nuts again with my Mac running Java 1.5.... where do I get a .jar file that has javax.xml.stream.XMLInputFactory ? I want to use StAX but don't know how to get it set up right. :::scream::: I can't seem to get this setup. I've now downloaded jaxp-api.jar, jsr173_1.0_api.jar, sjsxp.jar, stax-api-1.0.1.jar, stax2-api-3.0.1.jar, an...

Need Help using XPath in ElementTree

I am having a heck of a time using ElementTree 1.3 in Python. Essentially, ElementTree does absolutely nothing. My XML file looks like the following: <?xml version="1.0"?> <ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2008-08-19"&gt; <Items> <Item> <ItemAttributes> <ListPrice> ...

What to ask for in web services documentation?

A 3rd party is developing a web services library, which my team will be consuming. What should I ask for in terms of web service documentation? Here's my list so far: WSDL URL Sample Request (XML) Sample Response (XML) Response Schema Definition Anything else? What documentation should be provided for web services that return JSON...

Identifying allowed XML elements defined by by an XSD in PHP

I'm trying to write a script in PHP5 that will: read in an XSD let the user give an element/tag name which will serve as the context output a list of elements allowed within that element/tagname based on the XSD So far I'm only able to see solutions for using XSDs to validate XML files. Anyone done something like this before? ...

Problem with xml web service n iphone apps

Hi, I am doing one social networking apps and i have to get data from server using xml web service I have few web services which gives me data from server. I have very strange problem like some times web services are not returning any data and if paste in browser same web services gives result in browser but they will not return in ip...

How to train a team member to be the Xml Expert

Folks, I have got to work with a new team and design the required skills for each of them, I want to put a compressed training plan for one of them to be the Xml Expert in the team, as part of this I put him to read about XPath, XSLT from W3Schools, but what else he needs to know ? or is there a better source ? ...

How to efficiently parse concatenated XML documents from a file

I have a file that consists of concatenated valid XML documents. I'd like to separate individual XML documents efficiently. Contents of the concatenated file will look like this, thus the concatenated file is not itself a valid XML document. <?xml version="1.0" encoding="UTF-8"?> <someData>...</someData> <?xml version="1.0" encoding="...