In This Topic
package MusicStoreLib;
public final class ClassFactory {
private static java.util.Map<String, java.util.Map<String, Class<? extends com.liquid_technologies.ltxmllib20.XmlObjectBase>>> _nsMap = null;
static {
_nsMap = new java.util.HashMap<String, java.util.Map<String, Class<? extends com.liquid_technologies.ltxmllib20.XmlObjectBase>>>();
java.util.Map<String, Class<? extends com.liquid_technologies.ltxmllib20.XmlObjectBase>> itemMap = null;
itemMap = new java.util.HashMap<String, Class<? extends com.liquid_technologies.ltxmllib20.XmlObjectBase>>();
itemMap.put("AlbumType", MusicStoreLib.AlbumType.class);
itemMap.put("Error", MusicStoreLib.Error.class);
itemMap.put("PriceFilter", MusicStoreLib.PriceFilter.class);
itemMap.put("Result", MusicStoreLib.Result.class);
itemMap.put("SearchRequest", MusicStoreLib.SearchRequest.class);
itemMap.put("SearchResponse", MusicStoreLib.SearchResponse.class);
itemMap.put("TrackType", MusicStoreLib.TrackType.class);
_nsMap.put("", itemMap);
}
public static com.liquid_technologies.ltxmllib20.XmlObjectBase fromXml(String xmlIn)
throws com.liquid_technologies.ltxmllib20.exceptions.LtException, java.io.IOException {
return fromXml( xmlIn, com.liquid_technologies.ltxmllib20.SerializationContext.Default );
}
public static com.liquid_technologies.ltxmllib20.XmlObjectBase fromXml(String xmlIn, com.liquid_technologies.ltxmllib20.SerializationContext context)
throws com.liquid_technologies.ltxmllib20.exceptions.LtException, java.io.IOException {
com.liquid_technologies.ltxmllib20.dom.XmlDocument parser = new com.liquid_technologies.ltxmllib20.dom.XmlDocument();
parser.parse(new java.io.ByteArrayInputStream(xmlIn.getBytes()), context);
return fromXmlElement(parser.getDocumentElement(), context);
}
public static com.liquid_technologies.ltxmllib20.XmlObjectBase fromXmlFile(String FileName)
throws com.liquid_technologies.ltxmllib20.exceptions.LtException, java.io.IOException {
return fromXmlFile(FileName, com.liquid_technologies.ltxmllib20.SerializationContext.Default);
}
public static com.liquid_technologies.ltxmllib20.XmlObjectBase fromXmlFile(String FileName, com.liquid_technologies.ltxmllib20.SerializationContext context)
throws com.liquid_technologies.ltxmllib20.exceptions.LtException, java.io.IOException {
com.liquid_technologies.ltxmllib20.dom.XmlDocument parser = new com.liquid_technologies.ltxmllib20.dom.XmlDocument();
parser.parse(FileName, context);
return fromXmlElement(parser.getDocumentElement(), context);
}
public static com.liquid_technologies.ltxmllib20.XmlObjectBase fromXmlStream(byte[] data)
throws com.liquid_technologies.ltxmllib20.exceptions.LtException, java.io.IOException {
return fromXmlStream(data, com.liquid_technologies.ltxmllib20.SerializationContext.Default);
}
public static com.liquid_technologies.ltxmllib20.XmlObjectBase fromXmlStream(byte[] data, com.liquid_technologies.ltxmllib20.SerializationContext context)
throws com.liquid_technologies.ltxmllib20.exceptions.LtException, java.io.IOException {
com.liquid_technologies.ltxmllib20.dom.XmlDocument parser = new com.liquid_technologies.ltxmllib20.dom.XmlDocument();
java.io.ByteArrayInputStream baStream = new java.io.ByteArrayInputStream(data);
parser.parse(baStream, context);
return fromXmlElement(parser.getDocumentElement(), context);
}
public static com.liquid_technologies.ltxmllib20.XmlObjectBase fromXmlElement(com.liquid_technologies.ltxmllib20.dom.XmlElement xmlParent)
throws com.liquid_technologies.ltxmllib20.exceptions.LtException, java.io.IOException {
return fromXmlElement(xmlParent, com.liquid_technologies.ltxmllib20.SerializationContext.Default);
}
public static com.liquid_technologies.ltxmllib20.XmlObjectBase fromXmlElement(com.liquid_technologies.ltxmllib20.dom.XmlElement xmlParent, com.liquid_technologies.ltxmllib20.SerializationContext context)
throws com.liquid_technologies.ltxmllib20.exceptions.LtException, java.io.IOException {
com.liquid_technologies.ltxmllib20.XmlObjectBase retVal = null;
String elementName;
String elementNamespaceUri;
elementName = com.liquid_technologies.ltxmllib20.ClassFactoryHelper.getElementType(xmlParent);
if (elementName.length() == 0) {
elementName = xmlParent.getLocalName();
elementNamespaceUri = xmlParent.getNamespaceURI();
} else {
elementNamespaceUri = com.liquid_technologies.ltxmllib20.ClassFactoryHelper.getElementTypeNamespaceUri(xmlParent);
}
retVal = com.liquid_technologies.ltxmllib20.ClassFactoryHelper.createObject(_nsMap, elementName, elementNamespaceUri, context);
if (retVal == null) {
throw new com.liquid_technologies.ltxmllib20.exceptions.LtException("Failed load the element " + elementName + ":" + elementNamespaceUri + ". No appropriate class exists to load the data into. Ensure that the XML document complies with the schema.");
}
retVal.fromXmlElement(xmlParent, context);
return retVal;
}
}