I have created a typetree for the csv file as input and used the xml type tree created from DTD as output. Still I'm having
problem mapping the header(1:1) and the data (s). It's been a long time since my last mapping program so bear with me.
Thanks for the hints. Any more hints on mapping will be appreciated.
We have an older version of Excel (2000) so there is no way for me to create xml file from excel. Is there tools or a way to create the DTD from excel? The above dtd sample I created manually using notepad. Is there a better way?
Check the delimiters and terminators ..very important or else it will fail to validate your input file and hence the map will not run and throws input invalid.
2. Output tree.
creating dtd:
There are some tools for crreating dtd's but I am not aware of them, I have done it manually.
<!ELEMENT Sample (PA+) >
<!ELEMENT PA (Header,message) >
<!ELEMENT Header (name,age) >
<!ELEMENT message (Data*) >
<!ELEMENT Data (name,age) >
<!ELEMENT name (#PCDATA) >
<!ELEMENT age (#PCDATA) >
<!ATTLIST Sample VERSION (1) #REQUIRED >
<!ATTLIST PA BEGIN (1) #REQUIRED >
<!ATTLIST Header SEGMENT (1) #REQUIRED >
<!ATTLIST message BEGIN (1) #REQUIRED >
<!ATTLIST Data SEGMENT (1) #REQUIRED >
The fields for header can be changed. Here I just used the same elements that are used for data.
Step 2 Mapping:
In the output card, perform mapping under Global/ ElemDecl PA
In that you find Header and data.
Do one to one mapping for header and create a functional map for Data under seq(s)
When I do mapping I got output something like this
Thanks for the valuable posting. I will try to follow your way and see if I can map it correctly. By the way my Mercator is version 5.0. I hope this will work. I was told that we need to map a csv file into xml. I have not seen the full spec yet but I'm getting ready just in case.
I created the dtd from your example and imported to mercator.
It created a typetree perfectly but I cannot find
Global/ ElemDecl PA groups or categories at all.
Could this be difference in version? I'm working on mercator 5.0. Still struggling with the mapping part.
I done this in 7.5. The imported tree is generated for 6.7 and higher versions. Definetely this structure will be different from that of 5.0. But I think that will not be a problem while mapping.
But any ways I will try in 5.0 and check the result and update you.
It works fine in mercator 5.0 also.
Import the same dtd in 5.0. The tree will contain xml as root and also you can find the
categories like #CHILD DATA, #CONTENT,#DATA ..., document,etc.
Now in the map you can select Document as the type for the output card.
In the output card you can see prolog and Sample element.
Prolog contains all the xml declarations like version,encoding, standards.
You can fill them later but for now keep them to NONE.
Prolog(0:1) = NONE
Sample element:
Version = 1.0
And create a functional map for PA element which is under Sample child data.
In the functional mapping you again find PA attlist, it contains the begin attribute ..map it to 1.
In this functional map you find both header and data part. Do one to one mapping for header and create a functional map for DATA part.
FYI, Version 5.x was sunsetted three years ago. There have been many fixes (especially to XML) since then. Suggest you contact sales person and begin making plans to upgrade to 8.0 (due out next month). If you find a bug in 5.x, you are up the creek without a paddle, or a boat.
Still agonizing but getting close. This time I could not map
the begin attribute(under PA attlist) to 1.
Here's what I did.
1. Create output card using Document group.
set Prolog(0:1) = NONE
set VERSION = 1.0 in Sample element
2. Create another functional map(PAELEM) in PA element(1:s) which is under Sample #CHILDDATA
3. In PAELEM card I used PA group under Attlist category and
here's where I cannot map BEGIN attribute to 1. It's giving me an error.
In the first output card (Document) It does'nt give me option to map header and data part(grayed out). Am I in the right direction? Thanks very much.
1. Expand PA Attlist. You see BEGIN PA Attlist, expand that you fing Begin value..map that to "1"
Note:
In the XML structure you always find two subsections one attribute list and one child data
Generally in att you find feilds like begin, segment ,etc
and in child data you find actual data.
2. Now expand PA#CHild data.keep on expanding till you find segment header under Header attlist then under child data
you can find name and age elements..map them.
3. You can also see in the same card the Message elemnt.
It also has Begin and Child data(s)
Map begin value to "1" and create a functional map for Data elements.
M114 ERROR:
Map: Records Output: PA Element:Sample #CHILDDATA:Sample #CONTENT:Card2
Output argument of rule does not match output type:
=PAElem(Nameata,Ageata)
Is PA Element(1:s) the right item to put the functional map?
I think I got it. I have my first output same as your output. However, my output is in one long string. Is there a way or do I have to change something(DTD?) so that it will have a line
by line output?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.