Discussion:
embedding hyperlink tag in xml tags
(too old to reply)
Mark B.
2005-04-03 05:55:02 UTC
Permalink
I'm still new to xml and learning it. From what I understand and experience,
xml won't parse certain characters. so they have to be "escaped". Now what
I'm trying to do is I want convert a portion of the string within a node into
a hyperlink. But XML produces an error if I don't HTML-encode the <, >, &
characters although otherwise it will just parse it as plain string. Is there
a way to force it to parse as a hyperlink tag, or is there a certain
concept/technique in XML in order to make this possible? Thanks in advance.
Martin Honnen
2005-04-03 13:15:59 UTC
Permalink
Post by Mark B.
I'm still new to xml and learning it. From what I understand and experience,
xml won't parse certain characters. so they have to be "escaped".
Of course an XML parser parses < or &, only they have special meanings,
the < opens a tag, the & starts an entity or character reference. If you
don't want that special meaning but want to insert a plain < or & then
you need to escape them e.g. &lt; respectively &amp;.
Post by Mark B.
Now what
I'm trying to do is I want convert a portion of the string within a node into
a hyperlink. But XML produces an error if I don't HTML-encode the <, >, &
characters although otherwise it will just parse it as plain string. Is there
a way to force it to parse as a hyperlink tag, or is there a certain
concept/technique in XML in order to make this possible?
If you use a certain XML application like XHTML then you can write an
XHTML hyperlink
<a xmlns="http://www.w3.org/1999/xhtml"
href="http://example.com/dir/subdir/whatever.html">
link text
</a>
Other XML applications (like SVG for example) have their own element for
hyperlinks or make use of XLink, see
<http://www.w3.org/XML/Linking>

So XML in general as far as the XML specification goes doesn't know
links but several XML applications have a concept of links and a browser
supporting XHTML or mixed namespace documents with XHTML elements for
instance will recogize an XHTML link in such a document.
--
Martin Honnen
http://JavaScript.FAQTs.com/
Loading...