• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

To replace repetitive xml fragments

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Problem desc :

<root>

<a>TextA</a>
<b>TextB</b>
<c>CommonText</c>

</root>

The above is the sample xml fragment.In this file..the tag <a> and <b> are optional and the tag <c> appears always..one solution is to use entities,but i cannot use DTD to validate becoz new tags can also be added and new tags added are runtime.

Is there a solution for this scenario ?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I couldn't see the part of the post that describes the problem. You displayed an XML fragment and made several other statements, but you didn't say what was wrong with that fragment. Or what your problem with it was.
 
Deepti Premkumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

The problem is that,some set of tags are optional and added at runtime..these set of tags are repetitive, is there a way to import or include the contents of that repetitive tags into another xml file and call/invoke it in the main file ???

1 solution : Use entities. But we don't want to use entities becoz we don't have a DTD, and the xml file is built runtime..

Is there any other possible way ???

Thanks,
Deepti
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Deepti Premkumar:
The problem is that,some set of tags are optional and added at runtime..these set of tags are repetitive,

The one you posted wasn't repetitive, so I don't understand what it means when you say that.

1 solution : Use entities. But we don't want to use entities becoz we don't have a DTD, and the xml file is built runtime.

You're asking what you can change so that you get a solution to your problem. The fact that you don't have a DTD is something that you could change. In other words, you could make a DTD.

Is there any other possible way?

There's XInclude, which might be a solution for your problem.
 
Deepti Premkumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks a lot, and works fine.

Deepti
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic