Solved

hoew to call an xml file into another xml file

Posted on 2000-03-05
21
389 Views
Last Modified: 2013-11-19
hi all
I have a template.xml file
I want to call another TRY.xml file into template.xml ..
Can anyone tell me how ??
Please help ASAP
regards
Nitin
0
Comment
Question by:khacharn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 7
  • 3
21 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2585652
Upping the points may draw more attention...

Why not use an html page or an HTA to merge the two? (IE5 client side or XSL server side)
Michel
0
 

Author Comment

by:khacharn
ID: 2586491
hi mplugian
Thanx for the advice but the problem is that i don't have more points..all are exhausted..I DO HAVE LOT OF EXPERTS POINTS..almost 1890..but of no use

Anyways
Can you show me how to call the xml file into an html file..
The ACTUAL problem is :-
i have companies.xml and i want to create a Virtual Document virtual.xml by calling companies.xml file into it..
Please HELP ASAP
I promise to transefer more points when i have some..
Regards
Nitin
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2586937
I was not fishing for more points (I got enough ;-)
I do not quite understand what you are trying to do, in what environment and I am not sure I can answer (or that one xml file can include another)


Michel
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 1

Expert Comment

by:dmaryakh
ID: 2588460
you can do that by using external entities.
In your DTD for the template.xml you have to add:
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY.xml">

or if it local then:

<!ENTITY try2 SYSTEM "TRY.xml">

once this done then your template.xml can contain the reference to that entity:

<P> .... </P>
&try1;
<P> .... </P>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2588986
Kewl...

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2588988
Kewl...

Michel
0
 

Author Comment

by:khacharn
ID: 2607340
Thanx for the answer dmaryakh
I have one more question to ask..
i am increasing the points for it to..
The question is that in the xml file which i am calling thru this code you gave me..
***************************************
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY.xml"> 

or if it local then:

<!ENTITY try2 SYSTEM "TRY.xml">

once this done then your template.xml can contain the reference to that entity:

<P> .... </P>
&try1;
<P> .... </P>


****************************************
I want to call a SPECIFIC PART of the XML file..
HOW DO I DO THAT..
this is s the file in which i want to see the stocks of the [arcgre]
----------------------------------------
<companies>
<company>
  <co_code type="20tcen">20tcen</co_code>
  <last_price>234</last_price>
  <volume>234534</volume>
  </company>
 <company>
  <co_code type="akhtex">akhtex</co_code>
  <last_price>234</last_price>
  <volume>234534</volume>
 </company>
 <company>
  <co_code type="arcgre">arcgre</co_code>
  <last_price>234</last_price>
  <volume>234534</volume>
 </company>
----------------------------------------

Please note that i want to call this file and in that i want to call onle argre stocks in another XML file..
Please reply ASAP
Regards
Nitin
0
 

Author Comment

by:khacharn
ID: 2607341
Adjusted points to 30
0
 

Author Comment

by:khacharn
ID: 2607342
Thanx for the answer dmaryakh
I have one more question to ask..
i am increasing the points for it to..
The question is that in the xml file which i am calling thru this code you gave me..
***************************************
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY.xml"> 

or if it local then:

<!ENTITY try2 SYSTEM "TRY.xml">

once this done then your template.xml can contain the reference to that entity:

<P> .... </P>
&try1;
<P> .... </P>


****************************************
I want to call a SPECIFIC PART of the XML file..
HOW DO I DO THAT..
this is s the file in which i want to see the stocks of the [arcgre]
----------------------------------------
<companies>
<company>
  <co_code type="20tcen">20tcen</co_code>
  <last_price>234</last_price>
  <volume>234534</volume>
  </company>
 <company>
  <co_code type="akhtex">akhtex</co_code>
  <last_price>234</last_price>
  <volume>234534</volume>
 </company>
 <company>
  <co_code type="arcgre">arcgre</co_code>
  <last_price>234</last_price>
  <volume>234534</volume>
 </company>
----------------------------------------

Please note that i want to call this file and in that i want to call onle argre stocks in another XML file..
Please reply ASAP
Regards
Nitin
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2608357
1. minimum points are considered 50
2. Are you sure you do not force xml to be a sort of database?

Michel
0
 

Author Comment

by:khacharn
ID: 2608876
I want to call a specific part of the XML file in another XML File ...
How DO I DO IT..?
as dmaryakh said ..i am now able to retrieve Full XML file and reference it..But i am interested only in a specific paragrapph of that file and not the full file..
dmaryakh can you help me out..ASAP
Regards
Nitin
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2610190
With XSL you could extract a part of the xml, but your WOULD have to load the complete ile to do it...

