472,951 Members | 1,985 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,951 software developers and data experts.

Help for parsing Internal ENTITY & Co

Max
I am writing a XML parser in Javascript and i have difficulty to understand
the specifics of some "entities". I would want to understand the way in
which the non-validating XML Parsers manage entities (ENTITY) in XML
documents.
In practical i don't understand if XML Parsers manage the values of Internal
Entities (<!ENTITY entityname "replacement text">), if they manage the
Parametric Entities and if the Entity Reference is only a Node or it is
linked to other Entities (Internal Entities).
I have given a look to many parser, written in many languages, but they make
more non-standard operations on the Internal Entity :-/
Can anyone help me?

Max
May 14 '06 #1
4 1298
The answer is "It depends".

Parsed entities may simply be expanded during parsing, in which case you
see only their replacement value as if that had been typed directly into
the file.

Or they may be separated out -- in the DOM, that's done by enclosing the
replacement value in an EntityReference node; SAX surrounds the
replacement value with calls to the LexicalHandler methods startEntity
and endEntity.

Which happens depends on which parser you're using, how you've
configured it, and what DOM implementation or SAX listeners these are
feeding.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
May 14 '06 #2
Max
> The answer is "It depends".

Parsed entities may simply be expanded during parsing, in which case you
see only their replacement value as if that had been typed directly into
the file.
Thanks for the response, Joe.

In practical, you think that the XML Parsers expands the entity references
while traversing the tree:

ex. in the internal DTD:
<!ENTITY name "Jerry">

XML file:

<hello>
<Cherries>&name;</Cherries>
</hello> Results:
<hello>
<Cherries>Jerry</Cherries>
</hello>
Or they may be separated out -- in the DOM, that's done by enclosing the
replacement value in an EntityReference node; SAX surrounds the
replacement value with calls to the LexicalHandler methods startEntity
and endEntity.
In this case, is the replacement value enclosed in the nodeValue of
EntityReference Node (inherited by superclass Node) or in the nodeValue of
Entity Node or other?
Which happens depends on which parser you're using, how you've
configured it, and what DOM implementation or SAX listeners these are
feeding.


I'm writing a personal XML Parser.

All the best,

Max
May 15 '06 #3
>>Or they may be separated out -- in the DOM, that's done by enclosing the
replacement value in an EntityReference node
In this case, is the replacement value enclosed in the nodeValue of
EntityReference Node (inherited by superclass Node) or in the nodeValue of
Entity Node or other?


Children of the EntityReference node. See the DOM spec for details.
I'm writing a personal XML Parser.


If you really insist on doing this, I recommend you start by reading the
Annotated XML Specification website with extreme attention to every word
of the spec and of Tim Bray's commentary upon it. That'll save you from
having to repeat some of the mistakes everyone else has already made and
corrected.

Have fun.
May 15 '06 #4
Max
> > In this case, is the replacement value enclosed in the nodeValue of
EntityReference Node (inherited by superclass Node) or in the nodeValue of Entity Node or other?
Children of the EntityReference node. See the DOM spec for details.


During the parsing, i have to "map" the internal Entities and to add a
children node of matched type of internal value to EntityReference. If the
internal value is a element or another EntityReference, i have to re-parse
or re-expand it.
Is it correct?
If you really insist on doing this, I recommend you start by reading the
Annotated XML Specification website with extreme attention to every word
of the spec and of Tim Bray's commentary upon it. That'll save you from
having to repeat some of the mistakes everyone else has already made and
corrected.


Thanks for the suggests!

Max
May 16 '06 #5

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

Similar topics

3
by: wenke | last post by:
Hi, I am using the following code (see below) from php.net (http://www.php.net/manual/en/ref.xml.php, example 1) to parse an XML file (encoded in UTF-8). I changed the code slightly so that the...
9
by: qazmlp | last post by:
const has internal linkage in C++, but external linkage in C. Am I right ? But, linker reports multiply-defined error if the following header is included in multiple .cpp files. //...
2
by: Christoph Niemann | last post by:
Hello, I want to output an element with an attribute. The attribute's value shall contain a entity reference. Is that possible at all? I use this source-XML and xsl-stylesheet: <?xml...
1
by: Razvan | last post by:
Hi What is the difference between an internal and an external entity ? The first one is defined in the internal subset (not in a separate DTD file, but in the XML file itself - in...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
6
by: Tuomas Rannikko | last post by:
Hello, I'm currently writing a XML processor for the fun of it. There is something I don't understand in the spec though. I'm obviously missing something important. The spec states that both...
3
by: Moqtar | last post by:
I am using python to walk a directory and write the filename in an xml document of type <?xml version="1.0" encoding="ISO-8859-1"?> <job> <jobname>Test</jobname>...
0
by: bruce | last post by:
Hi Fredrick Thanks for the reply. But since I don't have control of the initial text, is there something with python that will strip/replace this... or are you saying I should do a...
2
by: embz | last post by:
this post concerns three pages. 1. this page: http://www.katherine-designs.com/sendemail.php i get the following errors: a lot of it seems to deal with the PHP code i inserted to the page....
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=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
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...
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...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
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...

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.