[erlang-questions] Can anyone help with this irksome erlsom problem?
Alan Evans
alanrevans@REDACTED
Thu Apr 19 11:15:05 CEST 2018
Hello Erlang experts,
I'm having a problem trying to parse some XML using the excellent
erlsom tool, I don't know if it's me, erlsom, XML, XSD or something else
that's giving me issues.
The XML I'm trying to parse looks like this and the problem I have is
with the xsi:type attribute on the Value element, oh and by the way, I
can't change the XML as it coming from a 3rd party.
<soap:Envelope xmlns:cwmp="urn:dslforum-org:cwmp-1-0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/">
<soap:Header>
<cwmp:ID soap:mustUnderstand="1">1410271757429_7070_2008420083</cwmp:ID>
</soap:Header>
<soap:Body>
<cwmp:SetParameterValues>
<ParameterList soap-enc:arrayType="cwmp:ParameterValueStruct[1]">
<ParameterValueStruct>
<Name>Device.ManagementServer.URL</Name>
<Value xsi:type="xsd:string">http://10.255.249.122/acs</Value>
</ParameterValueStruct>
</ParameterList>
<ParameterKey>1155965801</ParameterKey>
</cwmp:SetParameterValues>
</soap:Body>
</soap:Envelope>
The error I get is:
34> erlsom:scan_file(Xml, ModelIn).
{error,[{exception,{error,"Type not found in hierarchy: in:ValueElement"}},
{stack,['in:ParameterValueStruct','in:ParameterValueList',
'in:SetParameterValues','P:Body','P:Envelope']},
{received,{startElement,[],"Value",[],
[{attribute,"type","xsi",
"http://www.w3.org/2001/XMLSchema-instance",
"xsd:string"}]}}]}
The XSD I'm using is here: https://pastebin.com/VrBx0j0f
It is based of the the standard TR069 XSD but I had to modify it to make
the Value element a complexType in order to add the attribute.
Value was defined as
<xs:element name="Value" type="xs:anySimpleType"/>
and is now defined as
<xs:complexType name="ValueElement">
<xs:simpleContent>
<xs:extension base="xs:anySimpleType">
<xs:attribute name="xsi:type" type="xs:string">
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
A session showing the problem is here: https://pastebin.com/APSLK4ry
Many thanks for reading this far.
Thanks
Alan
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180419/9ce9a436/attachment.htm>
More information about the erlang-questions
mailing list