Archived Forum Post

Index of archived forum posts

Question:

complex type in XML

Dec 22 '14 at 08:36

Need to send a 'complex type' in an XML. I'm writing in VB6 and using the Chilkat active-x I have no problems creating XML code, just don't know how to create and upload a 'complex type' SearchOption Target Value Option end


Answer

The only reference I can find to complexTypes regarding XML is in schema definitions, for example: http://www.w3schools.com/schema/el_complextype.asp

Given your example XML code, the <searchnode> element is a "complexType" as it contains other elements. To make the three elements within the <searchnode> into complex types, you would just need to define elements within them. You will need to ask your client for a specification of what they expect to see, something like a DTD or a XSD.

EDIT: the XSD is referenced in the example code, unfortunately I can't view it to determine what the allowed types are. However I see that you have already fixed this, so it's no longer relevant anyway.

Dan


Answer

Jim, I can't answer your question only because I don't know what you're asking. You need to be much more specific, perhaps by providing some sample XML that shows what you want to "send". (And what do you mean by "send"? Is that part of the problem. Is the issue only in forming some XML according to spec, or is the issue also on "sending", whatever that may mean (FTP, HTTP, etc...)?


Answer

Here is a portion of the xml code I am forming -

    <SearchProductsRequest xmlns="http://apps.tire-hq.com/thq/ws/searchProducts.xsd">
        <searchNode>
            <searchOption>contains</searchOption>
            <searchTarget>productCode</searchTarget>
            <searchValue>748303572</searchValue>
        </searchNode>
    </SearchProductsRequest>

This is the body of xml statement only - i can create (form) the xml code with no problems. However, the layout of my client requires that three fields within the ,searchNode> be a 'complex type' I don't know how to create a 'conplex type', and i don't know how to make it part of this xml statement.


Answer

Jim, unfortunately I have no idea what is meant by "complex type"...


Answer

I think I may have made this more difficult than necessary. There was a typo within the code, causing the error. I just thought I was forming the XML incorrectly, when in fact I was not. The code is running correctly now. Not certain how to mark this thread as closed.