Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nonstandard syntax in service description XML file
21-01-2013, 02:57 PM
Post: #1
Nonstandard syntax in service description XML file
In an older level of ohNet, OhNetGen.exe accepted service description XML files with the standard syntax defined by the UPnP Device Architecture specification. This included state variable definitions like this:

<stateVariable sendEvents="yes">
<name>AllContextStatus</name>
<dataType>string</dataType>
</stateVariable>

Something has changed in the last few months, which means I now need to use the following nonstandard syntax:

<stateVariable>
<name>AllContextStatus</name>
<sendEventsAttribute>yes</sendEventsAttribute>
<dataType>string</dataType>
</stateVariable>

Another effect of this change is that the <scpd> tag must now be written as:

<scpd>

instead of (as required by the UPnP Device Architecture specification):

<scpd xmlns="urn:schemas-upnp-org:service-1-0">

What has changed, and why?
Find all posts by this user
21-01-2013, 04:42 PM
Post: #2
RE: Nonstandard syntax in service description XML file
I don't remember changing anything and can't see any differences in the code. Can you post an self-contained example that demonstrates your problem please? This should ideally contain
  • An XML file, plus note of where it should be copied to
  • The command line you use to generate your proxy or provider
  • Any error that is displayed. Or, if no error is displayed, how you determined that code generation had failed

In case you're interested, the code that toggles between the two different formats we accept as service XML is in OpenHome/Net/T4/UpnpServiceXml/UpnpServiceXml.cs in the Document constructor. This code is called from the new Document(... line near the start of all the *Upnp*.tt templates.
Find all posts by this user
21-01-2013, 05:28 PM
Post: #3
RE: Nonstandard syntax in service description XML file
(21-01-2013 04:42 PM)simonc Wrote:  In case you're interested, the code that toggles between the two different formats we accept as service XML is in OpenHome/Net/T4/UpnpServiceXml/UpnpServiceXml.cs in the Document constructor. This code is called from the new Document(... line near the start of all the *Upnp*.tt templates.

Thanks for the pointer. From this, I've identified the cause of the problem. The file that was failing had a mixture of syntax from the two alternative XML schemas.

When I get a failure like this, there is never any error message. The only indication that the XML file had a problem is the lack of any generated output. It would be very helpful to get an error message pointing me to the line that contains the mistake.
Find all posts by this user
21-01-2013, 05:34 PM
Post: #4
RE: Nonstandard syntax in service description XML file
(21-01-2013 05:28 PM)simoncn Wrote:  Thanks for the pointer. From this, I've identified the cause of the problem. The file that was failing had a mixture of syntax from the two alternative XML schemas.

Glad you've pinpointed the cause. Are you able to handle things without ohNet changes now? Or, if the problem file came from the UPnP forum, do you want me to add an extra schema option to ohNet?

(21-01-2013 05:28 PM)simoncn Wrote:  When I get a failure like this, there is never any error message. The only indication that the XML file had a problem is the lack of any generated output. It would be very helpful to get an error message pointing me to the line that contains the mistake.

Fair point. I've added a task to the backlog to improve (add some!) output from ohNetGen.
Find all posts by this user
21-01-2013, 05:51 PM
Post: #5
RE: Nonstandard syntax in service description XML file
(21-01-2013 05:34 PM)simonc Wrote:  Glad you've pinpointed the cause. Are you able to handle things without ohNet changes now? Or, if the problem file came from the UPnP forum, do you want me to add an extra schema option to ohNet?

It was my own service definition, so no change to ohNet is needed. Thanks!
Find all posts by this user


Forum Jump: