YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.yxc.YxcDescriptionParser Class Reference

Reads the UPnP device description of a device and finds its YXC service. More...

Collaboration diagram for de.yaacc.yxc.YxcDescriptionParser:
Collaboration graph

Static Public Member Functions

static YxcDescriptionInfo parse (String xml)
 

Static Public Attributes

static final int MAX_DESCRIPTION_CHARS = 256 * 1024
 The longest description that is parsed; a caller that reads the document should stop reading at this size.
 
static final String YXC_SERVICE_TYPE = "urn:schemas-yamaha-com:service:X_YamahaExtendedControl:1"
 The service type that names the YXC service.
 

Detailed Description

Reads the UPnP device description of a device and finds its YXC service.

Verified on the owner's devices (2026-11-02): the YXC service is listed under <X_device> of the Yamaha namespace as a <X_service> with <X_specType>urn:schemas-yamaha-com:service:X_YamahaExtendedControl:1</X_specType>, <X_yxcControlURL> (a path) and <X_yxcVersion>; <X_URLBase> next to the service list is the host:port of the device. A device may also list an older service of another kind (X_controlURL, no X_yxcControlURL); that one is not a YXC service and is ignored, the YXC one beside it is found.

Parser choice: XmlPullParser. It is the parser the app already uses for UPnP documents on Android (the platform has it), and the unit tests have it on the classpath (kxml2 / xmlpull as test dependencies), whereas the Android stubs of android.util.Xml return null in unit tests. javax.xml.parsers exists on both, but the Android implementation does not support the hardening features (it rejects setFeature calls it does not know), so its XXE safety could not be tested on the JVM and relied upon on the phone.

Safety: a document with a document type declaration is refused before any parsing, so no entity and no external resource can be declared; the pull parser is also told not to process one. The text is capped (MAX_DESCRIPTION_CHARS), as are nesting depth and the length of each value; the control URL must be a plain path. Names are compared by their local part, so the prefix a device chooses does not matter, and a prefix that is not declared is not an error. A malformed document is "not a YXC device", never an exception.

Member Function Documentation

◆ parse()

static YxcDescriptionInfo de.yaacc.yxc.YxcDescriptionParser.parse ( String xml)
static
Parameters
xmlthe text of the description
Returns
the YXC service of the device, or null when the document is not a description of a device with a YXC service (also: too large, malformed, with a document type declaration)

The documentation for this class was generated from the following file: