2

I couldn't find any advices on how to setup Smooks (on WSO2 Developer Studio 3.1) in order to it properly read a xml input which has a namespace declaration.

Without the namespace the transformation works just fine!

By informing the xmlns in the input, I get this exception:

Error on line 5, column 19 in free-marker-template
Expecting a string, date or number here, Expression .vars["order"]["order-items/order-item/@id"] is instead a freemarker.ext.dom.NodeListModel
The problematic instruction:
----------
==> ${.vars["order"]["order-items/order-item/@id"]} [on line 5, column 17 in free-marker-template]

These are both my input and output:

   <order id='444' xmlns="http://example.com">
            <header>
                <customer number="555">Amila</customer>
            </header>
            <order-items>
                <order-item id='1'>
                    <product>1</product>
                    <quantity>2</quantity>
                    <price>400</price>
                </order-item>
            </order-items>
        </order>
<salesorder>
        <details>
            <orderid></orderid>
            <customer>
                <id></id>
                <name></name>
            </customer>
        </details>
        <itemList>
            <item>
                <id></id>
                <productId></productId>
                <quantity></quantity>
                <price></price>
            </item>
        </itemList>
    </salesorder>

I've also tried Smooks core´s namespace declarations as per Smooks site:

<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" 
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd"
xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.4.xsd"
>
  <core:namespaces>
        <core:namespace prefix="ex" uri="http://example.com/"/>
    </core:namespaces>

But it seems not to be supported in the IDE since the configuration editor raises this exception:

-Value 'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@53abd5a9 (mixed: null, anyAttribute: null)' is not legal. (platform:/resource/Corp/smooks-config.xml,6,20)

Well, any idea?

Community
  • 1
  • 1
Alexander
  • 558
  • 4
  • 13

1 Answers1

0

Instead of Smooks, can't you use a XSLT? It will avoid the namespace issue you have.

Amila Maharachchi
  • 2,121
  • 2
  • 15
  • 21
  • Using a visual tool is by far the best way to create transformations, do you agree? I'd like to know why WSO2 didn't fix it yet. Any idea? Would we expect that fix? – Alexander Aug 01 '13 at 01:21