I have got sample from Browser but it not statify to process....
XML:
i need error.log file....
simply:
Error.log
File_Name:LineN o:ColumnNo:erro r_Locaiton
I want this type of process with error.log
1. Tagging validation.
2. Tagging with DTD validation
how do this?
Code:
#!/usr/bin/perl
use strict;
use warnings;
use XML::Validate;
my $validator = new XML::Validate(Type => 'LibXML');
if ($validator->validate('sample.xml')) {
print "Document is valid\n";
}
else
{
print "Document is invalid\n";
my $message = $validator->last_error()->{message};
my $line = $validator->last_error()->{line};
my $column = $validator->last_error()->{column};
chomp($message);
chomp($line);
chomp($column);
print "Error: $message at line $line, column $column\n";
}
Code:
<?xml version="1.0"?>
<purchaseOrder orderDate="1999-10-20">
<shipTo country="US">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo>
<billTo country="US">
<name>Robert Smith</name>
<street>8 Oak Avenue</street>
<city>Old Town</city>
<state>PA</state>
<zip>95819</zip>
</billTo>
<comment>Hurry, my lawn is going wild<!/comment>
<items>
<item partNum="872-AA">
<productName>Lawnmower</productName>
<quantity>1</quantity>
<USPrice>148.95</USPrice>
<comment>Confirm this is electric</comment>
</item>
<item partNum="926-AA">
<productName>Baby Monitor</productName>
<quantity>1</quantity>
<USPrice>39.98</USPrice>
<shipDate>1999-05-21</shipDate>
</item>
</items>
</purchaseOrder>
simply:
Error.log
File_Name:LineN o:ColumnNo:erro r_Locaiton
I want this type of process with error.log
1. Tagging validation.
2. Tagging with DTD validation
how do this?