View Issue Details

IDProjectCategoryView StatusLast Update
0004024mantisbtfeaturepublic2017-04-01 00:13
ReporterLuebbeAssigned Todregad 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionno change required 
PlatformFirefox / XPOSSuse LinuxOS VersionApache 2
Product Version0.19.0a1 
Target VersionFixed in Version 
Summary0004024: Add XML Export to print_bug_page.php
Description

Hi Folks,

included is a patch against Mantis 0.18.2 that adds xml export capability to mantis.
Add the following line to print_bug_page.php:

array( 'print_all_bug_page_word', 'html', 'target="_blank"', 'ieicon.gif', 'Word View' ),
array( 'print_all_bug_page_xml', 'xml', 'target="_blank"', 'xmlicon.gif', 'XML View' ));

Steps To Reproduce

I had to include the source below, because I couldn't upload the file

Additional Information

<?php

Mantis - a php based bugtracking system

# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id$
# --------------------------------------------------------

# XML export page
# The bugs displayed in print_all_bug_page.php are saved in a .xml file
# The IE icon allows to see or directly print the same result

require_once( 'core.php' );

$t_core_path = config_get( 'core_path' );

require_once( $t_core_path.'current_user_api.php' );
require_once( $t_core_path.'bug_api.php' );
require_once( $t_core_path.'custom_field_api.php' );
require_once( $t_core_path.'string_api.php' );
require_once( $t_core_path.'date_api.php' );

auth_ensure_user_authenticated();

function insert_dom_node($doc, $parent, $name, $value) {
    $child = $doc->create_element($name);
    $child = $parent->append_child($child);

    $value = mb_convert_encoding($value,'UTF-8','ISO-8859-1');
    $value = $doc->create_text_node($value);
    $value = $child->append_child($value);

    return $child;
}

$f_type_page    = gpc_get_string( 'type_page', 'xml' );
$f_search   = gpc_get_string( 'search', false ); # @@@ need a better default
$f_offset   = gpc_get_int( 'offset', 0 );
$f_export   = gpc_get_string( 'export' );
$f_show_flag    = gpc_get_bool( 'show_flag' );
$t_project_id   = helper_get_current_project( );

# word or html export
if ( $f_type_page != 'html' ) {
    $t_export_title = $g_page_title."_xml";
    $t_export_title = ereg_replace( '[\/:*?"<>|]', '', $t_export_title );
    header( 'Content-Type: text/xml' );

header( 'Content-Disposition: attachment; filename="' . $t_export_title . '.xml"' );

}

$t_cookie_value = gpc_get_cookie( config_get( 'view_all_cookie' ), '' );

# check to see if the cookie does not exist
if ( is_blank( $t_cookie_value ) ) {
    print_header_redirect( 'view_all_set.php?type=0&print=1' );
}

# check to see if new cookie is needed
$t_setting_arr          = explode( '#', $t_cookie_value );
if ( $t_setting_arr[0] != $g_cookie_version ) {
    print_header_redirect( 'view_all_set.php?type=0&print=1' );
}

# This is where we used to do the entire actual filter ourselves
$t_page_number = gpc_get_int( 'page_number', 1 );
$t_per_page = null;
$t_bug_count = null;
$t_page_count = null;

$result = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count );
$row_count = sizeof( $result );

$f_bug_arr = explode_enum_string( $f_export );

# $t_bug_arr_sort contains 1 if the field as been selected, 0 if not
for( $i=0; $i < $row_count; $i++ ) {
    if ( isset( $f_bug_arr[$i] ) ) {
        $index = $f_bug_arr[$i];
        $t_bug_arr_sort[$index]=1;
    }
}

###### XML Export starts here
// create a new XML document
$doc = domxml_new_doc('1.0');

// create root node
$root = $doc->create_element('root');
$root = $doc->append_child($root);

