@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs); if (qName.equals("property")) { this.kind = Kind.fromValue(attributes.get("kind")); this.name = attributes.get("name"); this.unit = attributes.get("unit"); if (attributes.containsKey("value")) { this.value = stringOrNumber(attributes.get("value")); } } else if (qName.equals("param")) { this.param = new HardwareParameter( URI.create(attributes.get("href")), attributes.get("method"), attributes.get("name"), attributes.get("operation")); } else if (qName.equals("range")) { this.first = parseNumberOrNull(attributes.get("first")); this.last = parseNumberOrNull(attributes.get("last")); } else if (qName.equals("entry")) { this.availableValues.add(stringOrNumber(attributes.get("value"))); } }
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs); if (equalsOrSuffix(qName, "Children")) { inChildren = true; } else if (equalsOrSuffix(qName, "Tasks")) { inTasks = true; } else if (equalsOrSuffix(qName, "NetworkSection")) { inNetworkSection = true; } if (inChildren) { vmHandler.startElement(uri, localName, qName, attrs); } else if (inTasks) { taskHandler.startElement(uri, localName, qName, attrs); } else if (inNetworkSection) { networkSectionHandler.startElement(uri, localName, qName, attrs); } else if (equalsOrSuffix(qName, "VAppTemplate")) { template = newReferenceType(attributes); if (attributes.containsKey("status")) this.status = Status.fromValue(Integer.parseInt(attributes.get("status"))); } else if (equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) { vdc = newReferenceType(attributes); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs); depth++; if (depth == 2) { if (equalsOrSuffix(qName, "DiskSection")) { inDisk = true; } else if (equalsOrSuffix(qName, "NetworkSection")) { inNetwork = true; } else if (equalsOrSuffix(qName, "VirtualSystem")) { inVirtualSystem = true; } else if (extensionHandlers.containsKey(qName) || attributes.containsKey("type") && extensionHandlers.containsKey(attributes.get("type"))) { inExtensionSection = true; extensionHandler = extensionHandlers.get(qName).get(); } else if (qName.endsWith("Section")) { inSection = true; } } if (inDisk) { diskHandler.startElement(uri, localName, qName, attrs); } else if (inNetwork) { networkHandler.startElement(uri, localName, qName, attrs); } else if (inVirtualSystem) { virtualSystemHandler.startElement(uri, localName, qName, attrs); } else if (inExtensionSection) { extensionHandler.startElement(uri, localName, qName, attrs); } else if (inSection) { defaultSectionHandler.startElement(uri, localName, qName, attrs); } }
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs); if (SaxUtils.equalsOrSuffix(qName, "Catalog")) { catalog = newReferenceType(attributes, VCloudMediaType.CATALOG_XML); } else if (SaxUtils.equalsOrSuffix(qName, "CatalogItem")) { putReferenceType(contents, attributes); } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) { org = newReferenceType(attributes); } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "add".equals(attributes.get("rel"))) { readOnly = false; } else { taskHandler.startElement(uri, localName, qName, attrs); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) { Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs); if (equalsOrSuffix(qName, "Network")) { networkBuilder.name(attributes.get("name")); } }