Привет, это то, что я делаю для создания 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? или лучше решить?