Tree PREV CLASS NEXT CLASS SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD com.ibm.portal.streaming.json.xml
Interface JsonSchema
- All Known Implementing Classes:
- DefaultJsonSchema
public interface JsonSchemaCallback that is used during the conversion from XML to JSON to query information about the structure of the XML document. This information can lead to a simplified JSON representation. Note that these methods will only be called if the XML document itself does not already contain enough information (e.g. via xsi:type attributes).
- Since:
- 7.0.0.2
Nested Class Summary static class JsonSchema.CARDINALITY
Enumeration to identifiy the cardinality of an elementstatic class JsonSchema.TYPE
Enumeration that identifies the data type of a member
Method Summary javax.xml.namespace.QName getAssociationKey(java.lang.String uri, java.lang.String localName)
Return the key for an association if the cardinality is an assication.java.lang.String getAttributeMemberName(java.lang.String uri, java.lang.String localName, java.lang.String qName)
Return the name of the JSON member for an XML attribute.JsonSchema.TYPE getAttributeType(java.lang.String elementUri, java.lang.String elementLocalName, java.lang.String attrUri, java.lang.String attrLocalName)
Return the type of an element.JsonSchema.CARDINALITY getCardinality(java.lang.String uri, java.lang.String localName)
Return the cardinality of an item.java.lang.String getElementMemberName(java.lang.String uri, java.lang.String localName, java.lang.String qName)
Return the name of the JSON member for an XML element.JsonSchema.TYPE getElementType(java.lang.String uri, java.lang.String localName)
Return the type of an element.java.lang.String getTextMemberName(java.lang.Integer idx)
Return the name of the JSON member for textual content.JsonSchema.TYPE getType(java.lang.String uri, java.lang.String localName)
Return the type based on a type identifier.java.lang.String getValue(java.lang.String uri, java.lang.String localName, JsonSchema.TYPE type, org.xml.sax.Attributes attr)
Return the value of the element for a given type.
Method Detail getAssociationKey
javax.xml.namespace.QName getAssociationKey(java.lang.String uri, java.lang.String localName)
- Returns the key for an association if the cardinality is an assication. Consider the QName constants defined in com.ibm.portal.resolver.xml.Constants. If the method returns null the json mapping assumes that the attribute xml:id exists and identifies the key.
- Parameters:
- uri - URI of the element
- localName - local name of the element
- Returns:
- the QName for the key, may be null
getAttributeMemberName
java.lang.String getAttributeMemberName(java.lang.String uri, java.lang.String localName, java.lang.String qName)
- Returns the name of the JSON member for an XML attribute. If the method returns null the member name will per default be mapped to the qname prefixed by the '@' character.
- Parameters:
- uri - the URI
- localName - the local name
- qName - the qname
- Returns:
- the name of the JSON member or null
getAttributeType
JsonSchema.TYPE getAttributeType(java.lang.String elementUri, java.lang.String elementLocalName, java.lang.String attrUri, java.lang.String attrLocalName)
- Returns the type of an element.
- Parameters:
- elementUri - the URI of the element
- elementLocalName - the local name of the element
- attrUri - the URI of the attribute
- attrLocalName - the local name of the attribute
- Returns:
- the data type of the element or null if not known
getCardinality
JsonSchema.CARDINALITY getCardinality(java.lang.String uri, java.lang.String localName)
- Returns the cardinality of an item. If the method returns null the json mapping assume a sequence.
- Parameters:
- uri - URI of the element
- localName - local name of the element
- Returns:
- the cardinality or null
getElementMemberName
java.lang.String getElementMemberName(java.lang.String uri, java.lang.String localName, java.lang.String qName)
- Returns the name of the JSON member for an XML element. If the method returns null, the member name will per default be mapped to the qname
- Parameters:
- uri - the URI
- localName - the local name
- qName - the qname
- Returns:
- the name of the JSON member or null
getElementType
JsonSchema.TYPE getElementType(java.lang.String uri, java.lang.String localName)
- Returns the type of an element.
- Parameters:
- uri - the URI of the element
- localName - the local name of the element
- Returns:
- the data type of the element or null if not known
getTextMemberName
java.lang.String getTextMemberName(java.lang.Integer idx)
- Returns the name of the JSON member for textual content. If multiple text sequences occur that are interruped by an element, each occurrence needs to get its own name. The index counts these occurrences. If the method returns null the name of the first occurrence will be '$t', of the next '$u' and so on.
- Parameters:
- idx - zero based index of the occurrence, not null
- Returns:
- the name of the JSON member or null
getType
JsonSchema.TYPE getType(java.lang.String uri, java.lang.String localName)
- Returns the type based on a type identifier. Typically this is the value of the xsi:type attribute. If the method returns null the json mapping assumes string.
- Parameters:
- uri - the URI of the type
- localName - the local name of the type
- Returns:
- the data type of the element or null if not known
getValue
java.lang.String getValue(java.lang.String uri, java.lang.String localName, JsonSchema.TYPE type, org.xml.sax.Attributes attr)
- Returns the value of the element for a given type. If the method returns null the json mapping assumes that the value is stored as CDATA of the element.
- Parameters:
- uri - URI of the element
- localName - local name of the element
- type - type of the element as determined by #getElementType(String, String, Attributes) or getType(String, String).
- attr - the attributes
- Returns:
- the string value or null to fall back to CDATA
Tree PREV CLASS NEXT CLASS SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD