The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XML::FXN - Fast XML Notation.

SYNOPSIS

 use strict;
 use XML::FXN;

 my $xml_document = <<EOXML;
    <?xml version="1.0" standalone="yes"?>
    <user role='sender'>
        <name>fbHNkg==</name>
        <password>bb0GwesZoM</password>
        <resource>Just another client</resource>
        <priority/>
    </user>
 EOXML
 my $fxn_document = xml2fxn( $xml_document );
 
 $fxn_document = <<EOFXN;
    <?xml version="1.0" standalone="yes"?>
    user role='sender'<
        name<fbHNkg==>
        password<bb0GwesZoM>
        resource<Just another client>
        priority<>
    >
 EOFXN
 $xml_document = fxn2xml( $fxn_document );  

DESCRIPTION

Fast XML Notation

XML is used more and more in specifications like BPEL as a notation for programming tasks. There is a need for a XML notation, which can help handle XML in text mode in a manner similar to 'normal' programming languages. Fast XML Transformation applies only to well-formed XML documents and should allow 1:1 transformation in both directions without any loss in the content meaning and editorial structure. The transformation is based on shallow XML parsing.

Comments, Processing Instructions, Prolog and Document Type Declaration as defined in the Extensible Markup Language (XML) 1.0 (http://www.w3.org/TR/REC-xml) are not touched by the Fast XML Transformation.

A so-called data-centric XML document as shown in the example below:

 <tag1 atribute1='XXX' atribute2='YYY'>
     <tag2>AAA</tag2>
     <tag3> </tag3>
     <tag4/>
     <tag5></tag5>
     <tag6 atribute3 = 'ZZZ'/>
 </tag1>

is transformed to:

 tag1 atribute1='XXX' atribute2='YYY'<
    tag2<AAA>
    tag3< >
    tag4<>
    tag5<>
    tag6 atribute3 = 'ZZZ'<>
 >

A XML document with mixed content establishes a special case. For transformation from XML to FXN content1<tag1> is converted to content tag1<>, if content has any other than \s characters. Converting back from FXN to XML removes the injected space character.

 <tag1 atribute1='XXX'>cccc <tag2>AAA</tag2> ccc<tag3>fff</tag3>
  <tag4/>   <tag5/><tag6 atribute3 = 'ZZZ'/>dddd</tag1> 

is transformed to:

 tag1 atribute1='XXX'<cccc  tag2<AAA> ccc tag3<fff>
  tag4<>   tag5<>tag6 atribute3 = 'ZZZ'<>dddd> 

The FXN file can be marked with the extention *.fxn.

Transformation functions

The module provides only two methods:

  • xml2fxn( $xml_document )

    takes a string with the XML document as argument and returns document transformed to the Fast XML Notation;

  • fxn2xml( $fxn_document )

    takes a string with the FXN document as argument and returns document transformed to XML.

BUGS

If a bug is detected or FXN non-conform behavior, please send the xml file and fxn file as error report to <jwach@cpan.org>.

COPYRIGHT

Copyright 2005 Jerzy Wachowiak <jwach@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.