We help IT Professionals succeed at work.

New to XML: How to create a Text field

hologos2357
hologos2357 used Ask the Experts™
on
Hi.  This question is worth so much because it is urgent, and I don't suspect it is difficult.  I am using FedEx shipmanager's export feature to export tracking data into a csv.  An xml file is used to do the export.  Although the inlcuded wizard makes it easy to map certain fedex db fields to certain new fields for export, there is no way to insert a field which must be the same each time.  That is, one field, called "Gateway" needs to say "FedEx" every time a new record is written to the csv.  I don't know how to do that with XML.  I have included the field in the header, so each time i try to export, null gets exported to that column, but that's as far as I've gotten.  Please help!

Here is the current doc:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<profile intergrationtype="1" hostlanguage="0" hosttype="0" completed="True" profileversion="0224.01">
  <name>my_export</name>
  <date>10/20/2006 2:24:29 PM</date>
  <datasource>
    <name>C:\Documents and Settings\FedEx\tracking-export.csv</name>
    <provider>#Internal#</provider>
    <datasourceinformation type="2">C:\Documents and Settings\FedEx\tracking-export.csv</datasourceinformation>
    <table delimiter="," header="1">
    <field name="TrackingNumber" type="0" ordinal="0" screenviewtype="0"/>
    <field name="Gateway" type="0" ordinal="1" screenviewtype="0"/>
    <field name="ShippingMethodID" type="0" ordinal="2" screenviewtype="0"/>
    <field name="OrderID" type="0" ordinal="3" screenviewtype="0"/>
    </table>
    <command activate="4" type="1" screenviewtype="0">
    <table name="tracking-export.csv" alias="tracking-export.csv" delimiter="," header="1" tabletype="0">
    <field name="OrderID" alias="OrderID" type="0" ordinal="3" screenviewtype="0">
    <id>25</id>
    <fename>Customer Reference</fename>
    <key>25Package</key>
    <fetype>0</fetype>
    <fesize>39</fesize>
    <category>Package</category>
    <fegroup>Miscellaneous</fegroup>
    <shipmentlevel>.Reference</shipmentlevel>
    <packagelevel>.Reference</packagelevel>
    <mpscollection>True</mpscollection>
    </field>
    <field name="ShippingMethodID" alias="ShippingMethodID" type="0" ordinal="2" screenviewtype="0">
    <id>1274</id>
    <fename>Service Type</fename>
    <key>1274Package</key>
    <fetype>1</fetype>
    <fesize>2</fesize>
    <category>Package</category>
    <fegroup>Miscellaneous</fegroup>
    <conversiongroup>servicetypes</conversiongroup>
    <shipmentlevel>.ServiceType</shipmentlevel>
    <packagelevel>.ServiceType</packagelevel>
    <conversion>
    <select value="154">1 - Priority Overnight</select>
    <select value="153">5 - Standard Overnight</select>
    <select value="152">3 - 2 Day</select>
    <select value="153">6 - First Overnight</select>
    <select value="151">20 - Express Saver</select>
    <select value="500">92 - Ground</select>
    <select value="500">90 - Ground Home Delivery</select>
    </conversion>
    </field>
    <field name="TrackingNumber" alias="TrackingNumber" type="0" ordinal="0" screenviewtype="0">
    <id>29</id>
    <fename>Tracking Number</fename>
    <key>29TrackingNumber</key>
    <fetype>0</fetype>
    <fesize>15</fesize>
    <category>Tracking Number</category>
    <fegroup>Tracking Number</fegroup>
    <shipmentlevel>.TrackingNumber</shipmentlevel>
    <packagelevel>.TrackNo</packagelevel>
    </field>
    </table>
    <field screenviewtype="0">
    <id>29</id>
    <fename>Tracking Number</fename>
    <key>29TrackingNumber</key>
    <fetype>0</fetype>
    <fesize>15</fesize>
    <category>Tracking Number</category>
    <fegroup>Tracking Number</fegroup>
    <occurrence>1</occurrence>
    <shipmentlevel>.TrackingNumber</shipmentlevel>
    <packagelevel>.TrackNo</packagelevel>
    </field>
    <field screenviewtype="0">
    <id>25</id>
    <fename>Customer Reference</fename>
    <key>25Package</key>
    <fetype>0</fetype>
    <fesize>39</fesize>
    <category>Package</category>
    <fegroup>Miscellaneous</fegroup>
    <occurrence>1</occurrence>
    <shipmentlevel>.Reference</shipmentlevel>
    <packagelevel>.Reference</packagelevel>
    <mpscollection>True</mpscollection>
    </field>
    <field screenviewtype="0">
    <id>1274</id>
    <fename>Service Type</fename>
    <key>1274Package</key>
    <fetype>1</fetype>
    <fesize>2</fesize>
    <category>Package</category>
    <fegroup>Miscellaneous</fegroup>
    <conversiongroup>servicetypes</conversiongroup>
    <occurrence>1</occurrence>
    <shipmentlevel>.ServiceType</shipmentlevel>
    <packagelevel>.ServiceType</packagelevel>
    </field>
    </command>
  </datasource>
</profile>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
what do you use to export the field?

Author

Commented:
I don't know.  Would it be an xml file too?  If not, I'm not sure I can access where the transform happens, but export occurs every time I click the ship button in my FedEx software.

Thanks

Commented:
It is hard to provide a solution without knowing the following:

* An XSLT that the software uses to create the XML
* If there isn't an XSLT, then you will have to post-process each file with a separate XSLT. Is this an option?

If the latter is an option, I can probably whip up an example XSLT for you.

Kurt

Author

Commented:
I searched the fedex dir.  There are no xslt docs, but there are a few .xsl.  I was thinking there had to be a way to insert a text value regardless of the transform.  Is that wrong?  I don't think I can process it after it has been tranformed, or if there is a way I have no idea how.  If I am totally wrong about this, let me know.

Thanks!
Commented:
Is there a way to insert the text value regardless of the transform? I really have no idea not being familiar with the application. But a simple modification to one (or more) of the XSL files may easily correct your problem.

There are ways to post-process your XML, but it requires some manual intervention for each file OR you can automate with a simple application. Again, not knowing anything about your environment and how the current process works, it is difficult for me to provide a good answer.

Can you view the XSL documents? If so, are they copyrighted or protected by some other means? Maybe we can help you if you can post some snippets of the XSL code that you think might relate to your specific problem.

Thanks,

Kurt

Author

Commented:
Messing with the XSL was the way to go.

Thanks!

Commented:
Cool. Is it working well?