Exemplo n.º 1
0
    def startElement(self, name, attrs):
        new_node = None
        if name == 'BoxInterface':
            new_node = node_box_interface.BoxInterface(
                xar_types.attributes(attrs))
        elif name == 'Bitmap':
            new_node = node_bitmap_v2.BitmapV2(xar_types.attributes(attrs))
        elif name == 'Parameter':
            new_node = node_parameter.Parameter(xar_types.attributes(attrs))
        elif name == 'Content':
            new_node = node_box_content.BoxContent(xar_types.attributes(attrs))

        if new_node:
            if not self._root:
                self._root = new_node
            # Attach to parent here
            if self._nodes:
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name, new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)

            self._nodes.append(new_node)
        else:
            parent_node = self._nodes.pop()
            parent_node.attach_attribute(name, xar_types.attributes(attrs))
            self._nodes.append(parent_node)
Exemplo n.º 2
0
    def startElement(self, name, attrs):
        new_node = None
        if name == 'Animation':
            new_node = node_animation.Animation(
                xar_types.attributes(attrs))
        elif name == 'ActuatorList':
            new_node = node_actuator_list.ActuatorList(
                xar_types.attributes(attrs))
        elif name == 'ActuatorCurve':
            new_node = node_actuator_curve.ActuatorCurve(
                xar_types.attributes(attrs))
        elif name == 'Key':
            new_node = node_actuator_key.ActuatorKey(
                xar_types.attributes(attrs))

        if new_node:
            if not self._root:
                self._root = new_node
            # Attach to parent here
            if self._nodes:
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name, new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)

            self._nodes.append(new_node)
        else:
            raise Exception("The node %s is unknown" % name)
Exemplo n.º 3
0
    def startElement(self, name, attrs):
        new_node = None
        if name == 'BoxInterface':
            new_node = node_box_interface.BoxInterface(
                xar_types.attributes(attrs))
        elif name == 'Bitmap':
            new_node = node_bitmap_v2.BitmapV2(xar_types.attributes(attrs))
        elif name == 'Parameter':
            new_node = node_parameter.Parameter(xar_types.attributes(attrs))
        elif name == 'Content':
            new_node = node_box_content.BoxContent(xar_types.attributes(attrs))

        if new_node:
            if not self._root:
                self._root = new_node
            # Attach to parent here
            if self._nodes:
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name, new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)

            self._nodes.append(new_node)
        else:
            parent_node = self._nodes.pop()
            parent_node.attach_attribute(name,
                                         xar_types.attributes(attrs))
            self._nodes.append(parent_node)
    def startElement(self, name, attrs):
        new_node = None
        if name == 'FlowDiagram':
            new_node = node_flow_diagram.FlowDiagram(
                xar_types.attributes(attrs))
        elif name == 'BoxInstance':
            new_node = node_box_instance.BoxInstance(
                xar_types.attributes(attrs))
        elif name == 'ParameterValue':
            new_node = node_parameter_value.ParameterValue(
                xar_types.attributes(attrs))
        elif name == 'PluginContent':
            new_node = node_plugin_content.PluginContent(
                xar_types.attributes(attrs))
            self._plugin_content = True

        if new_node:
            if not self._root:
                self._root = new_node
            # Attach to parent here
            if self._nodes:
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name, new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)

            self._nodes.append(new_node)
        else:
            if self._plugin_content:
                """ this beacon can embed anything, raw string as well as
                    sub nodes.
                """
                new_node = node_plugin_content.PluginSubNode(name, attrs)
                parent_node = self._nodes.pop()
                parent_node.add_subnode(new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)

                self._nodes.append(new_node)
            else:
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name,
                                             xar_types.attributes(attrs))
                self._nodes.append(parent_node)

        self._buffer = ""
