List of usage examples for org.w3c.dom NamedNodeMap getNamedItem
public Node getNamedItem(String name);
From source file:com.l2jfree.gameserver.datatables.AugmentationData.java
@SuppressWarnings("unchecked") private final void load() { // Load the skillmap // Note: the skillmap data is only used when generating new augmentations // the client expects a different id in order to display the skill in the // items description... try {//from w ww. ja v a2s. c o m int badAugmantData = 0; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); factory.setIgnoringComments(true); File file = new File(Config.DATAPACK_ROOT + "/data/stats/augmentation/augmentation_skillmap.xml"); if (!file.exists()) { _log.warn("The augmentation skillmap file is missing."); return; } Document doc = factory.newDocumentBuilder().parse(file); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { if ("list".equalsIgnoreCase(n.getNodeName())) { for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("augmentation".equalsIgnoreCase(d.getNodeName())) { NamedNodeMap attrs = d.getAttributes(); int skillId = 0, augmentationId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue()); int skillLvL = 0; String type = "blue"; for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) { if ("skillId".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); skillId = Integer.parseInt(attrs.getNamedItem("val").getNodeValue()); } else if ("skillLevel".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); skillLvL = Integer.parseInt(attrs.getNamedItem("val").getNodeValue()); } else if ("type".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); type = attrs.getNamedItem("val").getNodeValue(); } } if (skillId == 0) { _log.warn("Bad skillId in augmentation_skillmap.xml in the augmentationId:" + augmentationId); badAugmantData++; continue; } else if (skillLvL == 0) { _log.warn("Bad skillLevel in augmentation_skillmap.xml in the augmentationId:" + augmentationId); badAugmantData++; continue; } int k = (augmentationId - BLUE_START) / SKILLS_BLOCKSIZE; if (type.equalsIgnoreCase("blue")) ((ArrayList<Integer>) _blueSkills[k]).add(augmentationId); else if (type.equalsIgnoreCase("purple")) ((ArrayList<Integer>) _purpleSkills[k]).add(augmentationId); else ((ArrayList<Integer>) _redSkills[k]).add(augmentationId); _allSkills.put(augmentationId, new augmentationSkill(skillId, skillLvL)); } } } } if (badAugmantData != 0) _log.info("AugmentationData: " + badAugmantData + " bad skill(s) were skipped."); } catch (Exception e) { _log.error("Error parsing augmentation_skillmap.xml.", e); return; } // Load the stats from xml for (int i = 1; i < 5; i++) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setIgnoringComments(true); File file = new File( Config.DATAPACK_ROOT + "/data/stats/augmentation/augmentation_stats" + i + ".xml"); if (!file.exists()) { _log.warn("The augmentation stat data file " + i + " is missing."); return; } Document doc = factory.newDocumentBuilder().parse(file); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { if ("list".equalsIgnoreCase(n.getNodeName())) { for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("stat".equalsIgnoreCase(d.getNodeName())) { NamedNodeMap attrs = d.getAttributes(); String statName = attrs.getNamedItem("name").getNodeValue(); float soloValues[] = null, combinedValues[] = null; for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) { if ("table".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); String tableName = attrs.getNamedItem("name").getNodeValue(); StringTokenizer data = new StringTokenizer( cd.getFirstChild().getNodeValue()); FastList<Float> array = new FastList<Float>(); while (data.hasMoreTokens()) array.add(Float.parseFloat(data.nextToken())); if (tableName.equalsIgnoreCase("#soloValues")) { soloValues = new float[array.size()]; int x = 0; for (float value : array) soloValues[x++] = value; } else { combinedValues = new float[array.size()]; int x = 0; for (float value : array) combinedValues[x++] = value; } } } // store this stat ((ArrayList<augmentationStat>) _augStats[(i - 1)]).add(new augmentationStat( Stats.valueOfXml(statName), soloValues, combinedValues)); } } } } } catch (Exception e) { _log.error("Error parsing augmentation_stats" + i + ".xml.", e); return; } try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setIgnoringComments(true); File file = new File( Config.DATAPACK_ROOT + "/data/stats/augmentation/augmentation_jewel_stats" + i + ".xml"); if (!file.exists()) { _log.warn("The jewel augmentation stat data file " + i + " is missing."); return; } Document doc = factory.newDocumentBuilder().parse(file); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { if ("list".equalsIgnoreCase(n.getNodeName())) { for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("stat".equalsIgnoreCase(d.getNodeName())) { NamedNodeMap attrs = d.getAttributes(); String statName = attrs.getNamedItem("name").getNodeValue(); float soloValues[] = null, combinedValues[] = null; for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) { if ("table".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); String tableName = attrs.getNamedItem("name").getNodeValue(); StringTokenizer data = new StringTokenizer( cd.getFirstChild().getNodeValue()); FastList<Float> array = new FastList<Float>(); while (data.hasMoreTokens()) array.add(Float.parseFloat(data.nextToken())); if (tableName.equalsIgnoreCase("#soloValues")) { soloValues = new float[array.size()]; int x = 0; for (float value : array) soloValues[x++] = value; } else { combinedValues = new float[array.size()]; int x = 0; for (float value : array) combinedValues[x++] = value; } } } // store this stat ((ArrayList<augmentationStat>) _augAccStats[(i - 1)]).add(new augmentationStat( Stats.valueOfXml(statName), soloValues, combinedValues)); } } } } } catch (Exception e) { _log.error("Error parsing jewel augmentation_stats" + i + ".xml.", e); return; } } }
From source file:hoot.services.models.osm.Node.java
/** * Populates the element model object based on osm diff data * * @param xml/*from w w w .java 2 s . co m*/ * XML data to construct the element from */ @Override public void fromXml(org.w3c.dom.Node xml) { logger.debug("Parsing node..."); NamedNodeMap xmlAttributes = xml.getAttributes(); CurrentNodes nodeRecord = (CurrentNodes) record; // set these props at the very beginning, b/c they will be needed // regardless of whether following checks fail nodeRecord.setChangesetId(parseChangesetId(xmlAttributes)); nodeRecord.setVersion(parseVersion()); nodeRecord.setTimestamp(parseTimestamp(xmlAttributes)); nodeRecord.setVisible(true); // Lat/lon are required here on a delete request as well, b/c it keeps // from having to do a round trip to the db to get the node lat/long before it is deleted, // so that can be used to update the changeset bounds (rails port does it this way). double latitude = Double.parseDouble(xmlAttributes.getNamedItem("lat").getNodeValue()); double longitude = Double.parseDouble(xmlAttributes.getNamedItem("lon").getNodeValue()); if (!GeoUtils.coordsInWorld(latitude, longitude)) { throw new RuntimeException("Coordinates for node with ID: " + getId() + " not within world boundary."); } // If the node is being deleted, we still need to make sure that the // coords passed in match what's on the server, since we'll be relying on them // to compute the changeset bounds. nodeRecord.setLatitude(latitude); nodeRecord.setLongitude(longitude); // no point in updating the tile if we're not deleting if (entityChangeType != EntityChangeType.DELETE) { nodeRecord.setTile(QuadTileCalculator.tileForPoint(latitude, longitude)); nodeRecord.setTags(parseTags(xml)); } setRecord(nodeRecord); }
From source file:net.sf.jasperreports.engine.util.JRStyledTextParser.java
/** * *///from ww w. ja v a 2s.c om private void parseStyle(JRStyledText styledText, Node parentNode) throws SAXException { NodeList nodeList = parentNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getNodeType() == Node.TEXT_NODE) { styledText.append(node.getNodeValue()); } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_style.equals(node.getNodeName())) { NamedNodeMap nodeAttrs = node.getAttributes(); Map<Attribute, Object> styleAttrs = new HashMap<Attribute, Object>(); if (nodeAttrs.getNamedItem(ATTRIBUTE_fontName) != null) { styleAttrs.put(TextAttribute.FAMILY, nodeAttrs.getNamedItem(ATTRIBUTE_fontName).getNodeValue()); } if (nodeAttrs.getNamedItem(ATTRIBUTE_isBold) != null) { styleAttrs.put(TextAttribute.WEIGHT, Boolean.valueOf(nodeAttrs.getNamedItem(ATTRIBUTE_isBold).getNodeValue()) ? TextAttribute.WEIGHT_BOLD : TextAttribute.WEIGHT_REGULAR); } if (nodeAttrs.getNamedItem(ATTRIBUTE_isItalic) != null) { styleAttrs.put(TextAttribute.POSTURE, Boolean.valueOf(nodeAttrs.getNamedItem(ATTRIBUTE_isItalic).getNodeValue()) ? TextAttribute.POSTURE_OBLIQUE : TextAttribute.POSTURE_REGULAR); } if (nodeAttrs.getNamedItem(ATTRIBUTE_isUnderline) != null) { styleAttrs.put(TextAttribute.UNDERLINE, Boolean.valueOf(nodeAttrs.getNamedItem(ATTRIBUTE_isUnderline).getNodeValue()) ? TextAttribute.UNDERLINE_ON : null); } if (nodeAttrs.getNamedItem(ATTRIBUTE_isStrikeThrough) != null) { styleAttrs.put(TextAttribute.STRIKETHROUGH, Boolean.valueOf(nodeAttrs.getNamedItem(ATTRIBUTE_isStrikeThrough).getNodeValue()) ? TextAttribute.STRIKETHROUGH_ON : null); } if (nodeAttrs.getNamedItem(ATTRIBUTE_size) != null) { styleAttrs.put(TextAttribute.SIZE, Float.valueOf(nodeAttrs.getNamedItem(ATTRIBUTE_size).getNodeValue())); } if (nodeAttrs.getNamedItem(ATTRIBUTE_pdfFontName) != null) { styleAttrs.put(JRTextAttribute.PDF_FONT_NAME, nodeAttrs.getNamedItem(ATTRIBUTE_pdfFontName).getNodeValue()); } if (nodeAttrs.getNamedItem(ATTRIBUTE_pdfEncoding) != null) { styleAttrs.put(JRTextAttribute.PDF_ENCODING, nodeAttrs.getNamedItem(ATTRIBUTE_pdfEncoding).getNodeValue()); } if (nodeAttrs.getNamedItem(ATTRIBUTE_isPdfEmbedded) != null) { styleAttrs.put(JRTextAttribute.IS_PDF_EMBEDDED, Boolean.valueOf(nodeAttrs.getNamedItem(ATTRIBUTE_isPdfEmbedded).getNodeValue())); } if (nodeAttrs.getNamedItem(ATTRIBUTE_forecolor) != null) { Color color = JRColorUtil.getColor(nodeAttrs.getNamedItem(ATTRIBUTE_forecolor).getNodeValue(), Color.black); styleAttrs.put(TextAttribute.FOREGROUND, color); } if (nodeAttrs.getNamedItem(ATTRIBUTE_backcolor) != null) { Color color = JRColorUtil.getColor(nodeAttrs.getNamedItem(ATTRIBUTE_backcolor).getNodeValue(), Color.black); styleAttrs.put(TextAttribute.BACKGROUND, color); } int startIndex = styledText.length(); parseStyle(styledText, node); styledText.addRun(new JRStyledText.Run(styleAttrs, startIndex, styledText.length())); } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_bold.equalsIgnoreCase(node.getNodeName())) { Map<Attribute, Object> styleAttrs = new HashMap<Attribute, Object>(); styleAttrs.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); int startIndex = styledText.length(); parseStyle(styledText, node); styledText.addRun(new JRStyledText.Run(styleAttrs, startIndex, styledText.length())); } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_italic.equalsIgnoreCase(node.getNodeName())) { Map<Attribute, Object> styleAttrs = new HashMap<Attribute, Object>(); styleAttrs.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); int startIndex = styledText.length(); parseStyle(styledText, node); styledText.addRun(new JRStyledText.Run(styleAttrs, startIndex, styledText.length())); } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_underline.equalsIgnoreCase(node.getNodeName())) { Map<Attribute, Object> styleAttrs = new HashMap<Attribute, Object>(); styleAttrs.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); int startIndex = styledText.length(); parseStyle(styledText, node); styledText.addRun(new JRStyledText.Run(styleAttrs, startIndex, styledText.length())); } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_sup.equalsIgnoreCase(node.getNodeName())) { Map<Attribute, Object> styleAttrs = new HashMap<Attribute, Object>(); styleAttrs.put(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER); int startIndex = styledText.length(); parseStyle(styledText, node); styledText.addRun(new JRStyledText.Run(styleAttrs, startIndex, styledText.length())); } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_sub.equalsIgnoreCase(node.getNodeName())) { Map<Attribute, Object> styleAttrs = new HashMap<Attribute, Object>(); styleAttrs.put(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUB); int startIndex = styledText.length(); parseStyle(styledText, node); styledText.addRun(new JRStyledText.Run(styleAttrs, startIndex, styledText.length())); } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_font.equalsIgnoreCase(node.getNodeName())) { NamedNodeMap nodeAttrs = node.getAttributes(); Map<Attribute, Object> styleAttrs = new HashMap<Attribute, Object>(); if (nodeAttrs.getNamedItem(ATTRIBUTE_size) != null) { styleAttrs.put(TextAttribute.SIZE, Float.valueOf(nodeAttrs.getNamedItem(ATTRIBUTE_size).getNodeValue())); } if (nodeAttrs.getNamedItem(ATTRIBUTE_color) != null) { Color color = JRColorUtil.getColor(nodeAttrs.getNamedItem(ATTRIBUTE_color).getNodeValue(), Color.black); styleAttrs.put(TextAttribute.FOREGROUND, color); } if (nodeAttrs.getNamedItem(ATTRIBUTE_fontFace) != null) { String fontFaces = nodeAttrs.getNamedItem(ATTRIBUTE_fontFace).getNodeValue(); StringTokenizer t = new StringTokenizer(fontFaces, ","); while (t.hasMoreTokens()) { String face = t.nextToken().trim(); if (AVAILABLE_FONT_FACE_NAMES.contains(face)) { styleAttrs.put(TextAttribute.FAMILY, face); break; } } } int startIndex = styledText.length(); parseStyle(styledText, node); styledText.addRun(new JRStyledText.Run(styleAttrs, startIndex, styledText.length())); } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_br.equalsIgnoreCase(node.getNodeName())) { styledText.append("\n"); int startIndex = styledText.length(); resizeRuns(styledText.getRuns(), startIndex, 1); parseStyle(styledText, node); styledText.addRun( new JRStyledText.Run(new HashMap<Attribute, Object>(), startIndex, styledText.length())); if (startIndex < styledText.length()) { styledText.append("\n"); resizeRuns(styledText.getRuns(), startIndex, 1); } } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_li.equalsIgnoreCase(node.getNodeName())) { String tmpText = styledText.getText(); if (tmpText.length() > 0 && !tmpText.endsWith("\n")) { styledText.append("\n"); } styledText.append(" \u2022 "); int startIndex = styledText.length(); resizeRuns(styledText.getRuns(), startIndex, 1); parseStyle(styledText, node); styledText.addRun( new JRStyledText.Run(new HashMap<Attribute, Object>(), startIndex, styledText.length())); // if the text in the next node does not start with a '\n', or // if the next node is not a <li /> one, we have to append a new line Node nextNode = node.getNextSibling(); String textContent = getFirstTextOccurence(nextNode); if (nextNode != null && !((nextNode.getNodeType() == Node.ELEMENT_NODE && NODE_li.equalsIgnoreCase(nextNode.getNodeName()) || (textContent != null && textContent.startsWith("\n"))))) { styledText.append("\n"); resizeRuns(styledText.getRuns(), startIndex, 1); } } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_a.equalsIgnoreCase(node.getNodeName())) { if (hyperlink == null) { NamedNodeMap nodeAttrs = node.getAttributes(); Map<Attribute, Object> styleAttrs = new HashMap<Attribute, Object>(); hyperlink = new JRBasePrintHyperlink(); hyperlink.setHyperlinkType(HyperlinkTypeEnum.REFERENCE); styleAttrs.put(JRTextAttribute.HYPERLINK, hyperlink); if (nodeAttrs.getNamedItem(ATTRIBUTE_href) != null) { hyperlink.setHyperlinkReference(nodeAttrs.getNamedItem(ATTRIBUTE_href).getNodeValue()); } if (nodeAttrs.getNamedItem(ATTRIBUTE_type) != null) { hyperlink.setLinkType(nodeAttrs.getNamedItem(ATTRIBUTE_type).getNodeValue()); } if (nodeAttrs.getNamedItem(ATTRIBUTE_target) != null) { hyperlink.setLinkTarget(nodeAttrs.getNamedItem(ATTRIBUTE_target).getNodeValue()); } int startIndex = styledText.length(); parseStyle(styledText, node); styledText.addRun(new JRStyledText.Run(styleAttrs, startIndex, styledText.length())); hyperlink = null; } else { throw new SAXException("Hyperlink <a> tags cannot be nested."); } } else if (node.getNodeType() == Node.ELEMENT_NODE && NODE_param.equalsIgnoreCase(node.getNodeName())) { if (hyperlink == null) { throw new SAXException("Hyperlink <param> tags must appear inside an <a> tag only."); } else { NamedNodeMap nodeAttrs = node.getAttributes(); JRPrintHyperlinkParameter parameter = new JRPrintHyperlinkParameter(); if (nodeAttrs.getNamedItem(ATTRIBUTE_name) != null) { parameter.setName(nodeAttrs.getNamedItem(ATTRIBUTE_name).getNodeValue()); } if (nodeAttrs.getNamedItem(ATTRIBUTE_valueClass) != null) { parameter.setValueClass(nodeAttrs.getNamedItem(ATTRIBUTE_valueClass).getNodeValue()); } String strValue = node.getTextContent(); if (strValue != null) { Object value = JRValueStringUtils.deserialize(parameter.getValueClass(), strValue); parameter.setValue(value); } hyperlink.addHyperlinkParameter(parameter); } } else if (node.getNodeType() == Node.ELEMENT_NODE) { String nodeName = "<" + node.getNodeName() + ">"; throw new SAXException("Tag " + nodeName + " is not a valid styled text tag."); } } }
From source file:com.l2jfree.gameserver.instancemanager.DimensionalRiftManager.java
public void load() { int countGood = 0, countBad = 0; try {/*www . j a v a 2 s .c o m*/ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); factory.setIgnoringComments(true); File file = new File(Config.DATAPACK_ROOT, "data/dimensionalRift.xml"); if (!file.exists()) throw new IOException(); Document doc = factory.newDocumentBuilder().parse(file); NamedNodeMap attrs; byte type, roomId; int mobId, x, y, z, delay, count; L2Spawn spawnDat; L2NpcTemplate template; int xMin = 0, xMax = 0, yMin = 0, yMax = 0, zMin = 0, zMax = 0, xT = 0, yT = 0, zT = 0; boolean isBossRoom; for (Node rift = doc.getFirstChild(); rift != null; rift = rift.getNextSibling()) { if ("rift".equalsIgnoreCase(rift.getNodeName())) { for (Node area = rift.getFirstChild(); area != null; area = area.getNextSibling()) { if ("area".equalsIgnoreCase(area.getNodeName())) { attrs = area.getAttributes(); type = Byte.parseByte(attrs.getNamedItem("type").getNodeValue()); for (Node room = area.getFirstChild(); room != null; room = room.getNextSibling()) { if ("room".equalsIgnoreCase(room.getNodeName())) { attrs = room.getAttributes(); roomId = Byte.parseByte(attrs.getNamedItem("id").getNodeValue()); Node boss = attrs.getNamedItem("isBossRoom"); isBossRoom = boss != null && Boolean.parseBoolean(boss.getNodeValue()); for (Node coord = room.getFirstChild(); coord != null; coord = coord .getNextSibling()) { if ("teleport".equalsIgnoreCase(coord.getNodeName())) { attrs = coord.getAttributes(); xT = Integer.parseInt(attrs.getNamedItem("x").getNodeValue()); yT = Integer.parseInt(attrs.getNamedItem("y").getNodeValue()); zT = Integer.parseInt(attrs.getNamedItem("z").getNodeValue()); } else if ("zone".equalsIgnoreCase(coord.getNodeName())) { attrs = coord.getAttributes(); xMin = Integer.parseInt(attrs.getNamedItem("xMin").getNodeValue()); xMax = Integer.parseInt(attrs.getNamedItem("xMax").getNodeValue()); yMin = Integer.parseInt(attrs.getNamedItem("yMin").getNodeValue()); yMax = Integer.parseInt(attrs.getNamedItem("yMax").getNodeValue()); zMin = Integer.parseInt(attrs.getNamedItem("zMin").getNodeValue()); zMax = Integer.parseInt(attrs.getNamedItem("zMax").getNodeValue()); } } if (!_rooms.containsKey(type)) _rooms.put(type, new FastMap<Byte, DimensionalRiftRoom>()); _rooms.get(type).put(roomId, new DimensionalRiftRoom(type, roomId, xMin, xMax, yMin, yMax, zMin, zMax, xT, yT, zT, isBossRoom)); for (Node spawn = room.getFirstChild(); spawn != null; spawn = spawn .getNextSibling()) { if ("spawn".equalsIgnoreCase(spawn.getNodeName())) { attrs = spawn.getAttributes(); mobId = Integer.parseInt(attrs.getNamedItem("mobId").getNodeValue()); delay = Integer.parseInt(attrs.getNamedItem("delay").getNodeValue()); count = Integer.parseInt(attrs.getNamedItem("count").getNodeValue()); template = NpcTable.getInstance().getTemplate(mobId); if (template == null) { _log.warn("Template " + mobId + " not found!"); } if (!_rooms.containsKey(type)) { _log.warn("Type " + type + " not found!"); } else if (!_rooms.get(type).containsKey(roomId)) { _log.warn("Room " + roomId + " in Type " + type + " not found!"); } for (int i = 0; i < count; i++) { DimensionalRiftRoom riftRoom = _rooms.get(type).get(roomId); x = riftRoom.getRandomX(); y = riftRoom.getRandomY(); z = riftRoom.getTeleportCoords()[2]; if (template != null && _rooms.containsKey(type) && _rooms.get(type).containsKey(roomId)) { spawnDat = new L2Spawn(template); spawnDat.setAmount(1); spawnDat.setLocx(x); spawnDat.setLocy(y); spawnDat.setLocz(z); spawnDat.setHeading(-1); spawnDat.setRespawnDelay(delay); SpawnTable.getInstance().addNewSpawn(spawnDat, false); _rooms.get(type).get(roomId).getSpawns().add(spawnDat); countGood++; } else { countBad++; } } } } } } } } } } } catch (Exception e) { _log.warn("Error on loading dimensional rift spawns: ", e); } int typeSize = _rooms.keySet().size(); int roomSize = 0; for (Byte b : _rooms.keySet()) roomSize += _rooms.get(b).keySet().size(); _log.info("DimensionalRiftManager: Loaded " + typeSize + " room types with " + roomSize + " rooms."); _log.info("DimensionalRiftManager: Loaded " + countGood + " dimensional rift spawns, " + countBad + " errors."); }
From source file:com.l2jfree.gameserver.datatables.RecipeTable.java
private void loadFromXML() throws SAXException, IOException, ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true);/*w w w . jav a 2 s . c o m*/ factory.setIgnoringComments(true); File file = new File(Config.DATAPACK_ROOT, "data/" + RECIPES_FILE); if (file.exists()) { Document doc = factory.newDocumentBuilder().parse(file); List<L2RecipeInstance> recipePartList = new FastList<L2RecipeInstance>(); List<L2RecipeStatInstance> recipeStatUseList = new FastList<L2RecipeStatInstance>(); List<L2RecipeStatInstance> recipeAltStatChangeList = new FastList<L2RecipeStatInstance>(); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { if ("list".equalsIgnoreCase(n.getNodeName())) { recipesFile: for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("item".equalsIgnoreCase(d.getNodeName())) { recipePartList.clear(); recipeStatUseList.clear(); recipeAltStatChangeList.clear(); NamedNodeMap attrs = d.getAttributes(); Node att; int id = -1; boolean haveRare = false; StatsSet set = new StatsSet(); att = attrs.getNamedItem("id"); if (att == null) { _log.fatal("Missing id for recipe item, skipping"); continue; } id = Integer.parseInt(att.getNodeValue()); set.set("id", id); att = attrs.getNamedItem("recipeId"); if (att == null) { _log.fatal("Missing recipeId for recipe item id: " + id + ", skipping"); continue; } set.set("recipeId", Integer.parseInt(att.getNodeValue())); att = attrs.getNamedItem("name"); if (att == null) { _log.fatal("Missing name for recipe item id: " + id + ", skipping"); continue; } set.set("recipeName", att.getNodeValue()); att = attrs.getNamedItem("craftLevel"); if (att == null) { _log.fatal("Missing level for recipe item id: " + id + ", skipping"); continue; } set.set("craftLevel", Integer.parseInt(att.getNodeValue())); att = attrs.getNamedItem("type"); if (att == null) { _log.fatal("Missing type for recipe item id: " + id + ", skipping"); continue; } set.set("isDwarvenRecipe", att.getNodeValue().equalsIgnoreCase("dwarven")); att = attrs.getNamedItem("successRate"); if (att == null) { _log.fatal("Missing successRate for recipe item id: " + id + ", skipping"); continue; } set.set("successRate", Integer.parseInt(att.getNodeValue())); for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling()) { if ("statUse".equalsIgnoreCase(c.getNodeName())) { String statName = c.getAttributes().getNamedItem("name").getNodeValue(); int value = Integer .parseInt(c.getAttributes().getNamedItem("value").getNodeValue()); try { recipeStatUseList.add(new L2RecipeStatInstance(statName, value)); } catch (Exception e) { _log.fatal("Error in StatUse parameter for recipe item id: " + id + ", skipping", e); continue recipesFile; } } else if ("altStatChange".equalsIgnoreCase(c.getNodeName())) { String statName = c.getAttributes().getNamedItem("name").getNodeValue(); int value = Integer .parseInt(c.getAttributes().getNamedItem("value").getNodeValue()); try { recipeAltStatChangeList.add(new L2RecipeStatInstance(statName, value)); } catch (Exception e) { _log.fatal("Error in AltStatChange parameter for recipe item id: " + id + ", skipping", e); continue recipesFile; } } else if ("ingredient".equalsIgnoreCase(c.getNodeName())) { int ingId = Integer .parseInt(c.getAttributes().getNamedItem("id").getNodeValue()); int ingCount = Integer .parseInt(c.getAttributes().getNamedItem("count").getNodeValue()); recipePartList.add(new L2RecipeInstance(ingId, ingCount)); } else if ("production".equalsIgnoreCase(c.getNodeName())) { set.set("itemId", Integer.parseInt(c.getAttributes().getNamedItem("id").getNodeValue())); set.set("count", Integer .parseInt(c.getAttributes().getNamedItem("count").getNodeValue())); } else if ("productionRare".equalsIgnoreCase(c.getNodeName())) { set.set("rareItemId", Integer.parseInt(c.getAttributes().getNamedItem("id").getNodeValue())); set.set("rareCount", Integer .parseInt(c.getAttributes().getNamedItem("count").getNodeValue())); set.set("rarity", Integer .parseInt(c.getAttributes().getNamedItem("rarity").getNodeValue())); haveRare = true; } } L2RecipeList recipeList = new L2RecipeList(set, haveRare); for (L2RecipeInstance recipePart : recipePartList) recipeList.addRecipe(recipePart); for (L2RecipeStatInstance recipeStatUse : recipeStatUseList) recipeList.addStatUse(recipeStatUse); for (L2RecipeStatInstance recipeAltStatChange : recipeAltStatChangeList) recipeList.addAltStatChange(recipeAltStatChange); _lists.put(recipeList.getId(), recipeList); } } } } } else { _log.fatal("Recipes file (" + file.getAbsolutePath() + ") doesnt exists."); } }
From source file:org.kuali.mobility.maps.service.LocationServiceImpl.java
private List<Location> buildLocationsByCampusCodeFromXml(String groupCode, String xml) { List<Location> locations = new ArrayList<Location>(); MapsGroup mapsGroup = this.getMapsGroupByCode(groupCode); if (mapsGroup != null) { if (!"".equals(xml)) { XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); DocumentBuilderFactory dbf; try { dbf = DocumentBuilderFactory.newInstance(); Document doc = dbf.newDocumentBuilder().parse(new InputSource(new StringReader(xml))); //Get all markers from XML NodeList nodes = (NodeList) xPath.evaluate("/markers/marker", doc, XPathConstants.NODESET); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node != null) { NamedNodeMap nodeMap = node.getAttributes(); Location loc = new Location(); // loc.setCampus(campusCode); // Code should be updated to assign an MIU-specific code if (isNotNullNotEmptyAttribute(nodeMap, "miu")) { loc.setCode(nodeMap.getNamedItem("miu").getNodeValue()); }/*ww w . j a v a2s .c o m*/ if (isNotNullNotEmptyAttribute(nodeMap, "scd")) { loc.setShortCode(nodeMap.getNamedItem("scd").getNodeValue()); } if (isNotNullNotEmptyAttribute(nodeMap, "cd")) { loc.setBuildingCode(nodeMap.getNamedItem("cd").getNodeValue()); } if (isNotNullNotEmptyAttribute(nodeMap, "nm")) { loc.setName(nodeMap.getNamedItem("nm").getNodeValue()); } if (isNotNullNotEmptyAttribute(nodeMap, "snm")) { loc.setShortName(nodeMap.getNamedItem("snm").getNodeValue()); } if (isNotNullNotEmptyAttribute(nodeMap, "cty")) { loc.setCity(nodeMap.getNamedItem("cty").getNodeValue()); } if (isNotNullNotEmptyAttribute(nodeMap, "sta")) { loc.setState(nodeMap.getNamedItem("sta").getNodeValue()); } if (isNotNullNotEmptyAttribute(nodeMap, "str")) { loc.setStreet(nodeMap.getNamedItem("str").getNodeValue()); } if (isNotNullNotEmptyAttribute(nodeMap, "zip")) { loc.setZip(nodeMap.getNamedItem("zip").getNodeValue()); } if (isNotNullNotEmptyAttribute(nodeMap, "active")) { Boolean active = new Boolean(nodeMap.getNamedItem("active").getNodeValue()); loc.setActive(active); } else { loc.setActive(true); } if (isNotNullNotEmptyAttribute(nodeMap, "override")) { Boolean override = new Boolean(nodeMap.getNamedItem("override").getNodeValue()); loc.setOverride(override); } else { loc.setOverride(false); } try { loc.setLatitude(new Double(nodeMap.getNamedItem("lat").getNodeValue())); } catch (Exception e) { } try { loc.setLongitude(new Double(nodeMap.getNamedItem("lng").getNodeValue())); } catch (Exception e) { } Set<MapsGroup> mapsGroups = new HashSet<MapsGroup>(); try { if (isNotNullNotEmptyAttribute(nodeMap, "grp")) { MapsGroup mapsGroupForThisLocation = this .getMapsGroupByCode(nodeMap.getNamedItem("grp").getNodeValue()); if (mapsGroupForThisLocation != null) { mapsGroups.add(mapsGroupForThisLocation); } else { // LOG.info("Location " + loc.getName() + " (" + loc.getShortName() + ") assigned to default group because group " + nodeMap.getNamedItem("grp").getNodeValue() + " does not exist."); mapsGroups.add(mapsGroup); } } else { mapsGroups.add(mapsGroup); } } catch (Exception e) { } loc.setMapsGroups(mapsGroups); locations.add(loc); } } } catch (Exception e) { // LOG.info("Error loading data to group code: " + groupCode); } } } else { // LOG.info("Error loading data to group code due to missing group: " + groupCode); } return locations; }
From source file:edu.lternet.pasta.dml.parser.eml.Eml200Parser.java
/** * Processes the attributeList element./*from ww w . ja v a2 s . c o m*/ * * @param xpathapi XPath API * @param attributeListNodeList a NodeList * @param entObj the entity object whose attribute list is processed */ private void processAttributeList(CachedXPathAPI xpathapi, NodeList attributeListNodeList, Entity entObj) throws Exception { AttributeList attributeList = new AttributeList(); Node attributeListNode = attributeListNodeList.item(0); // Get attributeList element's id attribute NamedNodeMap attributeListNodeAttributes = attributeListNode.getAttributes(); String idString = null; if (attributeListNodeAttributes != null) { Node idNode = attributeListNodeAttributes.getNamedItem(ID); if (idNode != null) { idString = idNode.getNodeValue(); attributeList.setId(idString); if (isDebugging) { //log.debug("The id value for the attributelist is " + idString); } } } NodeList attributeNodeList = xpathapi.selectNodeList(attributeListNode, "attribute"); NodeList referencesNodeList = xpathapi.selectNodeList(attributeListNode, "references"); if (attributeNodeList != null && attributeNodeList.getLength() > 0) { processAttributes(xpathapi, attributeNodeList, attributeList); if (idString != null) { attributeListIdHash.put(idString, attributeList); } } else if (referencesNodeList != null && referencesNodeList.getLength() > 0) { // get the references id Node referencesNode = referencesNodeList.item(0); if (isDebugging) { //log.debug("The reference node's name is "+ // referenceNode.getNodeName()); } String referencesId = referencesNode.getFirstChild().getNodeValue(); if (isDebugging) { //log.debug("the reference id is "+ referenceId); } attributeList = (AttributeList) attributeListIdHash.get(referencesId); } else { //log.debug( // "The children name of attribute list couldn't be understood"); throw new Exception(" couldn't be a child of attributeList"); } if (!entityObject.isSimpleDelimited()) { int numberOfAttributes = attributeList.getAttributes().length; if (numberOfAttributes != numberOfComplexFormats || ((numberOfAttributes == numberOfComplexFormats) && (numberOfComplexFormats == 0))) { throw new Exception("Complex format elements should have " + "same number as attribute number"); } else { //entityObject.setDataFormatArray(formatArray); } } entityObject.setAttributeList(attributeList); }
From source file:com.naryx.tagfusion.cfm.document.cfDOCUMENT.java
private void removeBackground(Node _node) { // Remove any background items from the node. // For now we only remove the 'bgcolor' attribute. NamedNodeMap attributes = _node.getAttributes(); if ((attributes != null) && (attributes.getNamedItem("bgcolor") != null)) attributes.removeNamedItem("bgcolor"); // If the node has children then make recursive calls to remove the // background items from the children too. if (_node.hasChildNodes()) { NodeList children = _node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) removeBackground(children.item(i)); }//from www .j a va 2s .co m }
From source file:edu.lternet.pasta.dml.parser.eml.Eml200Parser.java
/** * Pulls the entity information out of the XML and stores it in a hash table. *///from w ww .ja v a 2 s. co m private void processEntities(CachedXPathAPI xpathapi, NodeList entitiesNodeList, String xpath, String packageId) throws SAXException, javax.xml.transform.TransformerException, Exception { // Make sure that entities is not null if (entitiesNodeList == null) { return; } int entityNodeListLength = entitiesNodeList.getLength(); numEntities = numEntities + entityNodeListLength; String entityName = ""; String entityDescription = ""; String entityOrientation = ""; String entityCaseSensitive = ""; String entityNumberOfRecords = "-1"; String onlineUrl = ""; String numHeaderLines = "0"; int numFooterLines = 0; String fieldDelimiter = null; String recordDelimiter = ""; String compressionMethod = ""; String encodingMethod = ""; String quoteCharacter = null; String literalCharacter = null; boolean isImageEntity = false; boolean isGZipDataFile = false; boolean isZipDataFile = false; boolean isTarDataFile = false; boolean isSimpleDelimited = true; boolean isCollapseDelimiters = false; TextComplexDataFormat[] formatArray = null; for (int i = 0; i < entityNodeListLength; i++) { if (xpath != null && (xpath.equals(SPATIALRASTERENTITY) || xpath.equals(SPATIALVECTORENTITY))) { isImageEntity = true; } //go through the entities and put the information into the hash. elementId++; Node entityNode = entitiesNodeList.item(i); String id = null; NamedNodeMap entityNodeAttributes = entityNode.getAttributes(); if (entityNodeAttributes != null) { Node idNode = entityNodeAttributes.getNamedItem(ID); if (idNode != null) { id = idNode.getNodeValue(); } } NodeList entityNodeChildren = entityNode.getChildNodes(); for (int j = 0; j < entityNodeChildren.getLength(); j++) { Node childNode = entityNodeChildren.item(j); String childName = childNode.getNodeName(); if (childName.equals("entityName")) { entityName = childNode.getFirstChild().getNodeValue(); } else if (childName.equals("entityDescription")) { entityDescription = childNode.getFirstChild().getNodeValue(); } else if (childName.equals("caseSensitive")) { entityCaseSensitive = childNode.getFirstChild().getNodeValue(); } else if (childName.equals("numberOfRecords")) { entityNumberOfRecords = childNode.getFirstChild().getNodeValue(); /*numRecords = (new Integer(entityNumberOfRecords)) .intValue();*/ } } NodeList attributeOrientationNodeList = xpathapi.selectNodeList(entityNode, "physical/dataFormat/textFormat/attributeOrientation"); if (attributeOrientationNodeList != null && attributeOrientationNodeList.getLength() > 0) { entityOrientation = attributeOrientationNodeList.item(0).getFirstChild().getNodeValue(); } NodeList numHeaderLinesNodeList = xpathapi.selectNodeList(entityNode, "physical/dataFormat/textFormat/numHeaderLines"); if ((numHeaderLinesNodeList != null) && (numHeaderLinesNodeList.getLength() > 0)) { Node numHeaderLinesNode = numHeaderLinesNodeList.item(0); if (numHeaderLinesNode != null) { numHeaderLines = numHeaderLinesNode.getFirstChild().getNodeValue(); } } NodeList numFooterLinesNodeList = xpathapi.selectNodeList(entityNode, "physical/dataFormat/textFormat/numFooterLines"); if ((numFooterLinesNodeList != null) && (numFooterLinesNodeList.getLength() > 0)) { Node numFooterLinesNode = numFooterLinesNodeList.item(0); if (numFooterLinesNode != null) { String numFooterLinesStr = numFooterLinesNode.getFirstChild().getNodeValue(); numFooterLines = (new Integer(numFooterLinesStr.trim())).intValue(); } } // Here is the simple delimited data file NodeList fieldDelimiterNodeList = xpathapi.selectNodeList(entityNode, "physical/dataFormat/textFormat/simpleDelimited/fieldDelimiter"); if (fieldDelimiterNodeList != null && fieldDelimiterNodeList.getLength() > 0) { fieldDelimiter = fieldDelimiterNodeList.item(0).getFirstChild().getNodeValue(); } NodeList collapseDelimitersNodeList = xpathapi.selectNodeList(entityNode, "physical/dataFormat/textFormat/simpleDelimited/collapseDelimiters"); if (collapseDelimitersNodeList != null && collapseDelimitersNodeList.getLength() > 0) { String collapseDelimiters = collapseDelimitersNodeList.item(0).getFirstChild().getNodeValue(); if (collapseDelimiters.equalsIgnoreCase("yes")) { isCollapseDelimiters = true; } } NodeList quoteCharacterNodeList = xpathapi.selectNodeList(entityNode, "physical/dataFormat/textFormat/simpleDelimited/quoteCharacter"); if (quoteCharacterNodeList != null && quoteCharacterNodeList.getLength() > 0) { quoteCharacter = quoteCharacterNodeList.item(0).getFirstChild().getNodeValue(); } NodeList literalCharacterNodeList = xpathapi.selectNodeList(entityNode, "physical/dataFormat/textFormat/simpleDelimited/literalCharacter"); if (literalCharacterNodeList != null && literalCharacterNodeList.getLength() > 0) { literalCharacter = literalCharacterNodeList.item(0).getFirstChild().getNodeValue(); } // For complex format data file NodeList complexNodeList = xpathapi.selectNodeList(entityNode, "physical/dataFormat/textFormat/complex"); if (complexNodeList != null && complexNodeList.getLength() > 0) { //log.debug("in handle complex text data format"); isSimpleDelimited = false; Node complexNode = complexNodeList.item(0); NodeList complexChildNodes = complexNode.getChildNodes(); int complexChildNodesLength = complexChildNodes.getLength(); Vector formatVector = new Vector(); for (int k = 0; k < complexChildNodesLength; k++) { Node complexChildNode = complexChildNodes.item(k); if (complexChildNode != null && complexChildNode.getNodeName().equals("textFixed")) { TextWidthFixedDataFormat textWidthFixedDataFormat = handleTextFixedDataFormatNode( complexChildNode); if (textWidthFixedDataFormat != null) { formatVector.add(textWidthFixedDataFormat); //complexFormatsNumber++; } } else if (complexChildNode != null && complexChildNode.getNodeName().equals("textDelimited")) { TextDelimitedDataFormat textDelimitedDataFormat = handleComplexDelimitedDataFormatNode( complexChildNode); if (textDelimitedDataFormat != null) { formatVector.add(textDelimitedDataFormat); //complexFormatsNumber++; } } } // Transfer vector to array numberOfComplexFormats = formatVector.size(); formatArray = new TextComplexDataFormat[numberOfComplexFormats]; for (int j = 0; j < numberOfComplexFormats; j++) { formatArray[j] = (TextComplexDataFormat) formatVector.elementAt(j); } } NodeList recordDelimiterNodeList = xpathapi.selectNodeList(entityNode, "physical/dataFormat/textFormat/recordDelimiter"); if ((recordDelimiterNodeList != null) && (recordDelimiterNodeList.getLength() > 0)) { recordDelimiter = recordDelimiterNodeList.item(0).getFirstChild().getNodeValue(); } else { recordDelimiter = "\\r\\n"; } // Get the distribution information NodeList urlNodeList = xpathapi.selectNodeList(entityNode, "physical/distribution/online/url"); if (urlNodeList != null && urlNodeList.getLength() > 0) { onlineUrl = urlNodeList.item(0).getFirstChild().getNodeValue(); if (isDebugging) { //log.debug("The url is "+ onlineUrl); } } // Get the compressionMethod information NodeList compressionMethodNodeList = xpathapi.selectNodeList(entityNode, "physical/compressionMethod"); if (compressionMethodNodeList != null && compressionMethodNodeList.getLength() > 0) { compressionMethod = compressionMethodNodeList.item(0).getFirstChild().getNodeValue(); if (isDebugging) { //log.debug("Compression method is "+compressionMethod); } if (compressionMethod != null && compressionMethod.equals(Entity.GZIP)) { isGZipDataFile = true; } else if (compressionMethod != null && compressionMethod.equals(Entity.ZIP)) { isZipDataFile = true; } } // Get encoding method info (mainly for tar file) NodeList encodingMethodNodeList = xpathapi.selectNodeList(entityNode, "physical/encodingMethod"); if (encodingMethodNodeList != null && encodingMethodNodeList.getLength() > 0) { encodingMethod = encodingMethodNodeList.item(0).getFirstChild().getNodeValue(); if (isDebugging) { //log.debug("encoding method is "+encodingMethod); } if (encodingMethod != null && encodingMethod.equals(Entity.TAR)) { isTarDataFile = true; } } if (entityOrientation.trim().equals("column")) { entityOrientation = Entity.COLUMNMAJOR; } else { entityOrientation = Entity.ROWMAJOR; } if (entityCaseSensitive.equals("yes")) { entityCaseSensitive = "true"; } else { entityCaseSensitive = "false"; } entityObject = new Entity(id, entityName.trim(), entityDescription.trim(), new Boolean(entityCaseSensitive), entityOrientation, new Integer(entityNumberOfRecords).intValue()); entityObject.setNumHeaderLines((new Integer(numHeaderLines)).intValue()); entityObject.setNumFooterLines(numFooterLines); entityObject.setSimpleDelimited(isSimpleDelimited); // For simple delimited data file if (fieldDelimiter != null) { entityObject.setFieldDelimiter(fieldDelimiter); } if (quoteCharacter != null) { entityObject.setQuoteCharacter(quoteCharacter); } if (literalCharacter != null) { entityObject.setLiteralCharacter(literalCharacter); } entityObject.setCollapseDelimiters(isCollapseDelimiters); entityObject.setRecordDelimiter(recordDelimiter); entityObject.setURL(onlineUrl); entityObject.setCompressionMethod(compressionMethod); entityObject.setIsImageEntity(isImageEntity); entityObject.setHasGZipDataFile(isGZipDataFile); entityObject.setHasZipDataFile(isZipDataFile); entityObject.setHasTarDataFile(isTarDataFile); entityObject.setPackageId(packageId); try { NodeList attributeListNodeList = xpathapi.selectNodeList(entityNode, "attributeList"); processAttributeList(xpathapi, attributeListNodeList, entityObject); entityObject.setDataFormatArray(formatArray); } catch (Exception e) { throw new Exception("Error parsing attributes: " + e.getMessage()); } //entityHash.put(Integer.toString(elementId), entityObject); emlDataPackage.add(entityObject); //fileHash.put(elementId, onlineUrl); } // end for loop }
From source file:it.cnr.icar.eric.server.profile.ws.wsdl.cataloger.WSDLCatalogerEngine.java
/** * Catalogs XMLSchema when submitted as an ExtrinsicObject - RepositoryItem pair. * *//*from ww w . j a v a 2s. c o m*/ private void catalogXMLSchemaExtrinsicObject(RegistryObjectType ro, InputSource source) throws CatalogingException { try { registryObjects.add(ro); Document document = parseXML(source); Element schemaElement = document.getDocumentElement(); String documentLocalName = schemaElement.getLocalName(); String documentNamespaceURI = schemaElement.getNamespaceURI(); if (documentLocalName.equalsIgnoreCase("schema") && documentNamespaceURI.endsWith("XMLSchema")) { Attr attribute = schemaElement.getAttributeNode("targetNamespace"); String namespaceURI = attribute.getValue(); // Set the id for the XMLSchema EO updateRegistryObjectId(namespaceURI, ro, false); // Check if this XSD file imports another file (usually XSD) NodeList nodeList = schemaElement.getChildNodes(); int length = nodeList.getLength(); for (int i = 0; i < length; i++) { Node node = nodeList.item(i); String localName = node.getLocalName(); if (localName != null && localName.equalsIgnoreCase("import")) { // This XSD imports another file NamedNodeMap importNamedNodeMap = node.getAttributes(); Node namespaceNode = importNamedNodeMap.getNamedItem("namespace"); String importNamespace = null; if (namespaceNode != null) { importNamespace = namespaceNode.getNodeValue(); } String schemaLocation = null; Node schemaLocationNode = importNamedNodeMap.getNamedItem("schemaLocation"); if (schemaLocationNode != null) { schemaLocation = schemaLocationNode.getNodeValue(); } RegistryObjectType importedObject = catalogImportStatement(ro, importNamespace, schemaLocation); createImportsAssociation(ro, importedObject); } } } } catch (CatalogingException e) { throw e; } catch (Exception e) { log.error(e, e); CatalogingException ce = new CatalogingException(e); throw ce; } }