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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |