Expand my Community achievements bar.

SOLVED

DSC with XML data type

Avatar

Level 3

Hi,

Can someone explain to me what the difference is between the xml data type and the Document data type in workbench? I would like to use the xml datatype in my DSC thinking it is most likely the best representation of an xml string. But I've heard that Document is more widely used and that it can represent an xml entity as well. Is this right?

My ultimate goal is to write a DSC and use a type that represent an xml string. I would like the component.xml to have the type for my input variables to automatically be typed as "xml" or "document" (whatever the one i should be using is).

I tried creating variables of both types ("xml' and "document", lower case d) and have those passed into my DSC for inspection. The object passed in are as follows:

xml: org.apache.xerces.dom.DocumentImpl

document: com.adobe.idp.Document

But if I use any of those in my component.xml, workbench is typing my variables as "DocumentImpl" or "Document".

Any ideas?

Thanks in advance!

Nic

1 Accepted Solution

Avatar

Correct answer by
Level 10

Yes. I though it would be showing xml for the variable type but it does show Document in both cases. But they are different. One is a org.w3c.dom.Document and the other one is a com.adobe.idp.Document.

So I guess try to use a title for that parameter that reflects the nature of the variable you're trying to use.

Also you can use the <hint> tag to put a bit more explanation on the variable type you want people to use.

Jasmin

View solution in original post

5 Replies

Avatar

Level 10

The xml variable (org.w3c.doc.Document) is a native xml data type. That means you can use xml functions and/or xPath expressions on the content of the variable.

The document variable (com.adobe.idp.Document) is a more generic data type that can store any binary data. If you happen to store xml in that data type, you won't be able to run xml functions or xPath expression directly on the variable content since it's treated as binary data.

If  you don't need to manipulate or access the content of the xml, then either data types will work. Otherwise, I would use the xml data type.

In your component xml, make sure your xml data type is set to org.w3c.doc.Document and you'll see xml in Workbench.

Jasmin

Avatar

Level 3

Thanks Jasmin,

This is a great explanation. Unfortunately using "org.w3c.doc.Document" in the component.xml results in the suggested data types in the input/output sections (when using variable) showing as "Document". Does this matter? Will I end up with issues when passing this variable to other components which require "document"?

How about "xml" what do I need to put in the component.xml for that one?

Thanks

Nic

Avatar

Correct answer by
Level 10

Yes. I though it would be showing xml for the variable type but it does show Document in both cases. But they are different. One is a org.w3c.dom.Document and the other one is a com.adobe.idp.Document.

So I guess try to use a title for that parameter that reflects the nature of the variable you're trying to use.

Also you can use the <hint> tag to put a bit more explanation on the variable type you want people to use.

Jasmin

Avatar

Level 3

Sounds good, thank you. Then I'll assume the "xml" type is some internal mapping from workbench that just maps

to the same thing as org.w3c.dom.Document.

Thanks