| Author |
Message |
< Erlang ~ xmerl_xsd:process_schema |
| kenrobinson |
Posted: Mon Apr 20, 2009 2:12 pm |
|
|
|
User
Joined: 20 Apr 2009
Posts: 12
|
Hello everyone.
Please forgive any lapse in etiquette in my first post to this forum.
I am trying to validate some xml documents. The schema is written in relaxNG notation. As erlang does not have (to the best of my knowledge) an xml parser which takes a relaxNG schema I have converted it to xsd format using trang.
I run in the following code in the REPL:
{ok, S} = xmerl_xsd:process_schema("xsd/jaus.xsd").
I then get the following error:
Error in process <0.31.0> with exit value: {{badmatch,{error,[{[],xmerl_xsd,{type_not_uniquely_defined_in_schema,{'_xmerl_no_name_',['_xmerl_no_name_',space],[]}}},{[],xmerl_xsd,{type_not_uniquely_defined_in_schema,{'_xmerl_no_name_',['_xmerl_no_name_',space],[]}}},{...
** exited: {{badmatch,
{error,
[{[],
xmerl_xsd,
{type_not_uniquely_defined_in_schema,
{'_xmerl_no_name_',['_xmerl_no_name_',space],[]}}},
{[],
xmerl_xsd,
{type_not_uniquely_defined_in_schema,
{'_xmerl_no_name_',['_xmerl_no_name_',space],[]}}},
{[],
xmerl_xsd,
{type_not_uniquely_defined_in_schema,
{'_xmerl_no_name_',
['_xmerl_no_name_',space],
[]}}}]}},
[{erl_eval,expr,3}]} **
5>
I see the attribute space defined in xml.xsd which is referred to in jaus.xsd. Is there some basic thing that I am missing. The xml.xsd and jaus.xsd files are below.
regards,
Ken.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:ns1="urn:jaus:jsidl:1.0">
<xs:import namespace="urn:jaus:jsidl:1.0" schemaLocation="jaus.xsd"/>
<xs:attribute name="space">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="default"/>
<xs:enumeration value="preserve"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<!--
JAUS Service Interface Definition Language (JSIDLv1.0)
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:jaus:jsidl:1.0" xmlns:ns1="urn:jaus:jsidl:1.0">
<xs:include schemaLocation="protocol_behavior.xsd"/>
<xs:include schemaLocation="message_set.xsd"/>
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
<xs:element name="service_def">
<xs:complexType>
<xs:sequence>
<xs:element ref="ns1:description"/>
<xs:element ref="ns1:assumptions"/>
<xs:element minOccurs="0" ref="ns1:references"/>
<xs:element minOccurs="0" ref="ns1:declared_const_set"/>
<xs:element minOccurs="0" ref="ns1:declared_type_set"/>
<xs:element ref="ns1:message_set"/>
<xs:element ref="ns1:internal_events_set"/>
<xs:element ref="ns1:protocol_behavior"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="ns1:identifier"/>
<xs:attribute name="id" use="required" type="xs:anyURI"/>
<xs:attribute name="version" use="required" type="ns1:version_num"/>
</xs:complexType>
</xs:element>
<xs:element name="description">
<xs:complexType mixed="true">
<xs:attribute ref="xml:space"/>
</xs:complexType>
</xs:element>
<xs:element name="assumptions">
<xs:complexType mixed="true">
<xs:attribute ref="xml:space"/>
</xs:complexType>
</xs:element>
<xs:element name="references">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="ns1:inherits_from"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="ns1:client_of"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="inherits_from">
<xs:complexType>
<xs:attributeGroup ref="ns1:ref_attr"/>
</xs:complexType>
</xs:element>
<xs:element name="client_of">
<xs:complexType>
<xs:attributeGroup ref="ns1:ref_attr"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="ref_attr">
<xs:attribute name="name" use="required" type="ns1:identifier"/>
<xs:attribute name="id" use="required" type="xs:anyURI"/>
<xs:attribute name="version" use="required" type="ns1:version_num_ref"/>
<xs:attribute name="interpretation"/>
</xs:attributeGroup>
</xs:schema>
Ken. |
|
|
| Back to top |
|
| kenrobinson |
Posted: Mon Apr 27, 2009 2:16 am |
|
|
|
User
Joined: 20 Apr 2009
Posts: 12
|
Hi Everyone,
As a sanity check I went to a Windows machine and tried the generated schema using Altova XML Spy. It stated jaus.xsd and it associated file were valid. What are the things that xmerl cannot do? |
|
|
| Back to top |
|
| kenrobinson |
Posted: Thu Apr 30, 2009 2:15 pm |
|
|
|
User
Joined: 20 Apr 2009
Posts: 12
|
Hi All,
I tried specifying the directories to search for on the option list, otherwise it would try the uri. I now get a new error. I've listed my present directory. I then run the command. Any ideas?
8> ls().
#testjaus.xsd# jaus.xsd jaus.xsd~
jaus_xsd.beam jaus_xsd.erl jaus_xsd.erl~
message_set.xsd patterns.xsd protocol_behavior.xsd
testjaus.xsd xml.xsd
ok
9> xmerl_xsd:process_schema("jaus.xsd", [{fetch_path, "./"}]).
** exception error: no function clause matching
filename:join(46,"protocol_behavior.xsd")
in function xmerl_xsd:path_locate/3
in call from xmerl_xsd:fetch/2
in call from xmerl_xsd:fetch_external_schema/2
in call from xmerl_xsd:process_external_schema_once/3
in call from xmerl_xsd:element_content/3
in call from xmerl_xsd:traverse_content2/3
in call from xmerl_xsd:validate_schema/2
10> |
|
|
| Back to top |
|
| seanmc |
Posted: Fri May 01, 2009 1:36 pm |
|
|
|
User
Joined: 03 Aug 2007
Posts: 10
|
Hi Ken,
I don't know much about these xml functions but I see the fetch_path option requires a list of paths, not just one.
ie, where you entered:
xmerl_xsd:process_schema("jaus.xsd", [{fetch_path, "./"}]).
it should have been:
xmerl_xsd:process_schema("jaus.xsd", [{fetch_path, ["./"]}]).
Sorry I can't contribute more, hope this much helps.
//Sean. |
|
|
| Back to top |
|
| kenrobinson |
Posted: Fri May 15, 2009 1:25 pm |
|
|
|
User
Joined: 20 Apr 2009
Posts: 12
|
Hi,
Unfortunately after correctly specifying the right paths to look at it came up with a similar to what I had at first:
...
['_xmerl_no_name_',space],[]}}},
{[],
xmerl_xsd,
{type_not_uniquely_defined_in_schema,
{'_xmerl_no_name_',
My solution to the problem doesn't solve it in erlang but in python. I discovered that there was a python/erlang interface called Twotp. python has a libxml bindings which have a relaxng schema validator. I plan now to test that the xml is valid in python and then continue using the xml in erlang.
It's a case of not fixing the problem but avoiding it. |
|
|
| Back to top |
|
| klaar |
Posted: Sun May 17, 2009 12:52 pm |
|
|
|
User
Joined: 06 Oct 2008
Posts: 11
Location: Göteborg/Sweden
|
Code: <xs:include schemaLocation="protocol_behavior.xsd"/>
<xs:include schemaLocation="message_set.xsd"/>
Tried to replicate your results, but you did not provide these files. Would you mind attaching a zip/tarball?  |
|
|
| Back to top |
|
| kenrobinson |
Posted: Sun May 17, 2009 1:41 pm |
|
|
|
User
Joined: 20 Apr 2009
Posts: 12
|
Hi klar,
Thanks for looking at this.
Attached is the xsd.tar.gz file containing all files required.
regards,
Ken. |
|
|
| Back to top |
|
| wuji |
Posted: Thu Aug 23, 2012 7:40 am |
|
|
|
User
Joined: 10 Aug 2012
Posts: 654
|
in the meat.In addition to the Minneapolis flight, a needle needle [h2]replica designer *beep*[/h2] needle was discovered by a teenage passenger aboard a Delta
from Amsterdam to Atlanta. The teen would not surrender the the cheap Ralph Lauren the needle to authorities, who noted he told them that
planned to use it as evidence in a lawsuit.In a a [h4]cheap replica *beep*[/h4] a federal report on the incidents, it was noted that
teen was the son of a passenger aboard the flight flight [h4]replica Christian Louboutin[/h4] flight to Minneapolis who also found a needle in his
needles were reported found on two other flights, one by by Cheap Ralph Lauren Shirts by a crew member and another by a federal air |
|
|
| Back to top |
|
| dongdongwu |
Posted: Thu Sep 20, 2012 2:15 am |
|
|
|
User
Joined: 19 Sep 2012
Posts: 236
|
His good friend Diane said: "Christian Louboutin Men Shoes was a magician, he make shoes is immediately put his female people with legs and advantage. He understands women wanted to do and can make them into beautiful Cinderella." Madonna often in its concert wearing Christian louboutin high heels , and some famous superstar like Angelina jolie, mariah Carey, beyonce Knowles, the famous Japanese singer YaYouMei Hamasaki helps Christian Louboutin Men Shoes set up its powerful position. The youngest customers will count Tom cruise's daughter sully cruz. Louboutin made for only a pair of handmade Christian Louboutin high heel Shoes! Want to be more fashion? Put on Christian Louboutin Outlet !
Candy colors of the chalaza high-heeled shoes with lolita type allure, set full finely gem blue "neon shoes" is to need to use "sexy" to describe. Each pair are worth careful appreciation of lithe and graceful fairy ludaoli, what kind of most let you move?Christian Louboutin Men Shoes that one brush red is always cannot resist the temptation, Christian Louboutin men outlet continue to use the days of high 8cm above slender heel proclaim the sexy and luxuriant. The bowknot on black pointed high-heeled shoes with sharp rivet concomitant, wild python met enchanting color printing grain, It is that pairs of high-heeled shoes lets Carrie more feminine flavour. Like Christian Louboutin for men her word. |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|