473,804 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need Parser that can read attributes of XML document...

Hello guys,
I am looking for a parser in PHP that can return all the
attributes of XML entities. I know how to read the XML Entities, but I
have got a problem with reading attributes. So I will appreciate if you
could give a parser that can return all the Entities and Attributes of
respective entities as an array.

For e.g.:

<?xml version="1.0" ?>
<Controller>
<NumberOfBoards >5</NumberOfBoards>
<NumberOfKeypad s>1</NumberOfKeypads >
<QueueMode>N</QueueMode>
<EntranceDela y on="5" off="5" />
<Limits minLength="36" maxLength="800" />
<Conveyor perSecond="6.3" perPulse="8.0" />
<Roller relay="1" needsOrder="1">
<RollerUp1>84 </RollerUp1>
<RollerDown>8 4</RollerDown>
<RollerUp2>84 </RollerUp2>
</Roller>
</Controller>

This is a part of my XML document. I want to return all the Entites
with their attributes as an array.

Thanks in advance.

Nov 30 '06 #1
4 3221
Ch********@gmai l.com wrote:
I am looking for a parser in PHP that can return all the
attributes of XML entities
I think you mean "attributes ", not "entities". ..?

I haven't used PHP, but any XML parser should deliver all the
information available in the document; otherwise, it isn't an XML parser.

A websearch on "php xml" finds lots of indication that folks are doing
this and some code examples which are retrieving attributes. "If it
happens, it must be possible."
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Nov 30 '06 #2

Joe Kesselman wrote:
Ch********@gmai l.com wrote:
I am looking for a parser in PHP that can return all the
attributes of XML entities

I think you mean "attributes ", not "entities". ..?

I haven't used PHP, but any XML parser should deliver all the
information available in the document; otherwise, it isn't an XML parser.

A websearch on "php xml" finds lots of indication that folks are doing
this and some code examples which are retrieving attributes. "If it
happens, it must be possible."
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry

Hi Joe,

First of all, thanks for your immediate reply.

By Attributes and Entities I mean to say, relating to my XML
doc, <Controller>, <NumberOfBoards >, <NumberOfKeypad s>, <QueueMode>,
<EntranceDela y, <Limits, <Conveyor, <Roller , <RollerUp1>,
<RollerDown>, <RollerUp2are all ENTITIES and in these the ATTRIBUTES
OF <EntranceDela y entity are ==>
on="5" and off="5"

Similarly there are some other entities that have attributes.

What I am saying is that, I have searched a net a lot for a parser that
can return all ENTITIES and ATTRIBUTES as an array, but I didn't get
any. I have a parser that gives me only ENTITIES and not attributes.

So can you help me solve this query?

Thanks again.

Nov 30 '06 #3

Ch********@gmai l.com wrote:
Joe Kesselman wrote:
Ch********@gmai l.com wrote:
I am looking for a parser in PHP that can return all the
attributes of XML entities
I think you mean "attributes ", not "entities". ..?

I haven't used PHP, but any XML parser should deliver all the
information available in the document; otherwise, it isn't an XML parser.

A websearch on "php xml" finds lots of indication that folks are doing
this and some code examples which are retrieving attributes. "If it
happens, it must be possible."
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry


Hi Joe,

First of all, thanks for your immediate reply.

By Attributes and Entities I mean to say, relating to my XML
doc, <Controller>, <NumberOfBoards >, <NumberOfKeypad s>, <QueueMode>,
<EntranceDela y, <Limits, <Conveyor, <Roller , <RollerUp1>,
<RollerDown>, <RollerUp2are all ENTITIES and in these the ATTRIBUTES
OF <EntranceDela y entity are ==>
on="5" and off="5"

Similarly there are some other entities that have attributes.

What I am saying is that, I have searched a net a lot for a parser that
can return all ENTITIES and ATTRIBUTES as an array, but I didn't get
any. I have a parser that gives me only ENTITIES and not attributes.

So can you help me solve this query?

Thanks again.
Strange, the xml2Array class over at http://uk2.php.net/xml_parse
seems to do exactly what you want...

