--- apiVersion: v1 kind: List items: - apiVersion: v1 kind: ConfigMap metadata: labels: funktion.fabric8.io/kind: Connector provider: fabric8 project: connector-stax version: 1.1.24 group: io.fabric8.funktion.connector name: stax data: deployment.yml: | --- apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: funktion.fabric8.io/kind: Subscription connector: stax spec: replicas: 1 template: metadata: labels: funktion.fabric8.io/kind: Subscription connector: stax spec: containers: - image: fabric8/connector-stax:1.1.24 name: connector schema.yml: | --- component: kind: component scheme: stax syntax: stax:contentHandlerClass title: StAX description: The stax component allows messages to be process through a SAX ContentHandler. label: transformation deprecated: false async: false producerOnly: true javaType: org.apache.camel.component.stax.StAXComponent groupId: org.apache.camel artifactId: camel-stax version: 2.18.1 componentProperties: {} properties: contentHandlerClass: kind: path group: producer required: true type: string javaType: java.lang.String deprecated: false secret: false description: The FQN class name for the ContentHandler implementation to use. synchronous: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). documentation.adoc: "[[StAX-StAXComponent]]\nStAX Component\n~~~~~~~~~~~~~~\n\n\ *Available as of Camel 2.9*\n\nThe StAX component allows messages to be process\ \ through a SAX\nhttp://download.oracle.com/javase/6/docs/api/org/xml/sax/ContentHandler.html[ContentHandler].\ \ +\nAnother feature of this component is to allow to iterate over JAXB\nrecords\ \ using StAX, for example using the link:splitter.html[Splitter]\nEIP.\n\nMaven\ \ users will need to add the following dependency to their `pom.xml`\nfor this\ \ component:\n\n[source,xml]\n------------------------------------------------------------\n\ \n org.apache.camel\n camel-stax\n\ \ x.x.x\n \n\n------------------------------------------------------------\n\ \n[[StAX-URIformat]]\nURI format\n^^^^^^^^^^\n\n[source,java]\n--------------------------\n\ stax:content-handler-class\n--------------------------\n\nexample:\n\n[source,java]\n\ -----------------------------------\nstax:org.superbiz.FooContentHandler\n-----------------------------------\n\ \nFrom *Camel 2.11.1* onwards you can lookup a\n`org.xml.sax.ContentHandler`\ \ bean from the link:registry.html[Registry]\nusing the # syntax as shown:\n\ \n[source,java]\n---------------\nstax:#myHandler\n---------------\n\n[[Stax-Options]]\n\ Options\n~~~~~~~\n\n\n// component options: START\nThe StAX component has no\ \ options.\n// component options: END\n\n\n\n// endpoint options: START\nThe\ \ StAX component supports 2 endpoint options which are listed below:\n\n{% raw\ \ %}\n[width=\"100%\",cols=\"2,1,1m,1m,5\",options=\"header\"]\n|=======================================================================\n\ | Name | Group | Default | Java Type | Description\n| contentHandlerClass |\ \ producer | | String | *Required* The FQN class name for the ContentHandler\ \ implementation to use.\n| synchronous | advanced | false | boolean | Sets\ \ whether synchronous processing should be strictly used or Camel is allowed\ \ to use asynchronous processing (if supported).\n|=======================================================================\n\ {% endraw %}\n// endpoint options: END\n\n\n[[StAX-UsageofacontenthandlerasStAXparser]]\n\ Usage of a content handler as StAX parser\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ \nThe message body after the handling is the handler itself.\n\nHere an example:\n\ \n[source,java]\n--------------------------------------------------------------------------------------------------------\n\ from(\"file:target/in\")\n .to(\"stax:org.superbiz.handler.CountingHandler\"\ ) \n // CountingHandler implements org.xml.sax.ContentHandler or extends org.xml.sax.helpers.DefaultHandler\n\ \ .process(new Processor() {\n @Override\n public void process(Exchange\ \ exchange) throws Exception {\n CountingHandler handler = exchange.getIn().getBody(CountingHandler.class);\n\ \ // do some great work with the handler\n }\n });\n--------------------------------------------------------------------------------------------------------\n\ \n[[StAX-IterateoveracollectionusingJAXBandStAX]]\nIterate over a collection\ \ using JAXB and StAX\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nFirst\ \ we suppose you have JAXB objects.\n\nFor instance a list of records in a wrapper\ \ object:\n\n[source,java]\n-------------------------------------------------\n\ import java.util.ArrayList;\nimport java.util.List;\nimport javax.xml.bind.annotation.XmlAccessType;\n\ import javax.xml.bind.annotation.XmlAccessorType;\nimport javax.xml.bind.annotation.XmlElement;\n\ import javax.xml.bind.annotation.XmlRootElement;\n\n@XmlAccessorType(XmlAccessType.FIELD)\n\ @XmlRootElement(name = \"records\")\npublic class Records {\n @XmlElement(required\ \ = true)\n protected List record;\n\n public List getRecord()\ \ {\n if (record == null) {\n record = new ArrayList();\n\ \ }\n return record;\n }\n}\n-------------------------------------------------\n\ \nand\n\n[source,java]\n---------------------------------------------------------\n\ import javax.xml.bind.annotation.XmlAccessType;\nimport javax.xml.bind.annotation.XmlAccessorType;\n\ import javax.xml.bind.annotation.XmlAttribute;\nimport javax.xml.bind.annotation.XmlType;\n\ \n@XmlAccessorType(XmlAccessType.FIELD)\n@XmlType(name = \"record\", propOrder\ \ = { \"key\", \"value\" })\npublic class Record {\n @XmlAttribute(required\ \ = true)\n protected String key;\n\n @XmlAttribute(required = true)\n\ \ protected String value;\n\n public String getKey() {\n return\ \ key;\n }\n\n public void setKey(String key) {\n this.key = key;\n\ \ }\n\n public String getValue() {\n return value;\n }\n\n \ \ public void setValue(String value) {\n this.value = value;\n }\n\ }\n---------------------------------------------------------\n\nThen you get\ \ a XML file to process:\n\n[source,xml]\n-------------------------------------------------------\n\ \n\n \ \ \n \n \n \n \n \n\n-------------------------------------------------------\n\ \nThe StAX component provides an `StAXBuilder` which can be used when\niterating\ \ XML elements with the Camel link:splitter.html[Splitter]\n\n[source,java]\n\ ------------------------------------------\nfrom(\"file:target/in\")\n .split(stax(Record.class)).streaming()\n\ \ .to(\"mock:records\");\n------------------------------------------\n\ \nWhere `stax` is a static method on\n`org.apache.camel.component.stax.StAXBuilder`\ \ which you can static\nimport in the Java code. The stax builder is by default\ \ namespace aware\non the XMLReader it uses. From *Camel 2.11.1* onwards you\ \ can turn this\noff by setting the boolean parameter to false, as shown below:\n\ \n[source,java]\n-------------------------------------------------\nfrom(\"\ file:target/in\")\n .split(stax(Record.class, false)).streaming()\n \ \ .to(\"mock:records\");\n-------------------------------------------------\n\ \n[[StAX-ThepreviousexamplewithXMLDSL]]\nThe previous example with XML DSL\n\ +++++++++++++++++++++++++++++++++\n\nThe example above could be implemented\ \ as follows in XML DSL\n\n[[StAX-SeeAlso]]\nSee Also\n^^^^^^^^\n\n* link:configuring-camel.html[Configuring\ \ Camel]\n* link:component.html[Component]\n* link:endpoint.html[Endpoint]\n\ * link:getting-started.html[Getting Started]\n\n"