[SOLVED] xmlns:xsi and xsi:schemaLocation are valid xml ?

All questions about the GEXF (see http://gexf.net before)
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
paul
Posts:31
Joined:31 Mar 2010 08:44
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[SOLVED] xmlns:xsi and xsi:schemaLocation are valid xml ?

Post by paul » 02 Apr 2010 12:41

I am using the lxml 2.0 library in Ptyhon to generate gexf.
This library returns warning when declaring both attributes containing a semicolon :
/home/pom/trunk/gexf.py:33: TagNameWarning: Tag names must not contain ':', lxml 2.0 will enforce well-formed tag names as required by the XML specification.
gexfXML.set("xmlns:xsi",self.xsi)
/home/pom/trunk/gexf.py:34: TagNameWarning: Tag names must not contain ':', lxml 2.0 will enforce well-formed tag names as required by the XML specification.
gexfXML.set("xsi:schemaLocation",self.schemaLocation)
It's not a big deal since only a warning but it claims it not correct regarding XMl specification which I don't know.

Paul

admin
Gephi Community Manager
Posts:964
Joined:09 Dec 2009 14:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: xmlns:xsi and xsi:schemaLocation are valid xml ?

Post by admin » 02 Apr 2010 13:20

This is incredible, but I discovered that xsi:schemaLocation make the XML file invalid. You can browse the Web to find the exact reason of this issue, but it seems to be something the consortium who made the specifications have just...forgotten. Remove this line to hide this warning.

paul
Posts:31
Joined:31 Mar 2010 08:44
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: xmlns:xsi and xsi:schemaLocation are valid xml ?

Post by paul » 12 May 2010 11:34

Actually I just discovered the notion of namespace in xml.

For people using lxml and python here is hte right way to write the gexf tag :

Code: Select all

xmlns="http://www.gephi.org/gexf/1.1draft"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://www.gephi.org/gexf/1.1draft http://gephi.org/gexf/1.1draft.xsd"
viz="http://www.gexf.net/1.1draft/viz"
version="1.1"
gexfXML = etree.Element("{"+xmlns+"}gexf",version=version,nsmap={None:xmlns,'viz':viz,'xsi':xsi})
gexfXML.set("{xsi}schemaLocation",schemaLocation)
I am still working on a libgexf pure python. I will release it soon and post a topic in the forum.

P

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable