Results 1 to 6 of 6

Thread: [2005] XML Template

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Location
    Singapore
    Posts
    3

    [2005] XML Template

    Greetings,

    Anyone know how to do i create a XML template in my project so that i can add values into the elements of the XML template? FYI, the server end is validating with its schema.

    Thanks in advance

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] XML Template

    Not sure what you want - are you looking into using XSLT that takes values and gives an output of XML?

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Location
    Singapore
    Posts
    3

    Re: [2005] XML Template

    Example, whenever someone buy a book on my bookshop website, my bookshop engine will send a XML request to my main supplier with the book and customer info.

    XML sample,

    <tns:Request xsi:schemaLocation="...." xmlns:tns="...." messageType="REQUEST" messageId="12345">
    <tns:MsgHeader requestorId="69" isAsync="true" referenceId="" destinationId="SupplierGateway">
    <tns:Gateway gatewayName="SupplierGateway" gatewayType="HTTP"></tns:Gateway>
    </tns:MsgHeader>
    <tns:MsgBody>
    <tns:Operations execMode="PARALLEL">
    <tns:Operation execOrder="0" execType="ASYNC" action="new_order">
    <tns:ParameterList>
    <tns:ParameterDef parameterName="bookno" parameterType="String" parameterValue="9473204"/>
    <tns:ParameterDef parameterName="customername" parameterType="String" parameterValue="John"/>
    <tns:ParameterDef parameterName="customeraddress" parameterType="String" parameterValue="Queensland street 17 ..."/>
    </tns:ParameterList>
    </tns:Operation>
    </tns:Operations>
    </tns:MsgBody>
    </tns:Request>

    Everytime when there is a new order, the only changes in the XML are bookno, customername and customeraddress values. Am thinking is there a way to create the XML template so that the codings will looks better and easy to amend when there is a XML modification at supplier end

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] XML Template

    Yes, there are easier ways. I say ways because there are different ways to do this depending on how much time you have to do it...

    One way is to store the XML 'template' with {0} placeholders and then when it's time to send the XML over, use String.Format(), performing the right substitutions.

    Another way is to create an XSLT file that creates the XML and accepts XSL arguments. You then use your codebehind to pass the values into the XSLT which then creates the XML for you.

    Another way would be to run down to the bookshop everytime a the values come in and to run in through their door and yell out the XML.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Location
    Singapore
    Posts
    3

    Re: [2005] XML Template

    Solution 3 sounds like a good idea :P kidding

    i'll research on solution 1.. hehe.. thanks a lot!

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] XML Template

    Let us know if you get stuck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width