Здравейте, това е, което правя за генериране на xml код:
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace nsSequence = factory.createOMNamespace("http://ws.apache.org/ns/synapse", "");
OMElement rootSequence = factory.createOMElement("sequence",nsSequence);
/*<FILTER>*/
OMNamespace nsFilter = factory.createOMNamespace("http://org.apache.synapse/xsd", "ns");
OMElement filter = factory.createOMElement("filter",nsFilter);
OMAttribute regex = factory.createOMAttribute("regex", null, "applID");
OMAttribute source = factory.createOMAttribute("source", null, "get-property('applicationID')");
filter.addAttribute(regex);
filter.addAttribute(source);
/*<THEN>*/
OMElement then = factory.createOMElement("then",null);
filter.addChild(then);
rootSequence.addChild(filter);
генерираният код е като този:
<sequence xmlns="http://ws.apache.org/ns/synapse">
<ns:filter xmlns:ns="http://org.apache.synapse/xsd" regex="APPP" source="get-property('applicationID')">
<then xmlns=""></then>
</ns:filter>
</sequence>
XMLNS="" в елемента THEN е голям проблем за мен.
използвам axiom-api 1.2.14... и прочетох някъде, че това е проблем (бъг), изпитан от други (може би вече решаващи?). Има ли начин да се заобиколи този проблем, за да се получи чист xml код? или по-добре да го решим?