Exemplo n.º 5
0
    def startElement(self, name, attrs):
        new_node = None
        if name == "BehaviorSequence":
            new_node = node_behavior_sequence.BehaviorSequence(xar_types.attributes(attrs))
        elif name == "BehaviorLayer":
            new_node = node_behavior_layer.BehaviorLayer(xar_types.attributes(attrs))
        elif name == "BehaviorKeyframe":
            new_node = node_behavior_keyframe_v2.BehaviorKeyframeV2(xar_types.attributes(attrs))

        if not self._root:
            self._root = new_node
        # Attach to parent here
        if self._nodes:
            parent_node = self._nodes.pop()
            parent_node.attach_attribute(name, new_node)
            parent_node.add_child(new_node)
            self._nodes.append(parent_node)

        self._nodes.append(new_node)
Exemplo n.º 6
0
    def startElement(self, name, attrs):
        new_node = None
        if name == 'BehaviorSequence':
            new_node = node_behavior_sequence.BehaviorSequence(
                xar_types.attributes(attrs))
        elif name == 'BehaviorLayer':
            new_node = node_behavior_layer.BehaviorLayer(
                xar_types.attributes(attrs))
        elif name == 'BehaviorKeyframe':
            new_node = node_behavior_keyframe_v2.BehaviorKeyframeV2(
                xar_types.attributes(attrs))

        if not self._root:
            self._root = new_node
        # Attach to parent here
        if self._nodes:
            parent_node = self._nodes.pop()
            parent_node.attach_attribute(name, new_node)
            parent_node.add_child(new_node)
            self._nodes.append(parent_node)

        self._nodes.append(new_node)
Exemplo n.º 7
0
    def startElement(self, name, attrs):
        new_node = None
        if name == 'ChoregrapheProject':
            new_node = node_choregraphe_project.ChoregrapheProject(
                xar_types.attributes(attrs))
        elif name == 'BoxInstance':
            new_node = node_box_instance.BoxInstance(
                xar_types.attributes(attrs))
        elif name == 'ParameterValue':
            new_node = node_parameter_value.ParameterValue(
                xar_types.attributes(attrs))
        elif name == 'PluginContent':
            new_node = node_plugin_content.PluginContent(
                xar_types.attributes(attrs))

        if new_node:
            if not self._root:
                self._root = new_node
            if self._nodes:
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name, new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)

            self._nodes.append(new_node)
        else:
            """ pluginContent beacon can embed anything, raw string as well as
                sub nodes.
            """
            new_node = node_plugin_content.PluginSubNode(name, attrs)
            parent_node = self._nodes.pop()
            parent_node.add_subnode(new_node)
            parent_node.add_child(new_node)
            self._nodes.append(parent_node)
            self._nodes.append(new_node)

        self._buffer = ""
Exemplo n.º 8
0
    def startElement(self, name, attrs):
        new_node = None
        if name == 'ChoregrapheProject':
            new_node = node_choregraphe_project.ChoregrapheProject(
                xar_types.attributes(attrs))
        elif name == 'BoxInstance':
            new_node = node_box_instance.BoxInstance(
                xar_types.attributes(attrs))
        elif name == 'ParameterValue':
            new_node = node_parameter_value.ParameterValue(
                xar_types.attributes(attrs))
        elif name == 'PluginContent':
            new_node = node_plugin_content.PluginContent(
                xar_types.attributes(attrs))

        if new_node:
            if not self._root:
                self._root = new_node
            if self._nodes:
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name, new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)

            self._nodes.append(new_node)
        else:
            """ pluginContent beacon can embed anything, raw string as well as
                sub nodes.
            """
            new_node = node_plugin_content.PluginSubNode(name, attrs)
            parent_node = self._nodes.pop()
            parent_node.add_subnode(new_node)
            parent_node.add_child(new_node)
            self._nodes.append(parent_node)
            self._nodes.append(new_node)

        self._buffer = ""
Exemplo n.º 9
0
    def startElement(self, name, attrs):
        new_node = None
        if name == 'Box':
            new_node = node_box.Box(xar_types.attributes(attrs))
        elif name == 'script':
            new_node = node_script.Script(xar_types.attributes(attrs))
        elif name == 'Parameter':
            new_node = node_parameter.Parameter(xar_types.attributes(attrs))
        elif name == 'pluginContent':
            new_node = node_plugin_content.PluginContent(
                xar_types.attributes(attrs))
            self._plugin_content = True
        elif name == 'Timeline':
            new_node = node_timeline.Timeline(xar_types.attributes(attrs))
        elif name == 'BehaviorLayer':
            new_node = node_behavior_layer.BehaviorLayer(
                xar_types.attributes(attrs))
        elif name == 'BehaviorKeyframe':
            new_node = node_behavior_keyframe.BehaviorKeyframe(
                xar_types.attributes(attrs))
        elif name == 'Diagram':
            new_node = node_diagram.Diagram(xar_types.attributes(attrs))
        elif name == 'ActuatorList':
            new_node = node_actuator_list.ActuatorList(
                xar_types.attributes(attrs))
        elif name == 'ActuatorCurve':
            new_node = node_actuator_curve.ActuatorCurve(
                xar_types.attributes(attrs))
        elif name == 'Key':
            new_node = node_actuator_key.ActuatorKey(
                xar_types.attributes(attrs))

        if new_node:
            if not self._root:
                self._root = new_node
            # Attach to parent here
            if self._nodes:
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name, new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)

            self._nodes.append(new_node)
        else:
            """ pluginContent beacon can embed anything, raw string as well as
                sub nodes.
            """
            if self._plugin_content:
                new_node = node_plugin_content.PluginSubNode(name, attrs)
                parent_node = self._nodes.pop()
                parent_node.add_subnode(new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)
                self._nodes.append(new_node)

            elif (self._nodes and name != 'bitmap' and name != 'content'):
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name,
                                             xar_types.attributes(attrs))
                self._nodes.append(parent_node)

        self._buffer = ""
Exemplo n.º 10
0
    def startElement(self, name, attrs):
        new_node = None
        if name == 'Box':
            new_node = node_box.Box(xar_types.attributes(attrs))
        elif name == 'script':
            new_node = node_script.Script(xar_types.attributes(attrs))
        elif name == 'Parameter':
            new_node = node_parameter.Parameter(xar_types.attributes(attrs))
        elif name == 'pluginContent':
            new_node = node_plugin_content.PluginContent(
                xar_types.attributes(attrs))
            self._plugin_content = True
        elif name == 'Timeline':
            new_node = node_timeline.Timeline(xar_types.attributes(attrs))
        elif name == 'BehaviorLayer':
            new_node = node_behavior_layer.BehaviorLayer(
                xar_types.attributes(attrs))
        elif name == 'BehaviorKeyframe':
            new_node = node_behavior_keyframe.BehaviorKeyframe(
                xar_types.attributes(attrs))
        elif name == 'Diagram':
            new_node = node_diagram.Diagram(xar_types.attributes(attrs))
        elif name == 'ActuatorList':
            new_node = node_actuator_list.ActuatorList(
                xar_types.attributes(attrs))
        elif name == 'ActuatorCurve':
            new_node = node_actuator_curve.ActuatorCurve(
                xar_types.attributes(attrs))
        elif name == 'Key':
            new_node = node_actuator_key.ActuatorKey(
                xar_types.attributes(attrs))

        if new_node:
            if not self._root:
                self._root = new_node
            # Attach to parent here
            if self._nodes:
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name, new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)

            self._nodes.append(new_node)
        else:
            """ pluginContent beacon can embed anything, raw string as well as
                sub nodes.
            """
            if self._plugin_content:
                new_node = node_plugin_content.PluginSubNode(name, attrs)
                parent_node = self._nodes.pop()
                parent_node.add_subnode(new_node)
                parent_node.add_child(new_node)
                self._nodes.append(parent_node)
                self._nodes.append(new_node)

            elif (self._nodes and name != 'bitmap' and name != 'content'):
                parent_node = self._nodes.pop()
                parent_node.attach_attribute(name, xar_types.attributes(attrs))
                self._nodes.append(parent_node)

        self._buffer = ""