cancel
Showing results for 
Search instead for 
Did you mean: 

XML Form builder

Former Member
0 Kudos

Hello everybody!

There is an XML form (created in XML Forms Builder). I need to create/edit xml files using this form, in the same way as I can do it in the Portal.

I have some code, which should solve my problem, but it isn't work:


IURLGeneratorService generatorService = (IURLGeneratorService) ResourceFactory.getInstance().
    getServiceFactory().getService("URLGeneratorService");

IUriReference reference = generatorService.getRelativeUri(PathKey.XML_FORMS_EDIT_PAGE);

UriQuery query = new UriQuery();
query.add("XMLFormID", "btexx_quicknotes");

reference = reference.setQuery(query.toExternalForm());
response.write("<a href="" + reference.toExternalForm() + "" >link</a><br>n");

It opens my XML form, but after clicking “save” button it rises exception:


Cannot read item b0c02216-adad-2810-3180-f457b90bace4.xml
com.sapportals.wcm.repository.InvalidUriException: Invalid RID: b0c02216-adad-2810-3180-f457b90bace4.xml
	at com.sapportals.wcm.repository.ResourceException.fillInStackTrace(ResourceException.java:399)
…

I suppose that there are some other necessary parameters for XML editor, but I don’t know where I can get it.

Does anyone know how to solve my problem?

Accepted Solutions (1)

Accepted Solutions (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Egor,

it's really easy to get an idea about what's needed - just check the URL called from the Folder -> New -> Forms -> [Form] command:

To create (that seems what you are trying here):

http://[server]/irj/servlet/prt/portal/prtroot/com.sap.km.cm.xmlformedit?XMLFormID=[form_name]&post/... of the folder where the doc will be created]&createmode=true

- so you missed the post/path parameter.

To edit:

http://[server]/irj/servlet/prt/portal/prtroot/com.sap.km.cm.xmlformedit?XMLFormID=&show/test=[path of the xml to be edited]

Hope it helps

Detlev

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks a lot for your answer, it was really helpful.

But I forgot about another problem. During new xmlfile-creation I need to pass initial values for some fields. It's like edit mode but for new xmlfile. Is it possible?

detlev_beutner
Active Contributor
0 Kudos

Hi Egor,

this is not possible dynamically. But you can define (static) default values for your input fields etc. within the XMLForm(Builder).

If you need such a dynamic mechanism, you could create a concrete instance of an XML file programtically (for instance, by copying an empty template you have created before) and then set the corresponding property dynamically before editing this newly created form instance.

Hope it helps

Detlev

PS: Please consider rewarding helpful answers...

Former Member
0 Kudos

Hi Detlev

I have a similar requirement to Egor and have created a new thread at [this|https://forums.sdn.sap.com/thread.jspa?threadID=1053751] link.

Can you please elaborate as to what are the relevant API's that are to be used and required jar files for them..??

Thanks

Deepak