for( $j=0; $j < $row_count; $j++ ) {
if ( isset( $t_bug_arr_sort[$j] ) || ( $f_show_flag==0 )) {

    # prefix bug data with v_
    extract( $result[$j], EXTR_PREFIX_ALL, 'v' );

    $t_last_updated = date( $g_short_date_format, $v_last_updated );

    # grab the bugnote count
    $bugnote_count = bug_get_bugnote_count( $v_id );

    # grab the project name
    $project_name = project_get_field( $v_project_id, 'name' );

    # bug text infos
    $query3 = "SELECT *
        FROM $g_mantis_bug_text_table
        WHERE id='$v_bug_text_id'";
    $result3 = db_query( $query3 );
    $row = db_fetch_array( $result3 );
    extract( $row, EXTR_PREFIX_ALL, 'v2' );

    // add node for each row
    $bug = $doc->create_element('entry');
    $bug = $root->append_child($bug);

    $attrib = $bug->set_attribute('project',$project_name);

    // add a child node for each field
    insert_dom_node($doc, $bug, 'id', $v_id);
    insert_dom_node($doc, $bug, 'category', $v_category);
    insert_dom_node($doc, $bug, 'severity', get_enum_element( 'severity', $v_severity ));
    insert_dom_node($doc, $bug, 'reproducibility', get_enum_element( 'reproducibility', $v_reproducibility ));
    insert_dom_node($doc, $bug, 'date_submitted', $v_date_submitted );
    insert_dom_node($doc, $bug, 'last_updated', date( config_get( 'normal_date_format' ), $v_last_updated ));
    insert_dom_node($doc, $bug, 'reporter', user_get_name($v_reporter_id));
    insert_dom_node($doc, $bug, 'assigned_to', user_get_name($v_handler_id));
    insert_dom_node($doc, $bug, 'priority', get_enum_element( 'priority', $v_priority ));
    insert_dom_node($doc, $bug, 'status', get_enum_element( 'status', $v_status ));
    insert_dom_node($doc, $bug, 'product_build', $v_build);
    insert_dom_node($doc, $bug, 'resolution', get_enum_element( 'resolution', $v_resolution ));
    insert_dom_node($doc, $bug, 'summary', $v_summary);
    insert_dom_node($doc, $bug, 'description', $v2_description);
    insert_dom_node($doc, $bug, 'steps_to_reproduce', $v2_steps_to_reproduce);
    insert_dom_node($doc, $bug, 'additional_information', $v2_additional_information);

    # get the bugnote data
    $query6 = "SELECT *,UNIX_TIMESTAMP(date_submitted) as date_submitted
        FROM $g_mantis_bugnote_table
        WHERE bug_id='$v_id'
        ORDER BY date_submitted $g_bugnote_order";
    $result6 = db_query( $query6 );
    $num_notes = db_num_rows( $result6 );

    # no bugnotes
    if ( 0 == $num_notes ) {
        $bugnotes = insert_dom_node($doc, $bug, 'notes', lang_get( 'no_bugnotes_msg' ));
    }
    else { 
        $bugnotes = insert_dom_node($doc, $bug, 'notes', '');
    }

    for ( $k=0; $k < $num_notes; $k++ ) {
        # prefix all bugnote data with v3_
        $row = db_fetch_array( $result6 );
        extract( $row, EXTR_PREFIX_ALL, 'v3' );
        $v3_date_submitted = date( config_get( 'normal_date_format' ), ( $v3_date_submitted ) );

        # grab the bugnote text and id and prefix with v3_
        $query7 = "SELECT note, id
                FROM $g_mantis_bugnote_text_table
                WHERE id='$v3_bugnote_text_id'";
        $result7 = db_query( $query7 );
        $v3_note = db_result( $result7, 0, 0 );
        $v3_bugnote_text_id = db_result( $result7, 0, 1 );

        $v3_note = string_display_links( $v3_note );

        insert_dom_node($doc, $bugnotes, 'reporter', user_get_name( $v3_reporter_id ) );
        insert_dom_node($doc, $bugnotes, 'date_submitted', $v3_date_submitted );
        insert_dom_node($doc, $bugnotes, 'note', $v3_note );
    } # end for

} // if
} // for

// get completed xml document
$xml_string = $doc->dump_mem(true);

echo $xml_string;

?>

TagsNo tags attached.

Relationships

has duplicate 0004022 closedvboctor Add XML Export to print_bug_page.php 
has duplicate 0004023 closedvboctor Add XML Export to print_bug_page.php 

Activities

Luebbe

Luebbe

2004-07-08 03:26

reporter   ~0005913

Sorry for the triple report, but uploading files failed, even when zipped

vboctor

vboctor

2004-07-08 08:08

manager   ~0005928

Last edited: 2004-07-08 08:09

I didn't look at the patch in details, but I have the following issues:

  • I would rather we avoid having dependencies on optional PHP modules. I assume XML DOM is an optional one, right? I also read in the manual that there is compatability issues between PHP4 and PHP5 as far as this DOM XML is concerned. I would rather if we use a library implemented in PHP with GPL licensing. I didn't investigate the alternatives, so ideas are welcome.

  • I would like to research if there is an already established XML format for presenting issues/bugs/...etc. We should look at other bugtrackers like Bugzilla to see if they have an XML format. This will also allow export/import bugs from/to other bugtrackers.

  • See if you can make more use of the APIs and reduce the hard-coded queries.

edited on: 07-08-04 08:09

2004-07-24 08:16

 

bug_view_xml.php.gz (1,307 bytes)
stefanb

stefanb

2004-07-24 08:21

reporter   ~0006309

Recently I have written a patch against mantis-0.18.2 with allows a user to request a bug report in XML format. Basically, it is a copy of bug_view_advanced_page.php with all HTML markup replaced by XML tags.

It's not complete as the attachments, relationships, notes, and history sections are always empty. I haven't found API functions to retrieve these values in pure data format. The only thing I found where functions to return these structures as HTML, and I have been too lazy to write my own ones.

Maybe the attached patch gives you a start in writing a proper XML interface (which would allow Mantis to be integrated into IDEs like Eclipse, which has been my original goal...).

