using XML schema

Hi,

We are getting the XML data as input.
We have created the publishable canonical document by using the XSD structure.In the XSD structure some of the feilds are of type int ,decimal and datetime.The Canonical document feilds we have created using the XSD structure appears as “STRING”.So we have changed that feild into object and selected the appropriate java wrapper type.
But the input XML data we are getting it as string…so after mapping we are not able to publish the document type.The following error occurs…

ERROR:
Data does not conform to the publishable document type.
Expected Date value…obtained string value.

Please tell us,whether we need to use all the feilds as string…or we need to use any XML schema…and how to do it…

Thanks in advance…

Thanks & Regards,
S.Sathish Kumar

Hi Sathish,

Another approach would be to keep the fields as strings…and select the content type to be int, decimal, datetime etc…

This might help.

Thanks,
Anitha.

Hi Anitha,

When created the Document all the feilds are appearing as string and the content type type is appearing as int,decimal etc…
The problem occurs because we are getting the xml data as string and the content type for the feilds is int,decimal…etc…
So we are not able to publish the document…
Do we need to use transformer services…etc before publishing the document to convert the String values to integer,decimal etc…?

Thanks & Regards,
S.Sathish Kumar

hmm…i am not quite sure I understand you… Can you please attach your sample XML and the doc defn…?

thanks,
Anitha

The short answer to your question is, yes, just use string fields.

To dive in a little deeper, whether or not to just use string fields depends on how you want your document types and integrations to behave.

If you don’t need strongly-typed fields in your documents (and you probably don’t) then you don’t need to do anything further. Just use string fields. One exception may the date/timestamp fields. You may want/need to convert those to a common/known format. The W3C timestamp format is a good one to convert to if: a) the XML doc you’re processing doesn’t already use that format; b) you don’t already have another standard format that your enterprise uses.

If you want strongly-typed fields in your documents (I would strongly advise against doing this, except perhaps for Date fields), then you’ll need to do a bit more work. The content-type specified in the XML for each field is advice for how to convert the string to the desired type.

Define the IS doc type as you described, using object fields with a Java wrapper type. Then when processing the incoming XML document, you’ll need to convert each field from a string to the appropriate object type. Convert the date string to a java.util.Date, convert the integer string to a java.lang.Integer, etc.

You might want to drop the use of the word “canonical” when referring to your publishable document type. Chances are, it’s not a canonical document type in any sense of the word.

Hope this helps.

Except maybe in the sense of the word “Cannon” (bang! bang!)

… IS is extremely String oriented. When i first started using it i wanted to make everything accurate (use a float object or a Collection, that kind of thing). It made things a lot more difficult for me. When i relaxed and just let things be Strings like they wanted to be in the first place, it all worked a lot smoother.

Thanks reamon , greg and Anitha…
I’ll try with this.