Quantcast
Viewing all articles
Browse latest Browse all 8695

XML Simple Transformation namespace issue

I am currently trying to do a simple transformation in STRANS that will require the prefix <x:> for all my tags. I have added a namespace entry in STRANS of xmlns:x="http://www.w3.org/2001/XMLSchema" and labeled my element "x.PLANT".

 

My SourceCde looks like this:

 

<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"

xmlns:ddic="http://www.sap.com/abapxml/types/dictionary"

xmlns:def="http://www.sap.com/abapxml/types/defined

xmlns:x="http://www.w3.org/2001/XMLSchema">

<tt:root name="PLANT" type="ddic:WERKS_D"/>

  <tt:template>

  <x:PLANT tt:value-ref=".PLANT"/>

  </tt:template>

</tt:transform>

 

 

 

My XML file looks like this:

 

<?xml version="1.0" encoding="UTF-8" ?>

<x:PLANT>1201</x:PLANT>

 

When I run call my transformation:

 

   

DATA: gt_itab  TYPE STANDARD TABLE OF char2048.

 

data : result type werks_d,

wa_result type werks_d.

 

 

call transformation Z_TEST
SOURCE XML gt_itab
resultplant = result.

 

I get a short dump stating the following:

 

Error analysis

    An exception occurred that is explained in detail below.

    The exception, which is assigned to class 'CX_ST_MATCH_ELEMENT', was not caught

     and

    therefore caused a runtime error.

    The reason for the exception is:

    XML matching error

    Expected was element-start: "PLANT" [http://www.w3.org/2001/XMLSchema] Read was

     invalid: " " [ ].

 

Can someone please offer a solution to the pain I am currently experiencing? All thoughts are much appreciated.


Viewing all articles
Browse latest Browse all 8695

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>