473,394 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to reference to a part of the XML doc?

Hi,

I have this structure:

<a>
<repeated_part>
<just_the_same_thing_and_more/>
</repeated_part>
</a>
<b>
<repeated_part>
<just_the_same_thing_and_more/>
</repeated_part>
</b>

Is it possible to refactor this at text doc level to something like this:

<repeated_part>
<just_the_same_thing_and_more/>
</repeated_part>
<a>
<reference to the repeated_part>
</a>
<b>
<reference to the repeated_part>
</b>

Pls note: I want parse this DOC and work with the DOM.
After parsing and using the DOM the tree should be very similar to the first
case:
The node <A> should have a child node <repeated part>

Is there any standard XML solution?

thx for answers

Jul 20 '05 #1
2 1353
In article <c4**********@namru.matavnet.hu>,
panzy <pa******@hotmail.com> wrote:

% I have this structure:
%
% <a>
% <repeated_part>
% <just_the_same_thing_and_more/>
% </repeated_part>
% </a>
% <b>
% <repeated_part>
% <just_the_same_thing_and_more/>
% </repeated_part>
% </b>
%
% Is it possible to refactor this at text doc level to something like this:
%
% <repeated_part>
% <just_the_same_thing_and_more/>
% </repeated_part>
% <a>
% <reference to the repeated_part>
% </a>
% <b>
% <reference to the repeated_part>
% </b>

Note that neither of these is well-formed. Anyway, doing it like this will
result in a different DOM tree. You can put the repeated part in an entity
definition, though, something like:

<!DOCTYPE missing-outer-element [
<!ENTITY repeated_part '<just_the_same_thing_and_more/>'>
]>

<missing-outer-element>
<a>
&repeated_part;
</a>
<b>
&repeated_part;
</b>
</missing-outer-element>

This will result in identical DOM trees provided you make the spacing
consistent.
--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #2
Hi Patrick,

Thx for your fast answer.

I'd like to use elements, attributes as the repeated part. With other words
my repeated part is a chunk of XML text.
Can I do this with Entities what you recommend?

I'd like to avoid DTD. I use an external xsd schema. Is any other way to
complete my task?

thx for answers
..
"Patrick TJ McPhee" <pt**@interlog.com> wrote in message
news:c4**********@news.eusc.inter.net...
In article <c4**********@namru.matavnet.hu>,
panzy <pa******@hotmail.com> wrote:

% I have this structure:
%
% <a>
% <repeated_part>
% <just_the_same_thing_and_more/>
% </repeated_part>
% </a>
% <b>
% <repeated_part>
% <just_the_same_thing_and_more/>
% </repeated_part>
% </b>
%
% Is it possible to refactor this at text doc level to something like this: %
% <repeated_part>
% <just_the_same_thing_and_more/>
% </repeated_part>
% <a>
% <reference to the repeated_part>
% </a>
% <b>
% <reference to the repeated_part>
% </b>

Note that neither of these is well-formed. Anyway, doing it like this will
result in a different DOM tree. You can put the repeated part in an entity
definition, though, something like:

<!DOCTYPE missing-outer-element [
<!ENTITY repeated_part '<just_the_same_thing_and_more/>'>
]>

<missing-outer-element>
<a>
&repeated_part;
</a>
<b>
&repeated_part;
</b>
</missing-outer-element>

This will result in identical DOM trees provided you make the spacing
consistent.
--

Patrick TJ McPhee
East York Canada
pt**@interlog.com

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Amr Mostafa | last post by:
Hello :) I'm trying to write a script that deals with a web service. I'm using NuSoap class. my question is : Can I pass some variables By Reference to the web service and get the result back...
110
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
3
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page...
6
by: seeIT | last post by:
In a client application a simple webservice (add/multiply) was added to solution panel but proxy methods do not appear. WSDL description in solution panel follows: <?xml version="1.0"...
0
by: Richard Gregory | last post by:
Hi, I have the wsdl below, for an Axis web service, and when I select Add Web Refernce in Visual Studio the proxy is missing a class representing the returnedElementsType (see reference.cs below...
51
by: Kuku | last post by:
What is the difference between a reference and a pointer?
8
by: junw2000 | last post by:
Hi, My textbook says that: "Once defined, a reference cannot be reassigned because it is an alias to its target. What happens when you try to reassign a reference turns out to be the assignment...
27
by: David W | last post by:
I'm almost tearing my hair out. A colleague claimed that a null reference can exist, like this: void f( int& p ) { printf( "%d\n", p ); } int main (int argc, char *argv) {
1
by: Mike H | last post by:
I can't seem to figure out the right thing to search on, so I thought I'd just provide an example and see if someone can point me to some tips. What I have is an Automation Server that has a...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.