cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Action Block in xMII: Working with XML and DateTime Types

Former Member
0 Kudos

Hello all,

I am in the middle of developing custom action block for xMII. I have no problem creating the basic (I have successfully created a custom action block that perform simply things).

However, I am having trouble getting XML types in and out of a custom action.

Our setter never executes, perhaps because we have the type wrong? Is

org.w3c.dom.Document the type we should be using? We can get it to

work for int, double, and string.

If org.w3c.dom.Document the correct type, can someone please show me segment of code for working with XML type (just getting value in and out would be sufficient)

Also, what is the type for Datetime in the back-end java code, anyone know?

Thank you very much.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

1. You need to use the built-in xMII data type "XMLDataType", and you create an instance of one using your Document object as in:

XMLDataType myXML = new XMLDataType(myDoc);

2. Use the Java class GregorianCalendar.

Rick

Former Member
0 Kudos

Thx for the reply.

Should I be importing ORG.oclc.openurl.dataTypes.XmlDataType for the XmlDataType or some other class for XmlDataType?

When you said,

XMLDataType myXML = new XMLDataType(myDoc);

What type is myDoc? Thank you.

Former Member
0 Kudos

No, import com.lighthammer.xml.XMLDataType.

myDoc is a org.w3c.dom.Document.

Note that this is for xMII 11.5, the import is slightly different for 12.0 (replace lighthammer with sap.xmii).

Former Member
0 Kudos

Thank you for the answer. The XML type is working fine now.

For GregorianCalendar,

private GregorianCalendar GCalendar = new GregorianCalendar();

When I use it in the setter method, it is not recongized

public void setDateTime ( GregorianCalendar gc )

But String is recongized.

public void setDateTime ( String gc )

So in order to make it works, I will have to convert (parsing and tokenizing) the String to the GregorianCalendar type? Thank you.

Former Member
0 Kudos

setDateTime in what class? Your own class?

Former Member
0 Kudos

Yes, one of my own class when I am trying to create a Custom Action Block. Like for using double type's setter, I have

public void setDouble ( double newDouble ) {

myDouble = newDouble;

}

, and for other types, they all takes the same type as parameter like

public void setInt ( int newInt ), but for the DateTime type,

public void setDateTime ( GregorianCalendar gc ) doesn't seems to work.

It gave an error and basically ask me to use String as the type.

Former Member
0 Kudos

Your action should use the Calendar type in its method signature, but the GregorianCalendar class in its implementation:

public Calendar getQueryStartDate() {

return _startdate;

}

public void setQueryStartDate(Calendar value) {

_startdate = value;

}

public Calendar getQueryEndDate() {

return _enddate;

}

public void setQueryEndDate(Calendar value) {

_enddate = value;

}

Former Member
0 Kudos

Using Calendar works. I got all the type working now, thank you for your help.

Answers (0)