Klasse DIDLParser
This parser requires Android platform level 8 (2.2).
Override the createDescMetaHandler(org.jupnp.support.model.DescMeta, org.jupnp.xml.SAXParser.Handler)
method to read vendor extension content of <desc> elements. You then should also override the
populateDescMetadata(org.w3c.dom.Element, org.jupnp.support.model.DescMeta) method for writing.
Override the createItemHandler(org.jupnp.support.model.item.Item, org.jupnp.xml.SAXParser.Handler)
etc. methods to register custom handlers for vendor-specific elements and attributes within items, containers,
and so on.
- Autor:
- Christian Bauer, Mario Franco, Amit Kumar Mondal - Code Refactoring
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungclassstatic classExtracts anorg.w3c.Documentfrom the nested elements in the<desc>element.classDIDLParser.DIDLObjectHandler<I extends DIDLObject>classprotected static classclassVon Klasse geerbte verschachtelte Klassen/Schnittstellen org.jupnp.xml.SAXParser
SAXParser.Handler<I>, SAXParser.SimpleErrorHandler -
Feldübersicht
FelderVon Klasse geerbte Felder org.jupnp.xml.SAXParser
XML_SCHEMA_NAMESPACE, XML_SCHEMA_RESOURCE -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected voidappendClass(Document descriptor, Element parent, DIDLObject.Class clazz, String element, boolean appendDerivation) protected voidappendProperties(Document descriptor, Element parent, DIDLObject object, String prefix, Class<? extends DIDLObject.Property.NAMESPACE> namespace, String namespaceURI) protected StringbooleanToInt(boolean b) protected DocumentbuildDOM(DIDLContent content, boolean nestedItems) protected ContainercreateContainer(Attributes attributes) protected DIDLParser.ContainerHandlercreateContainerHandler(Container instance, SAXParser.Handler<?> parent) protected DescMeta<?> createDescMeta(Attributes attributes) protected DIDLParser.DescMetaHandlercreateDescMetaHandler(DescMeta<?> instance, SAXParser.Handler<?> parent) protected ItemcreateItem(Attributes attributes) protected DIDLParser.ItemHandlercreateItemHandler(Item instance, SAXParser.Handler<?> parent) protected DIDLParser.ResHandlercreateResHandler(Res instance, SAXParser.Handler<?> parent) protected RescreateResource(Attributes attributes) protected DIDLParser.RootHandlercreateRootHandler(DIDLContent instance, SAXParser parser) voidLogs the given string at debug log level if enabled.protected StringdocumentToString(Document document, boolean omitProlog) generate(DIDLContent content) Generates a XML representation of the content model.generate(DIDLContent content, boolean nestedItems) Generates an XML representation of the content model.protected voidgenerateContainer(Container container, Document descriptor, Element parent, boolean nestedItems) protected voidgenerateDescMetadata(DescMeta<?> descMeta, Document descriptor, Element parent) protected voidgenerateItem(Item item, Document descriptor, Element parent) protected voidgenerateResource(Res resource, Document descriptor, Element parent) protected voidgenerateRoot(DIDLContent content, Document descriptor, boolean nestedItems) Reads and unmarshalls an XML representation into a DIDL content model.parseResource(String resource) Uses the current thread's context classloader to read and unmarshall the given resource.protected voidpopulateDescMetadata(Element descElement, DescMeta<?> descMeta) Expects anorg.w3c.Documentas metadata, copies nodes of the document into the DIDL content.Von Klasse geerbte Methoden org.jupnp.xml.SAXParser
create, createSchema, getErrorHandler, getSchemaSources, parse, setContentHandler
-
Felddetails
-
UNKNOWN_TITLE
- Siehe auch:
-
-
Konstruktordetails
-
DIDLParser
public DIDLParser()
-
-
Methodendetails
-
parseResource
Uses the current thread's context classloader to read and unmarshall the given resource.- Parameter:
resource- The resource on the classpath.- Gibt zurück:
- The unmarshalled DIDL content model.
- Löst aus:
Exception
-
parse
Reads and unmarshalls an XML representation into a DIDL content model.- Parameter:
xml- The XML representation.- Gibt zurück:
- A DIDL content model.
- Löst aus:
Exception
-
createRootHandler
-
createContainerHandler
protected DIDLParser.ContainerHandler createContainerHandler(Container instance, SAXParser.Handler<?> parent) -
createItemHandler
-
createResHandler
-
createDescMetaHandler
protected DIDLParser.DescMetaHandler createDescMetaHandler(DescMeta<?> instance, SAXParser.Handler<?> parent) -
createContainer
-
createItem
-
createResource
-
createDescMeta
-
generate
Generates a XML representation of the content model.Items inside a container will not be represented in the XML, the containers will be rendered flat without children.
- Parameter:
content- The content model.- Gibt zurück:
- An XML representation.
- Löst aus:
Exception
-
generate
Generates an XML representation of the content model.Optionally, items inside a container will be represented in the XML, the container elements then have nested item elements. Although this parser can read such a structure, it is unclear whether other DIDL parsers should and actually do support this XML.
- Parameter:
content- The content model.nestedItems-trueif nested item elements should be rendered for containers.- Gibt zurück:
- An XML representation.
- Löst aus:
Exception
-
documentToString
- Löst aus:
Exception
-
buildDOM
- Löst aus:
Exception
-
generateRoot
-
generateContainer
-
generateItem
-
generateResource
-
generateDescMetadata
-
populateDescMetadata
Expects anorg.w3c.Documentas metadata, copies nodes of the document into the DIDL content.This method will ignore the content and log a warning if it's of the wrong type. If you override
createDescMetaHandler(org.jupnp.support.model.DescMeta, org.jupnp.xml.SAXParser.Handler), you most likely also want to override this method.- Parameter:
descElement- The DIDL content<desc>element wrapping the final metadata.descMeta- The metadata with aorg.w3c.Documentpayload.
-
appendProperties
protected void appendProperties(Document descriptor, Element parent, DIDLObject object, String prefix, Class<? extends DIDLObject.Property.NAMESPACE> namespace, String namespaceURI) -
appendClass
protected void appendClass(Document descriptor, Element parent, DIDLObject.Class clazz, String element, boolean appendDerivation) -
booleanToInt
-
debugXML
Logs the given string at debug log level if enabled.- Parameter:
s- The string to send to the log.
-