Hi everyone, I have a problem I just can't find a solution for. I really tried everything so i'm asking you. I have this login script which reads the user xml file looking for a match:

my $digestuser ="dado"; my $digestpass ="cane"; my $file="user.xml"; my $parser=XML::LibXML->new(); my $doc=$parser->parse_file($file); my $root = $doc->getDocumentElement; for my $u ($doc->findnodes('userlist/user')) { print "inside-cycle"; my $property=$u->findnodes('./username')->get_node(1); if(($property->textContent()) eq $digestuser){ print $userok; $property=$u->findnodes('./password')->get_node(1); if(($property->textContent()) eq $digestpass){ $passok=1; print "i did it"; } last; } }

Now the problem is: it works until i link the xml file to it's schema. I need to link it but for some reason it stops working. the xml schema is this

<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://tecnologie-web.studenti.math.unipd.it/tecweb/~gpinat +o" targetNamespace="http://tecnologie-web.studenti.math.unipd.it/tecw +eb/~gpinato" elementFormDefault="qualified"> <xs:element name="userlist"> <xs:complexType> <xs:sequence> <xs:element name="user" minOccurs="0" maxOccurs="unbounded +"> <xs:complexType> <xs:sequence> <xs:element name="username" type="xs:string" / +> <xs:element name="password" type="xs:string" / +> <xs:element name="email" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>

and my file is this

<?xml version="1.0" encoding="UTF-8"?> <userlist xmlns="http://www.progetto.com" xmlns:xs="http://www.w3.org/ +2001/XMLSchema-instance" xs:schemaLocation="http://www.progetto.com u +ser.xsd"> <user> <username>dado</username> <password>cane</password> <email>cane</email> </user></userlist>

with <userlist> it works, as soon as i add this thing here "xmlns="http://tecnologie-web.studenti.math.unipd.it/tecweb/~gpinato"" it stops. I really have lost days on this one but i cant find a solution. Can you PLEASE help me? i really don't know what to do anymore


In reply to Can't read xml after linking schema by njack

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.