[erlang-questions] RPC from linkedin driver

Torbjorn Tornkvist <>
Sun Apr 5 10:22:59 CEST 2009


Bertil Karlsson wrote:
> Works fine for me. Maybe I didn't got your failed case exactly. I 
> changed namespaces. My examples (with your content) below.

You're right! Sorry, it was a slight typo in my code that my
aging eyes didn't catch (xmlms vs xmlns).
Just for reference, here is my complete and working example:

--- n.xsd ---
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
 Dev.info: {E,_} = xmerl_scan:file("n.xml").
           {ok,S} = xmerl_xsd:process_schema("n.xsd").
           {E2,_} = xmerl_xsd:validate(E,S).
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	    targetNamespace="blaha"
	    xmlns="blaha"
	    elementFormDefault="qualified"
	    attributeFormDefault="unqualified">

  <xsd:complexType name="tLabel">
      <xsd:attribute name="text" type="xsd:string" use="required" />
  </xsd:complexType>

  <xsd:element name="label" type="tLabel" />

</xsd:schema>

--- n.xml ---
<?xml version="1.0" encoding="ISO-8859-1" ?>
<n:label xmlns:n="blaha" text="Name"/>


Thanx, Tobbe





> 
> mytest2.xsd
> <xsd:schema
>     targetNamespace="blaha"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 
>   <xsd:element name="label">
>     <xsd:complexType>
>       <xsd:attribute name="text" type="xsd:string" use="required" />
>     </xsd:complexType>
>   </xsd:element>
> </xsd:schema>
> 
> mytest3.xsd
> <xsd:schema
>     targetNamespace="blaha"
>     xmlns:b = "blaha"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 
>   <xsd:complexType name="tLabel">
>     <xsd:attribute name="text" type="xsd:string" use="required" />
>   </xsd:complexType>
> 
>   <xsd:element name="label" type="b:tLabel" />
> </xsd:schema>
> 
> and
> 1> {E,_}=xmerl_scan:string("<n:label xmlns:n=\"blaha\" text=\"Name\"/>",[]).
> 2> {ok,S2} = xmerl_xsd:process_schema("mytest2.xsd").
> 3> xmerl_xsd:validate(E,S2).
> 4> {ok,S3} = xmerl_xsd:process_schema("mytest3.xsd").
> 5> xmerl_xsd:validate(E,S3).
> 
> all working as expected.
> 
> /Bertil
> 
> Torbjorn Tornkvist wrote:
>> Kenneth Lundin <> writes:
>>
>>   
>>> We are working on significant performance improvements and new API's for
>>> XMERL.
>>>     
>> Hm...talking about xmerl. It seems like xmerl's xsd functionality
>> doesn't like when you break out, e.g a complexType declaration from
>> where it is referred to.
>>
>> So validating this: <n:label xmlns:n="blaha" text="Name"/>
>>
>> With:
>>
>>   <xsd:element name="label"> 
>>     <xsd:complexType>
>>       <xsd:attribute name="text" type="xsd:string" use="required" />
>>     </xsd:complexType>
>>   </xsd:element>
>>
>> is fine, but with this:
>>
>>   <xsd:complexType name="tLabel">
>>       <xsd:attribute name="text" type="xsd:string" use="required" />
>>   </xsd:complexType>
>>
>>   <xsd:element name="label" type="tLabel" />
>>
>> I get:
>>
>> {error,[{[],xmerl_xsd,
>>          {reference_undeclared,simpleType,
>>                                {simpleType,{tLabel,[],[]}}}}]}
>>
>>
>> ? Tobbe
>>
>>
>>   
>>> The new XMERL will be at least 4 times faster than the current
>>> version. The base for this is a completely new
>>> SAX parser that you also can use directly with new API's.
>>>
>>> The memory consumption will also be significantly reduced.
>>>
>>> /Kenneth Erlang/OTP Ericsson
>>>
>>> On Tue, Mar 31, 2009 at 8:13 PM, Yogish Baliga <> wrote:
>>>     
>>>> I am currently working on developing a linkedin driver (c language) for XML parser (xmerl is too slow). This is a SAX parser is given the following input:
>>>>
>>>> 1. XML to be parsed
>>>> 2. Call back functions (MFA) for start of node, end of node and for text elements
>>>>
>>>> I found C APIs to do RPC calls from c-node (ei_rpc). This require ei_cnode and fd parameters. That means I need to run the port as a c-node.
>>>>
>>>> Is it possible to do RPC from linkedin driver without converting linkedin driver as a c-node?
>>>>
>>>> Thanx,
>>>> -- baliga
>>>>
>>>>
>>>> "The quality of programmers is a decreasing function of the density of GOTO statements in the programs they produce." - Edsger W. Dijkstra
>>>>
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> 
>>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>>       
>>   
> 




More information about the erlang-questions mailing list