Array ( [0] =>
Array ( [name] =CONTROLLER
[attrs] =Array ( )
[children] =>
Array ( [0] =>
Array ( [name] =NUMBEROFBOARDS
[attrs] =Array ( )
[tagData] =5 )
[1] =>
Array ( [name] =NUMBEROFKEYPAD S
[attrs] =Array ( )
[tagData] =1 )
[2] =>
Array ( [name] =QUEUEMODE
[attrs] =Array ( )
[tagData] =N )
[3] =>
Array ( [name] =ENTRANCEDELAY
[attrs] =>
Array ( [ON] =5 [OFF] =5 ) )
[4] =>
Array ( [name] =LIMITS
[attrs] =>
Array ( [MINLENGTH] =36
[MAXLENGTH] =800 ) )
[5] =>
Array ( [name] =CONVEYOR
[attrs] =>
Array ( [PERSECOND] =6.3
[PERPULSE] =8.0 ) )
[6] =>
Array ( [name] =ROLLER
[attrs] =>
Array ( [RELAY] =1
[NEEDSORDER] =1 )
[children] =>
Array ( [0] =>
Array ( [name] =ROLLERUP1
[attrs] =Array ( )
[tagData] =84 )
[1] =>
Array ( [name] =ROLLERDOWN
[attrs] =Array ( )
[tagData] =84 )
[2] =>
Array ( [name] =ROLLERUP2
[attrs] =Array ( )
[tagData] =84 ) ) ) ) ) )

Nov 30 '06 #4
By Attributes and Entities I mean to say, relating to my XML
doc, <Controller>, <NumberOfBoards >, <NumberOfKeypad s>, <QueueMode>,
<EntranceDela y, <Limits, <Conveyor, <Roller, <RollerUp1>,
<RollerDown>, <RollerUp2are all ENTITIES
"Entity" has a specific meaning in the XML world, and this isn't it.
These are Elements. If you want useful answers, it really is helpful to
use standard terminology when posing the question.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Nov 30 '06 #5

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

Similar topics

0
1586
by: marktm | last post by:
Hi- I am using the following code and want to retrieve an attributes value. I want to loop through the xml file and add the attribute values to an array. The line in question is marked with "<---??????" below. I have included both the PHP and XML. Your help will be much appreciated.
2
2603
by: marktm | last post by:
Hi- I am using the following code and want to retrieve an attributes value. I want to loop through the xml file and add the attribute values to an array. The line in question is marked with "<---??????" below. I have included both the PHP and XML. Your help will be much appreciated.
4
3091
by: billcoumbe | last post by:
any recommendations? I'm looking for something that will just run from the unix command line to validate large (20-50Mb) XML files against an XML DTD. Ideally something that is actively supported and has good documentation! If there's nothing suitable for Solaris a command line program for Windows might do - currently using XMetaL/XMLSpy parsers which aren't really suited to large files.
3
1452
by: Art | last post by:
What's the most efficient way to replace characters in an XML document before it is loaded into a parser? Chars I'd want to replace are in attributes and there can be N attributes, also let's assume that I'm not familiar w/ the structure of the XML so that I'll have to read/replace/load via stream. Is this possible OpenStream->Replace char(s)->To XML parser ? If so then how? Art
3
2226
by: Harry | last post by:
Hello, I want to know if I can modify a xml-file with a xml-parser or can I only read the information out of it. If it is possible, I searching for xml-Parser for c++ (win32). I tried with xerxes. But I didn't find how to access to existing "const" Methods. I also don't know if I can modify? Thanks very much!
8
2278
by: SL | last post by:
I try to validate against a schema a document stored in several files thanks to external entities. The parseur add a 'xml:base="url"' attribute on the root element of this sub-trees during parsing, so the validation of the document fails. Is there a recommanded solution to this situation ? I have no idea how to handle the problem: I don't want to take into account at the vocabulary level a question of syntax (the external entities) by...
6
5297
by: jmike | last post by:
Hi everyone, I am a total newbie to XML parsing. I've written a couple of toy examples under the instruction of tutorials available on the web. The problem I want to solve is this. I have an XML snippet (in a string) that looks like this: <booga foo="1" bar="2"> <well>hello</well>
0
661
by: ChillyRoll | last post by:
Hello guys, I am looking for a parser in PHP that can return all the attributes of XML entities. I know how to read the XML Entities, but I have got a problem with reading attributes. So I will appreciate if you could give a parser that can return all the Entities and Attributes of respective entities as an array. For e.g.: <?xml version="1.0" ?>
3
3674
by: Water Cooler v2 | last post by:
Sorry for asking this beginner question. I've written DTDs so far and read about XML Schemas. I understand that they are a replacement of the DTD fundamentally, and therefore allow for the validation of an XML document. My question really is: Why do we need XML Schemas other than for validation of an XML document? I am more interested in knowing if already available
0
9705
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10311
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.