Michel
0
 
LVL 1

Expert Comment

by:dmaryakh
ID: 2612445
Do you control the original XML file? Ff you do you might consider making that paragraph (or all paragraphs) to be external entity and the just reference the one you want in your second template.
If you don't then it all depends on the task and tools that you use. As mplungjan said, you can use XSL to do the job. I prefere other (faster) ways to o task like that, by using specialized markup languages s.a. OmniMark (http://www.omnimark.com) which has the fastest parser from them all and 10 years of experience of dealing with SGML and later HTML/XML.
What are you trying to do and where? Is this template is being generated on the server or on the client or does it goes to databse alltogether. Give sm emore details.

David
0
 

Author Comment

by:khacharn
ID: 2612508
Adjusted points to 50
0
 

Author Comment

by:khacharn
ID: 2612509
hi dmaryakh
The template file is very simple..
It has references to other xml files..
now i think xsl will ther do the job...
i will try and tell you again..

One more question:
can i call an xml file into a html file..
if yes then how ?

I am increasing the points to 50  for this answers
Please ans ASAP
Regards
Nitin
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2612559
I do this in IE5:

<HTML>
<HEAD>
<SCRIPT>
function initPage() {
   if (isError(xmlID.parseError)) return;
   divID.outerHTML = xmlID.transformNode(xslID.documentElement);
}
// --></SCRIPT>
</head>
<BODY BGCOLOR="#FFFFCC" TEXT="#000000" onLoad="initPage()">
<DIV ID="divID"></DIV>
<XML SRC="xxxx.xml" ID="xmlID"></XML>
<XML SRC="yyyy.xsl" ID="xslID"></XML>
</body>
</html>

For other browsers you can transform on the server into html

Michel
0
 

Author Comment

by:khacharn
ID: 2617082
Adjusted points from 50 to 60
0
 

Author Comment

by:khacharn
ID: 2617083
hi..
i have one more Question..
the i think i will be thru with my problems..
Dmaryak..as you told..the foll code
---------------------------------------
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY.xml"> 

or if it local then:

<!ENTITY try2 SYSTEM "TRY.xml">

once this done then your template.xml can contain the reference to that entity:

<P> .... </P>
&try1;
<P> .... </P>
--------------------------------------
works fine..but what if i want to call two xml files in the root..xml file..
I tried something like this
**************************************
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY_1.xml"> 
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY_2.xml"> 
**************************************
But there is an error whic say..you can't dclare DOCTYPE more then once..
Plese help me
Nitin
I am increasing my points to 60
0
 

Author Comment

by:khacharn
ID: 2617084
hi..
i have one more Question..
the i think i will be thru with my problems..
Dmaryak..as you told..the foll code
---------------------------------------
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY.xml"> 

or if it local then:

<!ENTITY try2 SYSTEM "TRY.xml">

once this done then your template.xml can contain the reference to that entity:

<P> .... </P>
&try1;
<P> .... </P>
--------------------------------------
works fine..but what if i want to call two xml files in the root..xml file..
I tried something like this
**************************************
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY_1.xml"> 
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY_2.xml"> 
**************************************
But there is an error whic say..you can't dclare DOCTYPE more then once..
Plese help me
Nitin
I am increasing my points to 60
0
 
LVL 1

Accepted Solution

by:
dmaryakh earned 60 total points
ID: 2623879
Your entities should be a XML sniplets and not complete XML docs, so they should not have DOCTYPE declarations. In your code above you also try to declare the same entity twice. I thik something like this will work for you:


<?xml version="1.0"?>
<!DOCTYPE root
[
<!ELEMENT root(#PCDATA)>
<!ENTITY try1 SYSTEM "http://www.abc.xyz/TRY_1.xml"> 
<!ENTITY try2 SYSTEM "http://www.abc.xyz/TRY_2.xml"> 
]>
<root>
Trying to pull the first file &try1; - Done with the first file.
Trying to pull the second file &try2; - Done with the second file.
</root>
0
 

Author Comment

by:khacharn
ID: 2624847
Thanx You BOTH For answering my questions..
Regards
Nitin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XML SQL 8 30
Grunt script for Build Process 1 62
Access blocked to XML files other than sitemap.xml? 4 31
customizing windows 10 taskbar and startmenu 2 35
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to count occurrences of each item in an array.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question