vboctor

vboctor

2004-07-24 11:32

manager   ~0006334

stefanb, can you tell us more about your concept of integrating Mantis with IDEs?

stefanb

stefanb

2004-07-24 13:25

reporter   ~0006335

Sure, but there is not much of a concept. As Mantis is a PHP-only (i.e. web based) application and I don't want to contact the database directly (hard to maintain schema upgrades, re-invent the security model etc.) I came up with an HTTP-based approach based on XML.

So the integration is as follows: Put server path (like http://bugs.mantisbt.org) together with your login and password(?) into a config file that can be read by the IDE. (Eclipse's plugin framework supportes this scenario directly.) If you want to see your bugs in the IDE, you open a view, the plugin code sends an HTTP request to SERVER_PATH + "/login.php" together with the parameters.

After that, request a page like SERVER_PATH + "/view_all_bug_page_xml.php" (to be written) to get an overview on all bugs. Query or post parameters would specify the filter criteria. The result is the same as in /view_all_bug_page.xml (hence the name), except that the result is not HTML but XML. This XML tree can be unmarshalled into IDE objects and get displayed.

Double-click on one of the displayed issues to open a detail view in the IDE. Behind the scenes, it sends an HTTP request to /bug_view_xml.php, the server returns the XML tree, the IDE renders it.

That's all the "concept" I have. I do have a kind of "proof of concept" for Eclipse (which is my primary IDE), however, it's more than a hack: the first time after login, you get HTML instead of XML (because you do not have a cookie specifying the filter settings, and the method setting the cookie prints out the bug page as HTML), so you have to issue the request for getting all bugs/issues twice. Second, you get only 50 issues back (or whatever you have configured as your page size) which might be good or bad. Haven't decided finally.

For the moment, this project is on ice, but it might become active again if Mantis starts having an XML interface...

kohlp

kohlp

2004-08-23 03:28

reporter   ~0007110

An IDE-Integration for Mantis would be great. If you ever plan to continue this, count me in. Have you thought about using Commons-HTTPClient? You could set the Filter-Cookie yourself.

stefanb

stefanb

2004-08-23 13:23

reporter   ~0007118

Actually, I do use commons-httpclient. The reason why I don't want to set the cookie myself is that I like to be as independent of changes in Mantis as possible. Doing it "the right way" would require to modify some files in core Mantis, which I try to avoid (at the moment).

2004-09-03 19:51

 

bugzilla.dtd (1,551 bytes)
<!ELEMENT bugzilla (bug+)>
<!ATTLIST bugzilla version CDATA #REQUIRED>
<!ATTLIST bugzilla urlbase CDATA #REQUIRED>
<!ATTLIST bugzilla maintainer CDATA #REQUIRED>
<!ATTLIST bugzilla exporter CDATA #IMPLIED>
<!ELEMENT bug (bug_id, exporter, urlbase, bug_status, resolution?, product, 
priority, version, rep_platform, assigned_to, delta_ts, component, 
reporter, target_milestone?, bug_severity, creation_ts, qa_contact?, 
status_whiteboard?, op_sys, short_desc?, keywords*, dependson*, 
blocks*, cc*, long_desc?, attachment*)>
<!ATTLIST bug error (NotFound|NotPermitted) #IMPLIED>
<!ELEMENT bug_id (#PCDATA)>
<!ELEMENT short_desc (#PCDATA)>
<!ELEMENT bug_status (#PCDATA)>
<!ELEMENT dependson (#PCDATA)>
<!ELEMENT blocks (#PCDATA)>
<!ELEMENT product (#PCDATA)>
<!ELEMENT priority (#PCDATA)>
<!ELEMENT version (#PCDATA)>
<!ELEMENT cc (#PCDATA)>
<!ELEMENT rep_platform (#PCDATA)>
<!ELEMENT assigned_to (#PCDATA)>
<!ELEMENT delta_ts (#PCDATA)>
<!ELEMENT component (#PCDATA)>
<!ELEMENT reporter (#PCDATA)>
<!ELEMENT target_milestone (#PCDATA)>
<!ELEMENT bug_severity (#PCDATA)>
<!ELEMENT creation_ts (#PCDATA)>
<!ELEMENT qa_contact (#PCDATA)>
<!ELEMENT op_sys (#PCDATA)>
<!ELEMENT keywords (#PCDATA)>
<!ELEMENT status_whiteboard (#PCDATA)>
<!ELEMENT long_desc (who, bug_when, thetext)>
<!ELEMENT who (#PCDATA)>
<!ELEMENT bug_when (#PCDATA)>
<!ELEMENT thetext (#PCDATA)>
<!ELEMENT attachment (id, date, attach_desc, type, data)>
<!ELEMENT id (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT desc (#PCDATA)>
<!ELEMENT type (#PCDATA)>
<!ELEMENT data (#PCDATA)>
bugzilla.dtd (1,551 bytes)
vboctor

vboctor

2004-09-03 19:53

manager   ~0007432

I attached bugzilla dtd to be used as a reference when designing the Mantis xml format.

2004-09-07 15:18

 

mantis.xsd (3,859 bytes)

2004-09-07 15:19

 

sample.xml (2,753 bytes)
<?xml version="1.0" encoding="ISO-8859-1"?>

<mantis xmlns="http://www.mantisbt.org"
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        xsi:schemaLocation='http://www.mantisbt.org mantis.xsd'>

  <issue id="5">
    <category>Default</category>
    <priority id="40">high</priority>
    <severity id="50">minor</severity>
    <status id="10">new</status>

    <reporter id="4711">stefan</reporter>
    <summary>This is a summary</summary>
    <description>This is a super long and exhaustive description. Not really...</description>
    <reproducibility id="10">always</reproducibility>
    <date_submitted>1094586280</date_submitted>
    
    <last_update>1094586280</last_update>
  </issue>

  <issue id="6">
    <category>Default</category>
    <priority id="20">low</priority>
    <severity id="80">block</severity>
    <status id="80">resolved</status>

    <reporter id="4711">stefan</reporter>
    <summary>Another summary</summary>
    <description>We are getting bored with this issue...</description>
    <version>HEAD</version>
    <build>20040907-17</build>
    <platform>Linux</platform>
    <os>Debian</os>
    <os_version>Sarge</os_version>
    <reproducibility id="30">sometimes</reproducibility>
    <steps_to_reproduce>1. Begin to yawn. 2. Feeling bored? If not, goto 1.</steps_to_reproduce>
    <additional_info>Sometimes it's easy to reproduce, sometimes not.</additional_info>
    <date_submitted>1094586280</date_submitted>

    <assigned_to id="4711">stefan</assigned_to>
    <projection id="70">major rework</projection>
    <eta id="40">&lt; 1 week</eta>

    <resolution id="50">not a bug</resolution>
    <fixed_in_version>HEAD</fixed_in_version>

    <attachment>
      <filename>picture_of_me.jpg</filename>
      <size>63312</size>
      <content_type>image/jpeg</content_type>
      <timestamp>1094587086</timestamp>
      <download_url>http://localhost/mantis/file_download.php?file_id=403&amp;type=bug</download_url>
    </attachment>
    <attachment>
      <filename>brain_dump.txt</filename>
      <size>5</size>
      <content_type>text/plain</content_type>
      <timestamp>10945889086</timestamp>
      <download_url>http://localhost/mantis/file_download.php?file_id=404&amp;type=bug</download_url>
    </attachment>

    <relationship>
      <type>related to</type>
      <id>1</id>
    </relationship>

    <note private="true">
      <author id="4711">stefan</author>
      <timestamp>10945889086</timestamp>
      <text>My own non-public note. Can you see it?</text>
    </note>
    <note>
      <author id="4711">stefan</author>
      <timestamp>10945889186</timestamp>
      <text>And now a public note.</text>
    </note>
    
    <last_update>1094586280</last_update>
  </issue>

</mantis>
sample.xml (2,753 bytes)
stefanb

stefanb

2004-09-07 15:28

reporter   ~0007477

I uploaded an XML Schema Definition plus a sample.xml following this XSD as a proposal for the Mantis XML format.

vboctor: I didn't follow the bugzilla.dtd at all. The main reason is, that there are several bug/issue trackers around and each one has a different XML format. If you want to export/import from/to these systems, the best way would to use dedicated XSLTs to transform one XML format into another. I do not think that this would be a hard task.

Additionally, using the bugzilla.dtd for Mantis could lead to field mapping problems: Required bugzilla fields might not make sense within Mantis and would have to be filled with bogus values, while some Mantis fields might not have a representation in bugzilla and could not be exported/imported for that reason.

vboctor

vboctor

2004-09-07 17:10

manager   ~0007478

I never meant that we should use bugzilla's DTD, I just attached it to get some ideas from it (if any).

I already started working on an XSD. I will attach it here once it is done.

vboctor

vboctor

2004-09-07 17:13

manager   ~0007479

If anyone has ideas about a good PHP library to use for generating(/parsing) of XML, please include it here. We are looking at a GPL. However, I was also looking at LGPL or something similar to another project I am doing.

MiniXml (GPL): http://minixml.psychogenic.com/

stefanb

stefanb

2004-09-26 10:30

reporter   ~0007752

I still don't see the point why you need a library for generating XML. (Parsing XML is a different thing, but that's not within scope of this issue.)

I have enhanced my previous attempt to do export directly within PHP. Seems to work for me, besides missing Attachment and Relationship sections. I didn't find API calls to retrieve this information in raw (i.e. non HTML) format and I don't want to re-invent the wheel.

Maybe you could browse through the patch and see if it suits your needs?

2004-09-26 10:31

 

mantis-xml-patch.tar.gz (2,083 bytes)

2004-09-26 10:31

 

mantis-xml-patch.tar.gz (2,083 bytes)

2004-09-26 10:32

 

mantis.xsd (4,118 bytes)

2004-09-26 10:32

 

sample.xml (2,809 bytes)
<?xml version="1.0" encoding="ISO-8859-1"?>

<mantis xmlns="http://www.mantisbt.org"
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        xsi:schemaLocation='http://www.mantisbt.org mantis.xsd'>

  <issue id="5">
    <category>Default</category>
    <priority id="40">high</priority>
    <severity id="50">minor</severity>
    <status id="10">new</status>

    <reporter id="4711" login="stefan">Stefan B</reporter>
    <summary>This is a summary</summary>
    <description>This is a super long and exhaustive description. Not really...</description>
    <reproducibility id="10">always</reproducibility>
    <dateSubmitted>1094586280</dateSubmitted>
    
    <lastUpdate>1094586280</lastUpdate>
  </issue>

  <issue id="6">
    <category>Default</category>
    <priority id="20">low</priority>
    <severity id="80">block</severity>
    <status id="80">resolved</status>

    <reporter id="4711" login="Stefan">Stefan B</reporter>
    <summary>Another summary</summary>
    <description>We are getting bored with this issue...</description>
    <version>HEAD</version>
    <build>20040907-17</build>
    <platform>Linux</platform>
    <os>Debian</os>
    <osVersion>Sarge</osVersion>
    <reproducibility id="30">sometimes</reproducibility>
    <stepsToReproduce>1. Begin to yawn. 2. Feeling bored? If not, goto 1.</stepsToReproduce>
    <additionalInfo>Sometimes it's easy to reproduce, sometimes not.</additionalInfo>
    <dateSubmitted>1094586280</dateSubmitted>

    <assignedTo id="4711" login="stefan">Stefan B</assignedTo>
    <projection id="70">major rework</projection>
    <eta id="40">&lt; 1 week</eta>

    <resolution id="50">not a bug</resolution>
    <fixedInVersion>HEAD</fixedInVersion>

    <attachment>
      <filename>picture_of_me.jpg</filename>
      <size>63312</size>
      <contentType>image/jpeg</contentType>
      <timestamp>1094587086</timestamp>
      <downloadUrl>http://localhost/mantis/file_download.php?file_id=403&amp;type=bug</downloadUrl>
    </attachment>
    <attachment>
      <filename>brain_dump.txt</filename>
      <size>5</size>
      <contentType>text/plain</contentType>
      <timestamp>10945889086</timestamp>
      <downloadUrl>http://localhost/mantis/file_download.php?file_id=404&amp;type=bug</downloadUrl>
    </attachment>

    <relationship>
      <type>related to</type>
      <id>1</id>
    </relationship>

    <note private="true">
      <author id="4711" login="stefan">Stefan B</author>
      <timestamp>10945889086</timestamp>
      <text>My own non-public note. Can you see it?</text>
    </note>
    <note>
      <author id="4711" login="stefan">Stefan B</author>
      <timestamp>10945889186</timestamp>
      <text>And now a public note.</text>
    </note>
    
    <lastUpdate>1094586280</lastUpdate>
  </issue>

</mantis>
sample.xml (2,809 bytes)
stefanb

stefanb

2004-09-26 10:34

reporter   ~0007753

Sorry, accidently uploaded the tar twice.

@<people_with_admin_rights>: Maybe you can clean up a bit? The older mantis.xsd and sample.xml are obsoleted by the new uploads. Same goes for 0004024-bug_view_xml_php.gz

vboctor

vboctor

2004-09-26 10:50

manager   ~0007754

We can generate xml manually, however, a library will simplify the following:

  1. Escaping of special characters ( '<', '>' )
  2. Encoding of binary data ( attachments )
  3. Making sure that xml document is welformed.

All the above points can be done manually though. I will have a look at your patch and get this thing going.

2006-06-18 15:41

 

xml_export.php.gz (1,743 bytes)
tandler

tandler

2006-06-18 15:50

reporter   ~0012981

Hi, I wrote some code to export the list of issues as a simple xml file, and just saw that here's already an related issue, so I'd attached it here. I never did any php programming before and I didn't test it much, so please treat it with great care ... :-)
it is really a very simple + straighforward solution (based mainly on csv and excel export - as I don't know much about the mantis design), without any DOM and whatsoever. Maybe this is of help for someone else anyway. I would be glad to hear some comments. Cheers, Peter

2006-07-06 07:55

 

xml_export.php 2006-07-06.gz (1,832 bytes)
tandler

tandler

2006-07-06 07:57

reporter   ~0013077

I've uploaded a small update to xml_export.php, it now writes the reporter, handler and project also as strings, not only the IDs.

tandler

tandler

2008-01-21 07:10

reporter   ~0016743

I've uploaded the attachment again (including minor fixes with respect to style guide) to issue 0007214 (including both freemind and xml export).

vboctor

vboctor

2008-03-15 02:44

manager   ~0017361

I've checked-in the mind mapping feature implemented in 0007214. However, I haven't checked-in the xml export portion. giallu was working on xml export feature and part of this work is defining the format.

vboctor

vboctor

2008-03-15 02:51

manager   ~0017364

@tandler, it would be useful to attached your xml export implementation here.

If anyone has the lost attachments or a newer versions of them, please re-attach.

giallu

giallu

2008-03-15 05:11

reporter   ~0017365

Yes. I'm working on the XML export so I'll reassign this to myself

2008-03-16 16:52

 

mantis.dtd (1,736 bytes)
<!-- Mantis DTD for xml export-->

<!-- root element <mantis>, composed by one or more <bug> elements -->
<!ELEMENT mantis (bug+)>
<!ATTLIST mantis
          version CDATA #REQUIRED
          urlbase CDATA #REQUIRED
		  buglink CDATA #REQUIRED
		  notelink CDATA #REQUIRED
>


<!ELEMENT bug (
		id ,
		description ,
		additional_information? ,
		steps_to_reproduce? ,
		project_id ,
		reporter_id ,
		handler_id? ,
		duplicate_id? ,
		priority? ,
		severity? ,
		reproducibility? ,
		status? ,
		resolution? ,
		projection? ,
		date_submitted ,
		last_updated ,
		eta? ,
		os? ,
		os_build? ,
		platform? ,
		version? ,
		fixed_in_version? ,
		target_version? ,
		build? ,
		profile_id? ,
		view_state ,
		summary ,
		category_id? ,
		sponsorship_total? ,
		sticky?
		)
>

<!ELEMENT id (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT additional_information (#PCDATA)>
<!ELEMENT steps_to_reproduce (#PCDATA)>
<!ELEMENT project_id (#PCDATA)>
<!ELEMENT reporter_id (#PCDATA)>
<!ELEMENT handler_id (#PCDATA)>
<!ELEMENT duplicate_id (#PCDATA)>
<!ELEMENT priority (#PCDATA)>
<!ELEMENT severity (#PCDATA)>
<!ELEMENT reproducibility (#PCDATA)>
<!ELEMENT status (#PCDATA)>
<!ELEMENT resolution (#PCDATA)>
<!ELEMENT projection (#PCDATA)>
<!ELEMENT date_submitted (#PCDATA)>
<!ELEMENT last_updated (#PCDATA)>
<!ELEMENT eta (#PCDATA)>
<!ELEMENT os (#PCDATA)>
<!ELEMENT os_build (#PCDATA)>
<!ELEMENT platform (#PCDATA)>
<!ELEMENT version (#PCDATA)>
<!ELEMENT fixed_in_version (#PCDATA)>
<!ELEMENT target_version (#PCDATA)>
<!ELEMENT build (#PCDATA)>
<!ELEMENT view_state (#PCDATA)>
<!ELEMENT summary (#PCDATA)>
<!ELEMENT category_id (#PCDATA)>
<!ELEMENT sponsorship_total (#PCDATA)>
<!ELEMENT sticky (#PCDATA)>
<!ELEMENT profile_id (#PCDATA)>
mantis.dtd (1,736 bytes)

2008-03-16 16:53

 

exported_issues.xml (5,633 bytes)
<?xml version="1.0" ?>
<!-- mantis export ..... -->
<mantis version="1.2.0-SVN" urlbase="http://localhost/mantisgit/" buglink="#" notelink="~">

<bug>
	<id>8437</id>
	<description><![CDATA[The attached patch brings strings_italian.txt in sync with strings_english.txt:1.316]]></description>
	<project_id>1</project_id>
	<reporter_id>3361</reporter_id>
	<handler_id>4599</handler_id>
	<priority>30</priority>
	<severity>50</severity>
	<reproducibility>100</reproducibility>
	<status>80</status>
	<resolution>20</resolution>
	<projection>10</projection>
	<date_submitted>1191345694</date_submitted>
	<last_updated>1196966208</last_updated>
	<eta>10</eta>
	<version>1.1.0a4</version>
	<fixed_in_version>1.1.0rc4</fixed_in_version>
	<view_state>10</view_state>
	<summary><![CDATA[Update to italian translation]]></summary>
	<category_id>24</category_id>
</bug>

<bug>
	<id>6325</id>
	<description><![CDATA[
Hi all,
  I have done some customizations to mantis.

If anyone is interested, I have added the DATETIME data type and the Simple Text Search on custom fields.

It works great for me, but I'm a little noob of php so if you think that something is wrong.. let me know how to fix

If you like it... use it!

Byez
MTW
]]></description>
	<additional_information><![CDATA[
The DATETIME uses the $g_normal_date_format instead of $g_short_date_format both in input and in output (print)
on the right of the combo of hours and minutes I have printed the date format.
I thought it could be useful to avoid misunderstandings between m/d/y and d/m/y but I think you can delete it if you don't like it.

The Simple Text Search works on date/datetime fields as well, but for now I had to hardcode some MySQL specific SQL statement.. any idea to make it installation-independent is appreciated. :)
]]></additional_information>
	<project_id>1</project_id>
	<reporter_id>6464</reporter_id>
	<priority>30</priority>
	<severity>10</severity>
	<reproducibility>10</reproducibility>
	<status>10</status>
	<resolution>10</resolution>
	<projection>10</projection>
	<date_submitted>1128677600</date_submitted>
	<last_updated>1160545020</last_updated>
	<eta>10</eta>
	<version>1.0.0rc2</version>
	<view_state>10</view_state>
	<summary><![CDATA[Added DATETIME data type, added Simple Text Search on custom fields]]></summary>
	<category_id>18</category_id>
</bug>

<bug>
	<id>6155</id>
	<description><![CDATA[It will be good an option to be added into the configuration file that overrides encoding described in the language files.

I'm from Bulgaria. We post issues to Mantis in Bulgarian, so the encoding we use is "Windows-1251". Since there is no Bulgarian language translation I must set in the language files (for example strings_english.txt) encoding to "Windows-1251". But not everyone that reports issues is familar with English, so someone want to chooce French or Italian or something else. Then I must change these languagesencodings also to "Windows-1251". If I upgrade to a new version, this procedure must be done again.
]]></description>
	<additional_information><![CDATA[Since I'm an experienced PHP web developer I'm interested in joining your team in development of Mantis. So if you are interested, please let me know. My e-mail is izhekov@ppartner.com.]]></additional_information>
	<project_id>1</project_id>
	<reporter_id>6424</reporter_id>
	<priority>30</priority>
	<severity>50</severity>
	<reproducibility>10</reproducibility>
	<status>10</status>
	<resolution>10</resolution>
	<projection>10</projection>
	<date_submitted>1124335156</date_submitted>
	<last_updated>1159094773</last_updated>
	<eta>10</eta>
	<view_state>10</view_state>
	<summary><![CDATA[[all lang] Using different language can cause mantis posted issues not to be viewable.]]></summary>
	<category_id>24</category_id>
</bug>

<bug>
	<id>6538</id>
	<description><![CDATA[When I try to use the italian vowels (html entities agrave or aacute, etc),
they disappear from summary and description fields.

I'm using MySQL 4.1 UTF8 on windows XP]]></description>
	<project_id>1</project_id>
	<reporter_id>5019</reporter_id>
	<priority>30</priority>
	<severity>60</severity>
	<reproducibility>10</reproducibility>
	<status>10</status>
	<resolution>10</resolution>
	<projection>10</projection>
	<date_submitted>1135738458</date_submitted>
	<last_updated>1139308376</last_updated>
	<eta>10</eta>
	<version>1.0.0rc4</version>
	<view_state>10</view_state>
	<summary><![CDATA[Italian characters problems]]></summary>
	<category_id>2</category_id>
</bug>

<bug>
	<id>2117</id>
	<description><![CDATA[even if in config_inc.php we set

	# --- language settings -----------
	$g_default_language     = 'italian';

	# list the choices that the users are allowed to choose
	$g_language_choices_arr = array( 'italian', 'english');

the default language for "administrator" is still english, for all other users (ex. an user upgraded to admin) is italian.]]></description>
	<project_id>1</project_id>
	<reporter_id>788</reporter_id>
	<priority>30</priority>
	<severity>50</severity>
	<reproducibility>10</reproducibility>
	<status>40</status>
	<resolution>10</resolution>
	<projection>10</projection>
	<date_submitted>1023793989</date_submitted>
	<last_updated>1092020856</last_updated>
	<eta>10</eta>
	<os>Windows 2000</os>
	<platform>x86</platform>
	<version>none</version>
	<profile_id>315</profile_id>
	<view_state>10</view_state>
	<summary><![CDATA[default language for admin]]></summary>
	<category_id>5</category_id>
</bug>

</mantis>
exported_issues.xml (5,633 bytes)
giallu

giallu

2008-03-16 16:54

reporter   ~0017379

For reference, I just attached the DTD I'm currently using and a sample XML file, exported from a filter, conforming to the DTD

vboctor

vboctor

2008-03-16 17:27

manager   ~0017380

I had a quick look on the sample XML and here are my comments:

  1. The export has a lot of ids. These ids may mean different things to different people working with the data. I had the same problem when defining the SOAP API interface. What I ended up doing is to use an object reference concept. Hence, rather than just using an id, I use an id and a non-localized name to refer to an object. This applies to enumerations, users, etc.

  2. When generating the XML we should have a better ordering of the fields within the issue. However, when importing we should be able to accept them in any order. For example, I would expect the additional information and steps to reproduce to be towards the end, and for id, summary to be at the top.

  3. For the time stamps, we should use a standard that is also readable by humans.

  4. The XML format should allow for addition of entities other than issues. Hence, there should be an <Issues> tag, under which we have multiple <Issue> tags. We should ideally have other tags like <Projects>, <Users>, <Statuses>, <Workflow>, <Profiles>, etc.

  5. We should also have a <Configuration> tag under which we include information like the bug link and notes link. This will allow easily adding future information as needed.

  6. What about custom fields, notes, tags, history, attachments, sponsorships?

  7. When exporting a project or a set of issues, we may want to only export the users who are referenced from the exported data. This would be useful to export a project into a separate Mantis installation.

  8. Did you consider both DTD / XSD options for the schema? Any reason you preferred DTD?

  9. Did you find other predefined formats for handling exporting / importing of issues for a specific bug tracker or between bug trackers? Here is the link for the Bugzilla one:
    http://www.koders.com/xml/fid8625854DB559A4EB78B86D020E82351CCED720DB.aspx

  10. The name of the 'version' tag is too generic. We should be specific about what kind of version it is.
tandler

tandler

2008-04-09 06:19

reporter   ~0017578

my very simple & straightforward XML export implementation is attached to 0007214 (bundled with the freemind export) although this rather belongs here.

atrol

atrol

2013-08-16 12:44

developer   ~0037887

Removed assignment. giallu will not contribute to this issue in near future.

dregad

dregad

2017-03-30 04:43

developer   ~0056279

I'm marking this as resolved on the grounds that we bundle the XmlImportExport plugin since Mantis 1.2, so I assume (without actually looking into the details of this issue) that the original requirement is satisfied. If not, I suggest to open a new issue to track any changes that should be implemented in the core plugin.

Issue History

Date Modified Username Field Change
2004-07-08 03:21 Luebbe New Issue
2004-07-08 03:26 Luebbe Note Added: 0005913
2004-07-08 05:41 vboctor Relationship added duplicate of 0004022
2004-07-08 05:41 vboctor Relationship added duplicate of 0004023
2004-07-08 08:08 vboctor Note Added: 0005928
2004-07-08 08:09 vboctor Note Edited: 0005928
2004-07-24 08:16 stefanb File Added: bug_view_xml.php.gz
2004-07-24 08:21 stefanb Note Added: 0006309
2004-07-24 11:32 vboctor Note Added: 0006334
2004-07-24 13:25 stefanb Note Added: 0006335
2004-08-23 03:28 kohlp Note Added: 0007110
2004-08-23 13:23 stefanb Note Added: 0007118
2004-09-03 19:51 vboctor File Added: bugzilla.dtd
2004-09-03 19:53 vboctor Note Added: 0007432
2004-09-07 15:18 stefanb File Added: mantis.xsd
2004-09-07 15:19 stefanb File Added: sample.xml
2004-09-07 15:28 stefanb Note Added: 0007477
2004-09-07 17:10 vboctor Note Added: 0007478
2004-09-07 17:13 vboctor Note Added: 0007479
2004-09-07 17:13 vboctor Assigned To => vboctor
2004-09-07 17:21 vboctor Status new => assigned
2004-09-26 10:30 stefanb Note Added: 0007752
2004-09-26 10:31 stefanb File Added: mantis-xml-patch.tar.gz
2004-09-26 10:31 stefanb File Added: mantis-xml-patch.tar.gz
2004-09-26 10:32 stefanb File Added: mantis.xsd
2004-09-26 10:32 stefanb File Added: sample.xml
2004-09-26 10:34 stefanb Note Added: 0007753
2004-09-26 10:50 vboctor Note Added: 0007754
2006-06-18 15:41 tandler File Added: xml_export.php.gz
2006-06-18 15:50 tandler Note Added: 0012981
2006-07-06 07:55 tandler File Added: xml_export.php 2006-07-06.gz
2006-07-06 07:57 tandler Note Added: 0013077
2008-01-21 07:10 tandler Note Added: 0016743
2008-03-15 02:44 vboctor Note Added: 0017361
2008-03-15 02:44 vboctor Assigned To vboctor =>
2008-03-15 02:44 vboctor Additional Information Updated
2008-03-15 02:51 vboctor Note Added: 0017364
2008-03-15 02:51 vboctor Status assigned => new
2008-03-15 05:11 giallu Note Added: 0017365
2008-03-15 05:12 giallu Status new => assigned
2008-03-15 05:12 giallu Assigned To => giallu
2008-03-16 16:52 giallu File Added: mantis.dtd
2008-03-16 16:53 giallu File Added: exported_issues.xml
2008-03-16 16:54 giallu Note Added: 0017379
2008-03-16 17:27 vboctor Note Added: 0017380
2008-04-09 06:19 tandler Note Added: 0017578
2008-08-10 16:11 turker Sponsorship Added turker: US$ 10
2008-08-10 16:11 turker Sponsorship Total 0 => 10
2013-08-16 12:44 atrol Note Added: 0037887
2013-08-16 12:44 atrol Assigned To giallu =>
2013-08-16 12:44 atrol Status assigned => new
2017-03-30 04:43 dregad Assigned To => dregad
2017-03-30 04:43 dregad Status new => resolved
2017-03-30 04:43 dregad Resolution open => no change required
2017-03-30 04:43 dregad Note Added: 0056279
2017-04-01 00:13 vboctoradmin Status resolved => closed