473,394 Members | 1,154 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.

Reading Comment Lines(<!-- 2007 -->) from XML File using PHP

Hi,

I want to know, How we will read the XML File Comments using PHP Code.
Thaks in advance.
Mar 13 '07 #1
4 2100
ronverdonk
4,258 Expert 4TB
Hi,

I want to know, How we will read the XML File Comments using PHP Code.
Thaks in advance.
Your problem is not clear to me. Are you actually reading the xml file and want to skip the comment lines? What is the process you are following to read this file?

Ronald :cool:
Mar 13 '07 #2
Thanks for your reply. I was reading all other tag data's from XML file, but i can't read the comment line data's. I want to read comment line data's also and diaplay in browser using php code.
Mar 13 '07 #3
ronverdonk
4,258 Expert 4TB
Show the code you are using to read the xml data.

And display it within php or code tags!!

Ronald :cool:
Mar 13 '07 #4
XML File:
[XML]
File Name: 'hbwas51_proc_54.xml'

<database>
<!-- 2006-12-27 15:45:00 IST / 1167214500 --> <row><v> 3.4102666667e+02 </v></row>
<!-- 2006-12-27 15:50:00 IST / 1167214800 --> <row><v> 3.4100000000e+02 </v></row>
<!-- 2006-12-27 15:55:00 IST / 1167215100 --> <row><v> 3.4100000000e+02 </v></row>
<!-- 2006-12-27 16:00:00 IST / 1167215400 --> <row><v> 3.4178333333e+02 </v></row>
<!-- 2006-12-27 16:05:00 IST / 1167215700 --> <row><v> 3.4101333333e+02 </v></row>
<!-- 2006-12-27 16:10:00 IST / 1167216000 --> <row><v> 3.5140000000e+02 </v></row>
<!-- 2006-12-27 16:15:00 IST / 1167216300 --> <row><v> 3.5140000000e+02 </v></row>
<!-- 2006-12-27 16:20:00 IST / 1167216600 --> <row><v> 3.5678666667e+02 </v></row>
<!-- 2006-12-27 16:25:00 IST / 1167216900 --> <row><v> 3.5581333333e+02 </v></row>
<!-- 2006-12-27 16:30:00 IST / 1167217200 --> <row><v> 3.5581333333e+02 </v></row>
<!-- 2006-12-27 16:35:00 IST / 1167217500 --> <row><v> 3.6214000000e+02 </v></row>
<!-- 2006-12-27 16:40:00 IST / 1167217800 --> <row><v> 3.6214000000e+02 </v></row>
<!-- 2006-12-27 16:45:00 IST / 1167218100 --> <row><v> 3.5512000000e+02 </v></row>
<!-- 2006-12-27 16:50:00 IST / 1167218400 --> <row><v> 3.5500000000e+02 </v></row>.
</database>

[/XML]


The below code read the row tag values from the above xml file:

[php]
<?php

$doc = new DOMDocument();

$doc->load( 'hbwas51_proc_54.xml' );

$rows = $doc->getElementsByTagName("row");
foreach($rows as $node) {
print $node->textContent . " ";
}
[/php]

Now i want to read the comment lines from the above XML file
example comment lines:
<!-- 2006-12-27 15:45:00 IST / 1167214500 -->
Mar 14 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Venkat | last post by:
Greetings to All, I have the following file and i need to modify it with the contents of an array File1.txt Name Location Points Grade Venkat,Newyork,100,A Jack,LA,12,C
3
by: syntax | last post by:
hi, i want to read a file using fread() in equal chunks through a for loop so that at the last call i dont get error..which way, i should read it? let me give an example, suppose i have 100...
7
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should...
0
by: jimmyfishbean | last post by:
Hi, Please could comeone tell me how to programatically read the input message parts for a web service operation. I have a web service that has many operations. One of these operations (say...
20
by: plmanikandan | last post by:
Hi, I need to read a file line by line.each line contains different number of characters.I opened file using fopen function.is there any function to read the file line by line Regards, Mani
3
by: RJN | last post by:
Hi I've a template excel file which has all the calculations defined. There are certain input values to be entered which gives a lot of output to the user. I don't want to expose the excel sheet...
4
by: Bill Nguyen | last post by:
I wonder if I can write to an XML file using column structure (and column names) of an SQLserver table. for example: Table A: column1 int column2 char(30) column3 date XML output:
1
by: kushaljn | last post by:
Hi All, Not sure if some one has already addressed this Question before. I am writing a header of a CSV file using the following code. if (fileExists == false) { // Write the header...
1
by: fiftyone | last post by:
I have problems figure out how to delete a comment from a .xml file. I want to make code in c# that searchs through a folder and its subfolders and delete the first comment and comments matching a...
1
by: sachinkale123 | last post by:
Hi, I am reading excel file and reading values from that I am using provider As : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + Filename + ";Extended Properties=\"Excel 8.0;Hdr=No;IMEX=1\"";...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.