472,969 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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>
<NumberOfKeypads>1</NumberOfKeypads>
<QueueMode>N</QueueMode>
<EntranceDelay 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>84</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 3155
Ch********@gmail.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********@gmail.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>, <NumberOfKeypads>, <QueueMode>,
<EntranceDelay, <Limits, <Conveyor, <Roller , <RollerUp1>,
<RollerDown>, <RollerUp2are all ENTITIES and in these the ATTRIBUTES
OF <EntranceDelay 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********@gmail.com wrote:
Joe Kesselman wrote:
Ch********@gmail.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>, <NumberOfKeypads>, <QueueMode>,
<EntranceDelay, <Limits, <Conveyor, <Roller , <RollerUp1>,
<RollerDown>, <RollerUp2are all ENTITIES and in these the ATTRIBUTES
OF <EntranceDelay 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] =NUMBEROFKEYPADS
[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>, <NumberOfKeypads>, <QueueMode>,
<EntranceDelay, <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
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...
2
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...
4
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...
3
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...
3
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...
8
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,...
6
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...
0
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...
3
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.