Search in sources :

Example 1 with XMLComplexStep

use of com.twinsoft.convertigo.beans.steps.XMLComplexStep in project convertigo by convertigo.

the class StepUtils method createElementStep.

private static Step createElementStep(Sequence mainSequence, Object parent, Element element) throws EngineException {
    Step step = null;
    if (element != null) {
        if (parent != null) {
            // element.getAttribute(xsd.getXmlGenerationDescription().getOccursAttribute());
            String occurs = element.getAttribute("maxOccurs");
            if (!occurs.equals("")) {
                if (occurs.equals("unbounded"))
                    occurs = "10";
                if (Long.parseLong(occurs, 10) > 1) {
                    parent = createIteratorStep(mainSequence, parent, element);
                }
            }
        }
        String tagName = element.getTagName();
        String localName = element.getLocalName();
        String elementNodeName = (localName == null) ? tagName : localName;
        Node firstChild = element.getFirstChild();
        boolean isComplex = ((firstChild != null) && (firstChild.getNodeType() != Node.TEXT_NODE));
        if (isComplex) {
            step = new XMLComplexStep();
            ((XMLComplexStep) step).setNodeName(elementNodeName);
        } else {
            step = new XMLElementStep();
            ((XMLElementStep) step).setNodeName(elementNodeName);
        }
        step.bNew = true;
        addStepToParent(mainSequence, parent, step);
    }
    return step;
}
Also used : XMLElementStep(com.twinsoft.convertigo.beans.steps.XMLElementStep) Node(org.w3c.dom.Node) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep) XMLAttributeStep(com.twinsoft.convertigo.beans.steps.XMLAttributeStep) Step(com.twinsoft.convertigo.beans.core.Step) IteratorStep(com.twinsoft.convertigo.beans.steps.IteratorStep) XMLElementStep(com.twinsoft.convertigo.beans.steps.XMLElementStep) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep)

Aggregations

Step (com.twinsoft.convertigo.beans.core.Step)1 IteratorStep (com.twinsoft.convertigo.beans.steps.IteratorStep)1 XMLAttributeStep (com.twinsoft.convertigo.beans.steps.XMLAttributeStep)1 XMLComplexStep (com.twinsoft.convertigo.beans.steps.XMLComplexStep)1 XMLElementStep (com.twinsoft.convertigo.beans.steps.XMLElementStep)1 Node (org.w3c.dom.Node)1