Yixing Ma,

I would suggest taking a look at the (more or less official) XML-RPC Spec, located at: http://www.xmlrpc.com/spec

In it, you'll find answers to most of your questions, including...


Yixing Ma wrote:
But I was unable to put <i4> into the array by using java Vector. I could only put <int></int> instead of <i4>.

The spec says that <i4> and <int> are interchangable. From the spec, "<i4> or <int> four-byte signed integer"


Also the <string></string> tag in red is missing.

The <string> tag is optional as it's the default type. The spec reads, "If no type is indicated, the type is string."


The blank space was replaced by "&#32;" in the generated XML.

This behavior is not required of the spec, but is allowed. &#32; is the appropriate XML equivalent for the space character (ASCII 32 is the space character). This shouldn't be a big deal to any decent XML parser. In fact, it's a real good behavior, since in general, whitespace is ignored in an XML document. It makes it very clear that this whitespace is part of the actual data, not part of the XML document itself.


Is there a way to produce the exact same XML as XML-RPC defined by using apache's api?

Only if you rewrite and/or extend the Apache XML-RPC library.


2) If I want to generate
    <value><i4>001404</i4></value>
as I want to preserve the zero before 1404. What should I do?

From the spec question/answer section on the bottom of the page, "An integer is a 32-bit signed number. You can include a plus or minus at the beginning of a string of numeric characters. Leading zeros are collapsed. Whitespace is not permitted. Just numeric characters preceeded by a plus or minus."

Notice the "leading zeros are collapsed" part. In order to keep your leading zeros, you will need to use a <string> type instead of an <i4> <int>.


Hope this helps,

Adam

Reply via email to