This is the modification to inbuilt xpath udf which is present with hive. The xpath udf gives you the entire xml path, but using this udf you can map your xpath to either MAP or Struct