|
-
Feb 27th, 2009, 02:10 PM
#1
Thread Starter
New Member
[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
-
Feb 27th, 2009, 03:35 PM
#2
Re: [2005] XML Template
Not sure what you want - are you looking into using XSLT that takes values and gives an output of XML?
-
Feb 28th, 2009, 01:39 AM
#3
Thread Starter
New Member
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
-
Mar 2nd, 2009, 02:31 AM
#4
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.
-
Mar 2nd, 2009, 07:19 AM
#5
Thread Starter
New Member
Re: [2005] XML Template
Solution 3 sounds like a good idea :P kidding
i'll research on solution 1.. hehe.. thanks a lot!
-
Mar 2nd, 2009, 01:24 PM
#6
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|