Where does HTML 'id' attribute map to in the DOM?

The Application Programming Interface and the OASIS Open Document Format

Where does HTML 'id' attribute map to in the DOM?

Postby _savage » Fri Dec 07, 2018 11:51 pm

Suppose I have a simple HTML file like so:
Code: Select all   Expand viewCollapse view
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="../style/stylesheet.css" type="text/css" rel="stylesheet"/>
  </head>
  <body class="b">
    <p id="p-001" class="par">Content</p>
    <p class="par">Some bla</p>
    <!-- A reference to a paragraph in a neighboring file. -->
    <p id="id=p-003" class="par">…<a href="../text/page-2.html#p-021" class="link">Link</a>…</p>
    …
    <!-- An internal reference to a paragraph in this file. -->
    <p id="id=p-009" class="par">…<a href="#p-001" class="link">Top</a>…</p>
    …
  </body>
</html>

Notice how some paragraphs (and in HTML potentially many/most elements) have an “id” attribute here. The third paragraph then contains a link to a paragraph in a different file.

Loading this file into Office and browsing around its DOM, I am unable to find where the “id” attribute is stored for the paragraph. Not quite sure which interface or service would give me access to that value—if any. Some help would be good, short of digging into the source code for the HTML filter…
Mac 10.11 using LO 5.3.6.1, Gentoo Linux using LO 5.3.4.2 headless.
_savage
 
Posts: 164
Joined: Sun Apr 21, 2013 12:55 am

Re: Where does HTML 'id' attribute map to in the DOM?

Postby YODA » Sat Dec 08, 2018 2:47 pm

I personally would use a dedicated html editor like Blue Griffon available at http://bluegriffon.org/ instead.
Openoffice4.16 on windows 10 Libreoffice Version: 6.1.3.2 (x64)
YODA
 
Posts: 39
Joined: Fri Aug 10, 2018 4:06 am

Re: Where does HTML 'id' attribute map to in the DOM?

Postby RoryOF » Mon Dec 10, 2018 12:25 pm

In an administrative query the OP asked if "he could delete postings that were irrelevant to him".

I replied as follows
You may only delete your own postings, which we discourage, as it is antisocial and contrary to the spirit of the Forum.

If you feel a posting is irrelevant to you simply ignore it; in OO there are often many ways to achieve a given target - your "irelevancy" may be someone else's lifeline.


I agree with YODA that a dedicated HTML editor may be best; OO does not generate good HTML code.
Apache OpenOffice 4.1.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 28437
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Where does HTML 'id' attribute map to in the DOM?

Postby _savage » Mon Dec 10, 2018 2:22 pm

I wasn’t asking about producing HTML code, but about reading HTML code into Office. To answer the above question, it seems that HTML elements with an `id` attribute produce a bookmark in the DOM.
Mac 10.11 using LO 5.3.6.1, Gentoo Linux using LO 5.3.4.2 headless.
_savage
 
Posts: 164
Joined: Sun Apr 21, 2013 12:55 am

Re: Where does HTML 'id' attribute map to in the DOM?

Postby Villeroy » Mon Dec 10, 2018 9:41 pm

YOU are the developer of your program. Lookup the Open Document Format specification and the content.xml of an example document where you inserted a bookmark.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26417
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 0 guests