Hi All,

If we consider an XML which has multiple namespaces as below ,

<root>
<h:table xmlns:h="http://www.w3.org/TR/html4/";>
  <h:name>Asian Coffee Table</h:name>
  <h:width>74</h:width>
  <h:length>129</h:length>
</h:table>
<f:table xmlns:f="http://www.w3schools.com/furniture";>
  <f:name>African Coffee Table</f:name>
  <f:width>80</f:width>
  <f:length>120</f:length>
</f:table>
</root>

The avro schema should be as follows ,

{
  "type" : "record",
  "name" : "root",
  "fields" : [ {
        "type" : "record",
        "name" : "tableRecord",
       * "doc" : "http://www.w3.org/TR/html4/
<http://www.w3.org/TR/html4/>",*
        "namespace" : "http://www.w3.org/TR/html4/";
        "fields" : [ {
          "name" : "name",
          "type" : [ "null", "string" ]
          "doc" : "http://www.w3.org/TR/html4/";
          } , {
          "name" : "width",
          "type" : [ "null", "int" ]
          },{
          "name" : "length",
          "type" : [ "null", "int" ]
          }]
        }, {
        "type" : "record",
        "name" : "tableRecord",
      *  "doc" : "http://www.w3schools.com/furniture
<http://www.w3schools.com/furniture>",*
        "namespace" : "http://www.w3schools.com/furniture";
        "fields" : [ {
          "name" : "name",
          "type" : [ "null", "string" ]
          } , {
          "name" : "width",
          "type" : [ "null", "int" ]
          },{
          "name" : "length",
          "type" : [ "null", "int" ]
          }]
        } ]
}

When representing this using the Visual DataMapper Editor, in order to
differentiate the two records, we can add a namespace prefix to the name of
the record as shown below.


​But when generating the Avro Schema, if we pass this value as the name of
the node it  throws *org.apache.avro.SchemaParseException: Illegal
character in: y:tableRecord.*

So, if we use only the name (tableRecord, by removing the prefix) to create
the avro schema, how are we going to differentiate the records separately
when generating the mapping config?

eg: If we are to map a field in  y:tableRecord with a field
in y:tableRecord etc. How can we differentiate this?

This usecase of having multiple namespaces can be displayed graphically in
the Design view by appending a namespace prefix, but it seems this will
have issues in generating the avro schema and the mapping config.

Your suggestions are highly appreciated.

Thanks,
Sohani
Sohani Weerasinghe
Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog     :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to