Ask Your Question

Basic macro for xml export with attributes [closed]

asked 2018-01-30 22:38:56 +0200

daniel1 gravatar image

updated 2020-07-20 23:29:25 +0200

Alex Kemp gravatar image


to export pages of a writer document into an xml document i use the code in this answer.

Now i want the page number as an attribute, like this:

 <page number=1>
 Text of page 1
 <page number=2>
 Text of page 2

How do I do this?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-07-20 23:29:38.546504

1 Answer

Sort by » oldest newest most voted

answered 2018-01-31 07:13:01 +0200

librebel gravatar image

Hello again @daniel1,

This can be done by adding just 1 line of code inside the method Writer_Export_Pages_To_XML().

The line to add is: oPage.setAttribute( "number", i)

This line should be inserted directly after the line: oPage = oXML.createElement( "page" )

HTH, lib

edit flag offensive delete link more


Thank you, that works!

daniel1 gravatar imagedaniel1 ( 2018-01-31 10:18:05 +0200 )edit

Question Tools

1 follower


Asked: 2018-01-30 22:38:56 +0200

Seen: 82 times

Last updated: Jan 31 '18