XML-Mini

 view release on metacpan or  search on metacpan

lib/XML/Mini/Document.pm  view on Meta::CPAN

					 <!DOCTYPE\s*([^\[>]*)(\[.*?\])?\s*>\s*|	# DOCTYPE
					 <!ENTITY\s*([^"'>]+)\s*(["'])([^\11]+)\11\s*>\s*| # ENTITY
					 ([^<]+))(.*)/xogsmi) # plain text
		{
			my $firstPart	 = $1;
			my $unaryName 	 = $2;
			my $unaryAttribs = $3;
			my $headerName 	 = $4;
			my $headerAttribs= $5;
			my $comment 	 = $6;
			my $cdata	 = $7;
			my $doctype	 = $8;
			my $doctypeCont  = $9;
			my $entityName	 = $10;
			my $entityCont	 = $12;
			my $plainText	 = $13;
			my $remainder 	 = $14;
			
			
			
			# There is some duplication here that should be merged with that in fromSubString()

lib/XML/Mini/Document.pm  view on Meta::CPAN

			{
				my $newElement = $parentElement->createChild($unaryName);
				$self->_extractAttributesFromString($newElement, $unaryAttribs) if ($unaryAttribs);
			} elsif ($headerName)
			{
				my $newElement = XML::Mini::Element::Header->new($headerName);
				$self->_extractAttributesFromString($newElement, $headerAttribs) if ($headerAttribs);
				$parentElement->appendChild($newElement);
			} elsif (defined $comment) {
				$parentElement->comment($comment);
			} elsif (defined $cdata) {
				my $newElement = XML::Mini::Element::CData->new($cdata);
				$parentElement->appendChild($newElement);
			} elsif ($doctype || defined $doctypeCont) {
				my $newElement = XML::Mini::Element::DocType->new($doctype);
				$parentElement->appendChild($newElement);
				if ($doctypeCont)
				{
					$doctypeCont =~ s/^\s*\[//smg;
					$doctypeCont =~ s/\]\s*$//smg;
					
					$self->fromSubStringBT($newElement, $doctypeCont);

lib/XML/Mini/Document.pm  view on Meta::CPAN

    \s*<!DOCTYPE\s*([^\[>]*)(\[.*?\])?\s*>\s*|
    \s*<!ENTITY\s*([^"'>]+)\s*(["'])([^\14]+)\14\s*>\s*|
    \s*<\?\s*([^\s>]+)\s*([^>]*)\?>|
    ^([^<]+)(.*)/xogsmi)
	   

    {
	# Check which string matched.'
	my $uname = $7;
	my $comment = $6;
	my $cdata = $10;
	my $doctypedef = $11;
	if ($12)
	{
		if ($doctypedef)
		{
			$doctypedef .= ' ' . $12;
		} else {
			$doctypedef = $12;
		}
	}

lib/XML/Mini/Document.pm  view on Meta::CPAN

	} elsif (defined $headername)
	{
		my $newElement = XML::Mini::Element::Header->new($headername);
		$self->_extractAttributesFromString($newElement, $headerAttribs) if ($headerAttribs);
		$parentElement->appendChild($newElement);
	
	} elsif (defined $comment) {
	    #my $newElement = XML::Mini::Element::Comment->new('!--');
	    #$newElement->createNode($comment);
	    $parentElement->comment($comment);
	} elsif (defined $cdata) {
	    my $newElement = XML::Mini::Element::CData->new($cdata);
	    $parentElement->appendChild($newElement);
	} elsif (defined $doctypedef) {
	    
	    my $newElement = XML::Mini::Element::DocType->new($11);
	    $parentElement->appendChild($newElement);
	    $self->fromSubString($newElement, $doctypedef);
	    
	} elsif (defined $entityname) {
	    
	    my $newElement = XML::Mini::Element::Entity->new($entityname, $15);

lib/XML/Mini/Element.pm  view on Meta::CPAN

    my $self = shift;
    my $name = shift;
    my $value = shift;
    
    my $newElement = XML::Mini::Element::Entity->new($name, $value);
    $self->appendChild($newElement);
    
    return $newElement;
}

sub cdata
{
    my $self = shift;
    my $contents = shift;
    my $newElement = XML::Mini::Element::CData->new($contents);
    $self->appendChild($newElement);
    
    return $newElement;
}

# Note: the seperator parameter remains officially undocumented

lib/XML/Mini/Element.pm  view on Meta::CPAN

 my $newDocType = $xmlRoot->docType('spec SYSTEM "spec.dtd"');
 $newDocType->entity('doc.audience', 'public review and discussion');

=head2 entity NAME VALUE

Append a new <!ENTITY NAME "VALUE"> element as a child of this 
element.

Returns the appended ENTITY element.

=head2 cdata CONTENTS

Append a new <![CDATA[ CONTENTS ]]> element as a child of this element.
Returns the appended CDATA element.

=head2 getValue

Returns a string containing the value of all the element's
child XML::MiniNodes (and all the XML::MiniNodes contained within 
it's child Elements, recursively).

lib/XML/Mini/Element/CData.pm  view on Meta::CPAN

__END__

=head1 NAME

XML::Mini::Element::CData

=head1 DESCRIPTION

The XML::Mini::Element::CData is used internally to represent <![CDATA [ CONTENTS ]]>.

You shouldn't need to use it directly, see XML::Mini::Element's cdata() method.

=head1 AUTHOR

LICENSE

    XML::Mini::Element::CData module, part of the XML::Mini XML parser/generator package.
    Copyright (C) 2002 Patrick Deegan
    All rights reserved
    
    This program is free software; you can redistribute it and/or modify



( run in 0.255 second using v1.01-cache-2.11-cpan-454fe037f31 )