Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reusing an xml structure with different attributes

Status
Not open for further replies.

foxuk

Technical User
Aug 30, 2002
2
0
0
GB
Hi,
I have a problem with large repeating xml structures.
Here's a fragment of xml:

<TestAction>
<ActionTimeOut>10000</ActionTimeOut>
<ActionType>
<CallAPI>
<APICall ReuseOutput="False" OutputReference="" OnErrorAbort="True">Bind
<APIParameter PreLoad="False">
<APIParameterName>pmdsa
<UseName>mdsa</UseName>
<APIParameterType>In/Out</APIParameterType>
<APIParameterInputValue ReturnInto="True" PreLoad="False">mdsa</APIParameterInputValue>
<APIParameterOutputValue Validate="True" Reuse="False" ReuseReference="">!NULL</APIParameterOutputValue>
</APIParameterName>
<APIParameterName>requestedDirectories
<UseName>pz_directories1</UseName>
<APIParameterType>In</APIParameterType>
<APIParameterInputValue ReturnInto="False" PreLoad="True">{"$LocalDir$", NULL}</APIParameterInputValue>
<APIParameterOutputValue Validate="False" Reuse="False" ReuseReference=""></APIParameterOutputValue>
</APIParameterName>
<APIParameterName>Id
<UseName></UseName>
<APIParameterType>In</APIParameterType>
<APIParameterInputValue ReturnInto="False" PreLoad="False">NULL</APIParameterInputValue>
<APIParameterOutputValue Validate="False" Reuse="False" ReuseReference=""></APIParameterOutputValue>
</APIParameterName>
<APIParameterName>passWord
<UseName></UseName>
<APIParameterType>In</APIParameterType>
<APIParameterInputValue ReturnInto="False" PreLoad="False">NULL</APIParameterInputValue>
<APIParameterOutputValue Validate="False" Reuse="False" ReuseReference=""></APIParameterOutputValue>
</APIParameterName>
<APIParameterName>actualDirectory
<UseName>actualDirectory1</UseName>
<APIParameterType>In/Out</APIParameterType>
<APIParameterInputValue ReturnInto="False" PreLoad="True">"None!"</APIParameterInputValue>
<APIParameterOutputValue Validate="True" Reuse="False" ReuseReference="">$compstr1$(actualDirectory1, strcat(strcpy(tempCmp, pz_head), pz_directories1[0])) == 0</APIParameterOutputValue>
</APIParameterName>
<APIParameterName>actual_max_len
<UseName></UseName>
<APIParameterType>In/Out</APIParameterType>
<APIParameterInputValue ReturnInto="False" PreLoad="False">sizeof(actualDirectory1)</APIParameterInputValue>
<APIParameterOutputValue Validate="False" Reuse="False" ReuseReference=""></APIParameterOutputValue>
</APIParameterName>
</APIParameter>
<APICallReturnCode Validate="True">0</APICallReturnCode>
</APICall>
<Thread>All</Thread>
<WaitTime>0</WaitTime>
<Repeat>1</Repeat>
<ExpectedResult CompareFile="" ExpectedFile="" MaxResponseTime="" OnResultErrorAbort="True" STDERR="" STDOUT="" FullOutput="False">0</ExpectedResult>
</CallAPI>
</ActionType>
<ActionComment></ActionComment>
</TestAction>

It's pretty big and bulky. This structure (and many others) could be declared many times within one file but with different attribute values. The problem with this, then is that the file becomes pretty large while at the same time containing repeated code (with a few differing attributes in each one).

Does anyone know of a way that I could declare this piece of xml once and then some how "call" it while filling it with different attribute values each time?

The xml code above is defined in a dtd.

I did think about placing the code in an xml sub-document and then use an !ENTITY statement to "call" it at various points through the main xml document, but the problem there is that it is only a static copy, and not one that contains a few differing attribute values.

Thanks for any suggestions you might have.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top