Response Format

John Brzozowski jjbrzozowski at lucent.com
Wed Aug 14 15:13:24 EDT 2002


Todd,

I certainly would not mind looking at what you have done in Perl for
converting the output to XML.  One thing that was noticed about your example
is the handling of duplicate fields from WhoIs.  For example, there are
three <Comments> field that come back from WhoIs.  One for each of the
following: 1) the ISP, 2) the Customer, and the 3) the Customer's address
block.  Therefore, I would think nesting some of the elements might be
advantageous.  For example:

<?xml version='1.0' standalone='yes'?>
<Response>
    <ISP>
        <OrgName>XYZ Organization</OrgName>
        <OrgID>XYZ</OrgID>
        <Netrange>
            <RangeStart> 10.0.0.0 </RangeStart>
            <RangeEnd> 10.255.255.255 </RangeEnd>
        </Netrange>
        <CIDR> 10.0.0.0/8 </CIDR>
        <Netname> XYZ123 </Netname>
        <Nethandle>NET-10-0-0-0</Nethandle>
        <Parent>10.0.0.0</Parent>
        <Nettype> Direct Allocation </Nettype>
        <Nameserver> ns.nameserver.com,ns1.nameserver.com</Nameserver>
        <Comment>Comments for the ISP or provider would go here.</Comment>
        <Regdate>2002-08-01</Regdate>
        <Updated>2002-08-13</Updated>
        <Techhandle>X23-ARIN</Techhandle>
        <Techname>Some Person</Techname>
        <Techphone>+1-800-555-1212</Techphone>
        <Techemail>someone at somedomain.com</Techemail>
    </ISP>
    <Customer>
        <Custname>Customer ABC</Custname>
        <CustID>ABC00011</CustID>
        <Address>1313 Mockingbird Lane, Anywhere, PA 00000-0000</Address>
        <Country>US</Country>
        <Comment>Customer comments go here</Comment>
        <RegDate>2001-01-01</RegDate>
        <Updated>2001-01-02</Updated>
        <Block>
            <Netrange>
                <RangeStart>10.0.1.0</RangeStart>
                <RangeEnd>10.0.1.255</RangeEnd>
            </Netrange>
            <CIDR>10.0.1.0/24</CIDR>
            <Netname>ASDAS-23234</Netname>
            <Nethandle>NET-10-0-1-0</Nethandle>
            <Parent>NET-10-0-0-0</Parent>
            <Nettype>Reassigned</Nettype>
            <Comment>Customer block comments go here.</Comment>
            <Regdate>2002-08-14</Regdate>
            <Updated>2002-08-14</Updated>
        </Block>
    </Customer>
</Response>

In some earlier messages I asked about XML formatted output from WhoIs.  The
above might be a start, if one is not already present, on how the XML output
might be formatted.  Feedback or corrections are welcome.

Thanks,

John

----- Original Message -----
From: "Todd Caine" <todd_caine at eli.net>
To: "Brzozowski, John Jason" <jjbrzozowski at lucent.com>; <dbwg at arin.net>
Sent: Wednesday, August 14, 2002 2:00 PM
Subject: Re: Response Format


> Hi John,
>
> "Brzozowski, John Jason" wrote:
>
> > Also, is there any XML support if no is it planned?
>
> I'm working on a Perl extension for the new whois server output called
> Net::Whois::ARIN.  If no XML support is planned it would be fairly simple
to
> combine the use of a module like this with XML::Simple to get Whois output
in
> XML format.
>
> Here's some example code:
>
> use Net::Whois::ARIN;
> use XML::Simple;
>
> my $o = Net::Whois::ARIN->new(
>     -host => 'beta.arin.net',
>     -port => 4344,
> );
>
> my %rec = $o->query_handle('ELIX');
>
> XMLout(
>     \%rec,
>     xmldecl  => 1,
>     noattr   => 1,
>     rootname => 'Record'
> );
>
> exit;
>
> The output from this would be:
>
> <?xml version='1.0' standalone='yes'?>
> <Record>
>   <Country>US</Country>
>   <Comment></Comment>
>   <Address>4400 NE 77th Ave Vancouver, WA 98662</Address>
>   <Updated>2001-09-26</Updated>
>   <RegDate>1999-01-19</RegDate>
>   <OrgID>ELIX</OrgID>
>   <OrgName>Electric Lightwave Inc</OrgName>
> </Record>
>
> The hash returned could be used directly to access the values needed also
like:
>
> printf(
>     "OrgID %s was registered to %s on %s.\n",
>     $rec{'OrgID'},
>     $rec{'OrgName'},
>     $rec{'RegDate'}
> );
>
> Which would print:
>
> OrgID ELIX was registered to Electric Lightwave Inc on 1999-01-19.
>
> I could put an alpha version of Net::Whois::ARIN on the CPAN if anyone is
> interested in playing with this interface.
>
> Regards,
> Todd
>
>




More information about the Dbwg mailing list