Java Code Examples for org.w3c.dom.Node#getNodeName()
The following examples show how to use
org.w3c.dom.Node#getNodeName() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: JVoiceXML File: SrgsNodeFactory.java License: GNU Lesser General Public License v2.1 | 6 votes |
/** * {@inheritDoc} */ public SrgsNode getXmlNode(final Node node) { // Do nothing if the node is null if (node == null) { return null; } // Do nothing if we already have the righttype. if (node instanceof SrgsNode) { return (SrgsNode) node; } String name = node.getLocalName(); if (name == null) { name = node.getNodeName(); } final SrgsNode srgsXmlNode = NODES.get(name); if (srgsXmlNode == null) { LOGGER.warning("cannot resolve node with name '" + name + "'"); return new GenericSrgsNode(node); } return (SrgsNode) srgsXmlNode.newInstance(node, this); }
Example 2
Source Project: OCR-Equation-Solver File: WAUnitsImpl.java License: MIT License | 6 votes |
WAUnitsImpl(Element thisElement, HttpProvider http, File tempDir) throws WAException { int numUnits = Integer.parseInt(thisElement.getAttribute("count")); shortNames = new String[numUnits]; longNames = new String[numUnits]; NodeList subElements = thisElement.getChildNodes(); int numSubElements = subElements.getLength(); int unitElementIndex = 0; for (int i = 0; i < numSubElements; i++) { Node child = subElements.item(i); String name = child.getNodeName(); if ("unit".equals(name)) { Element unit = (Element) child; shortNames[unitElementIndex] = unit.getAttribute("short"); longNames[unitElementIndex] = unit.getAttribute("long"); unitElementIndex++; } else if ("img".equals(name)) { image = new WAImageImpl((Element) child, http, tempDir); } } }
Example 3
Source Project: JDKSourceCode1.8 File: JFIFMarkerSegment.java License: MIT License | 6 votes |
JFIFThumbJPEG(Node node) throws IIOInvalidTreeException { if (node.getChildNodes().getLength() > 1) { throw new IIOInvalidTreeException ("JFIFThumbJPEG node must have 0 or 1 child", node); } Node child = node.getFirstChild(); if (child != null) { String name = child.getNodeName(); if (!name.equals("markerSequence")) { throw new IIOInvalidTreeException ("JFIFThumbJPEG child must be a markerSequence node", node); } thumbMetadata = new JPEGMetadata(false, true); thumbMetadata.setFromMarkerSequenceNode(child); } }
Example 4
Source Project: megamek File: MULParser.java License: GNU General Public License v2.0 | 5 votes |
/** * Parse a bombs tag for the given <code>Entity</code>. * * @param bombsTag * @param entity */ private void parseBombs(Element bombsTag, Entity entity){ if (!(entity instanceof IBomber)) { warning.append("Found a bomb but Entity cannot carry bombs.\n"); return; } // Deal with any child nodes NodeList nl = bombsTag.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node currNode = nl.item(i); if (currNode.getParentNode() != bombsTag) { continue; } int nodeType = currNode.getNodeType(); if (nodeType == Node.ELEMENT_NODE) { Element currEle = (Element)currNode; String nodeName = currNode.getNodeName(); if (nodeName.equalsIgnoreCase(BOMB)){ int[] bombChoices = ((IBomber) entity).getBombChoices(); String type = currEle.getAttribute(TYPE); String load = currEle.getAttribute(LOAD); if (type.length() > 0 && load.length() > 0){ int bombType = BombType.getBombTypeFromInternalName(type); if(bombType <= BombType.B_NONE || bombType >= BombType.B_NUM) { continue; } bombChoices[bombType] += Integer.parseInt(load); ((IBomber) entity).setBombChoices(bombChoices); } } } else { continue; } } }
Example 5
Source Project: openjdk-8 File: DOMDocumentSerializer.java License: GNU General Public License v2.0 | 5 votes |
protected final void serializeProcessingInstruction(Node pi) throws IOException { if (getIgnoreProcesingInstructions()) return; encodeTermination(); final String target = pi.getNodeName(); final String data = pi.getNodeValue(); encodeProcessingInstruction(target, data); }
Example 6
Source Project: jdk1.8-source-analysis File: DOMHelper.java License: Apache License 2.0 | 5 votes |
/** * Test whether the given node is a namespace decl node. In DOM Level 2 * this can be done in a namespace-aware manner, but in Level 1 DOMs * it has to be done by testing the node name. * * @param n Node to be examined. * * @return boolean -- true iff the node is an Attr whose name is * "xmlns" or has the "xmlns:" prefix. */ public boolean isNamespaceNode(Node n) { if (Node.ATTRIBUTE_NODE == n.getNodeType()) { String attrName = n.getNodeName(); return (attrName.startsWith("xmlns:") || attrName.equals("xmlns")); } return false; }
Example 7
Source Project: flex-blazeds File: AbstractConfigurationParser.java License: Apache License 2.0 | 5 votes |
/** * Check whether there is any unexpected item in the node list object. * * @param attributes the current NodeList object * @param allowed, the String array of allowed items * @return Name of the first unexpected item from the list of allowed attributes, or null if all * items present were allowed. **/ public String unexpected(NodeList attributes, String[] allowed) { for (int i = 0; i < attributes.getLength(); i++) { Node attrib = attributes.item(i); String attribName = attrib.getNodeName(); boolean match = false; for (int j = 0; j < allowed.length; j++) { String a = allowed[j]; if (a.equals(attribName)) { match = true; break; } } if (!match) { return attribName; } // Go ahead and replace tokens in node values. tokenReplacer.replaceToken(attrib, getSourceFilename(attrib)); } return null; }
Example 8
Source Project: AndroidRobot File: ProjectUtil.java License: Apache License 2.0 | 5 votes |
public static String getPixelByDevice(String file,String device)throws ParserConfigurationException, SAXException, IOException{ DocumentBuilderFactory domfac=DocumentBuilderFactory.newInstance(); DocumentBuilder dombuilder=domfac.newDocumentBuilder(); InputStream is=new FileInputStream(file); Document doc=dombuilder.parse(is); Element root=doc.getDocumentElement(); NodeList prjInfo=root.getChildNodes(); if(prjInfo!=null){ for(int i=0;i<prjInfo.getLength();i++){ Node project = prjInfo.item(i); if(project.getNodeType()==Node.ELEMENT_NODE){ String strProject = project.getNodeName(); if(strProject.equals("devices")){ for(Node node=project.getFirstChild();node!=null;node=node.getNextSibling()){ if(node.getNodeType()==Node.ELEMENT_NODE){ if(node.getTextContent().equals(device)){ System.out.println(node.getAttributes().getLength()); } } } } } } } return ""; }
Example 9
Source Project: quarkus File: CreateUtils.java License: Apache License 2.0 | 5 votes |
private static String getChildElementTextValue(final Node parentNode, String childName) throws MojoExecutionException { final Node node = getElement(parentNode.getChildNodes(), childName); final String text = getText(node); if (text.isEmpty()) { throw new MojoExecutionException( "The " + parentNode.getNodeName() + " element description is missing child " + childName); } return text; }
Example 10
Source Project: openjdk-jdk8u File: JPEGMetadata.java License: GNU General Public License v2.0 | 5 votes |
private void mergeNativeTree(Node root) throws IIOInvalidTreeException { String name = root.getNodeName(); if (name != ((isStream) ? JPEG.nativeStreamMetadataFormatName : JPEG.nativeImageMetadataFormatName)) { throw new IIOInvalidTreeException("Invalid root node name: " + name, root); } if (root.getChildNodes().getLength() != 2) { // JPEGvariety and markerSequence throw new IIOInvalidTreeException( "JPEGvariety and markerSequence nodes must be present", root); } mergeJFIFsubtree(root.getFirstChild()); mergeSequenceSubtree(root.getLastChild()); }
Example 11
Source Project: jdk1.8-source-analysis File: JPEGMetadata.java License: Apache License 2.0 | 5 votes |
private void mergeNativeTree(Node root) throws IIOInvalidTreeException { String name = root.getNodeName(); if (name != ((isStream) ? JPEG.nativeStreamMetadataFormatName : JPEG.nativeImageMetadataFormatName)) { throw new IIOInvalidTreeException("Invalid root node name: " + name, root); } if (root.getChildNodes().getLength() != 2) { // JPEGvariety and markerSequence throw new IIOInvalidTreeException( "JPEGvariety and markerSequence nodes must be present", root); } mergeJFIFsubtree(root.getFirstChild()); mergeSequenceSubtree(root.getLastChild()); }
Example 12
Source Project: LibScout File: XMLParser.java License: Apache License 2.0 | 4 votes |
public static LibraryDescription readLibraryXML(File file) throws ParserConfigurationException, SAXException, IOException, ParseException { if (file == null || !file.exists() || file.isDirectory()) throw new IOException("Library description file does not exist or is a directory!"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(file); doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("library"); if (nList.getLength() != 1) throw new SAXException("The library description file must only contain one <library> root node (found: " + nList.getLength() + ")"); // We only require one description per library Node nNode = nList.item(0); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) nNode; // mandatory values String name = element.getElementsByTagName(TAG_NAME).item(0).getTextContent(); LibraryCategory category; try { String catStr = element.getElementsByTagName(TAG_CATEGORY).item(0).getTextContent(); if (catStr.equals("Social Media") || catStr.equals("Social-Media") || catStr.equals("SocialMedia")) category = LibraryCategory.SocialMedia; else category = LibraryCategory.valueOf(catStr); } catch (IllegalArgumentException e) { throw new ParseException("Found unknown category: " + element.getElementsByTagName(TAG_CATEGORY).item(0).getTextContent() + " in file: " + file, -1); } // optional values String version = null; if (element.getElementsByTagName(TAG_VERSION).getLength() > 0) version = element.getElementsByTagName(TAG_VERSION).item(0).getTextContent(); Date date = null; if (element.getElementsByTagName(TAG_DATE).getLength() > 0) { String dateStr = element.getElementsByTagName(TAG_DATE).item(0).getTextContent(); if (!dateStr.isEmpty()) { SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy"); date = formatter.parse(dateStr); } } String comment = null; if (element.getElementsByTagName(TAG_COMMENT).getLength() > 0) comment = element.getElementsByTagName(TAG_COMMENT).item(0).getTextContent(); return new LibraryDescription(name, category, version, date, comment); } else throw new SAXException("Root node (" + nNode.getNodeName() + " / " + nNode.getNodeValue() + ") is not an element-node"); }
Example 13
Source Project: openemm File: HtmlUtils.java License: GNU Affero General Public License v3.0 | 4 votes |
private static void appendAttributes(StringBuilder builder, DeclarationMap styleMap, Element element, StylesEmbeddingOptions options) { if (element.hasAttributes()) { NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Node attribute = attributes.item(i); String name = attribute.getNodeName(); String value = attribute.getNodeValue(); switch (name) { case "style": // All the styles (inline ones as well) are already accumulated in a style map - do nothing break; case "src": if (options.getBaseUrl() != null && StringUtils.equals(element.getTagName(), "img") && !value.startsWith("[")) { value = HttpUtils.resolveRelativeUri(options.getBaseUrl(), value); } //$FALL-THROUGH$ default: value = value.replace("\n", " "); if (options.isEscapeAgnTags()) { value = AgnTagUtils.escapeAgnTags(value); } builder.append(' ').append(name).append("=\"").append(value).append("\""); break; } } } List<Declaration> declarations = styleMap.get(element); if (CollectionUtils.isNotEmpty(declarations)) { String styles = declarations.stream() .map(declaration -> { resolveUris(declaration); return toString(declaration); }).collect(Collectors.joining(" ")); // Hack for IE (See GWUA-2423) if (StringUtils.equals(element.getTagName(), "img") && StringUtils.isBlank(element.getAttribute("border"))) { final String noBorder = "border:none;"; final String noBottomBorder = "border-bottom-style:none;"; final String noLeftBorder = "border-left-style:none;"; final String noRightBorder = "border-right-style:none;"; final String noTopBorder = "border-top-style:none;"; final String s = styles.replaceAll("\\s+", ""); if (s.contains(noBorder) || (s.contains(noBottomBorder) && s.contains(noLeftBorder) && s.contains(noRightBorder) && s.contains(noTopBorder))) { if (!s.contains(noBorder)) { styles += " border: none;"; } builder.append(" border=\"0\""); } } builder.append(" style=\"").append(styles).append('\"'); } }
Example 14
Source Project: jdk8u60 File: JFIFMarkerSegment.java License: GNU General Public License v2.0 | 4 votes |
/** * Updates the data in this object from the given DOM Node tree. * If fromScratch is true, this object is being constructed. * Otherwise an existing object is being modified. * Throws an IIOInvalidTreeException if the tree is invalid in * any way. */ void updateFromNativeNode(Node node, boolean fromScratch) throws IIOInvalidTreeException { // none of the attributes are required NamedNodeMap attrs = node.getAttributes(); if (attrs.getLength() > 0) { int value = getAttributeValue(node, attrs, "majorVersion", 0, 255, false); majorVersion = (value != -1) ? value : majorVersion; value = getAttributeValue(node, attrs, "minorVersion", 0, 255, false); minorVersion = (value != -1) ? value : minorVersion; value = getAttributeValue(node, attrs, "resUnits", 0, 2, false); resUnits = (value != -1) ? value : resUnits; value = getAttributeValue(node, attrs, "Xdensity", 1, 65535, false); Xdensity = (value != -1) ? value : Xdensity; value = getAttributeValue(node, attrs, "Ydensity", 1, 65535, false); Ydensity = (value != -1) ? value : Ydensity; value = getAttributeValue(node, attrs, "thumbWidth", 0, 255, false); thumbWidth = (value != -1) ? value : thumbWidth; value = getAttributeValue(node, attrs, "thumbHeight", 0, 255, false); thumbHeight = (value != -1) ? value : thumbHeight; } if (node.hasChildNodes()) { NodeList children = node.getChildNodes(); int count = children.getLength(); if (count > 2) { throw new IIOInvalidTreeException ("app0JFIF node cannot have > 2 children", node); } for (int i = 0; i < count; i++) { Node child = children.item(i); String name = child.getNodeName(); if (name.equals("JFXX")) { if ((!extSegments.isEmpty()) && fromScratch) { throw new IIOInvalidTreeException ("app0JFIF node cannot have > 1 JFXX node", node); } NodeList exts = child.getChildNodes(); int extCount = exts.getLength(); for (int j = 0; j < extCount; j++) { Node ext = exts.item(j); extSegments.add(new JFIFExtensionMarkerSegment(ext)); } } if (name.equals("app2ICC")) { if ((iccSegment != null) && fromScratch) { throw new IIOInvalidTreeException ("> 1 ICC APP2 Marker Segment not supported", node); } iccSegment = new ICCMarkerSegment(child); } } } }
Example 15
Source Project: jdk8u60 File: TreeWalker.java License: GNU General Public License v2.0 | 4 votes |
/** * End processing of given node * * * @param node Node we just finished processing * * @throws org.xml.sax.SAXException */ protected void endNode(Node node) throws org.xml.sax.SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_NODE : break; case Node.ELEMENT_NODE : String ns = m_dh.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.endElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName()); NamedNodeMap atts = ((Element) node).getAttributes(); int nAttrs = atts.getLength(); for (int i = 0; i < nAttrs; i++) { Node attr = atts.item(i); String attrName = attr.getNodeName(); if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) { int index; // Use "" instead of null, as Xerces likes "" for the // name of the default namespace. Fix attributed // to "Steven Murray" <[email protected]>. String prefix = (index = attrName.indexOf(":")) < 0 ? "" : attrName.substring(index + 1); this.m_contentHandler.endPrefixMapping(prefix); } } break; case Node.CDATA_SECTION_NODE : break; case Node.ENTITY_REFERENCE_NODE : { EntityReference eref = (EntityReference) node; if (m_contentHandler instanceof LexicalHandler) { LexicalHandler lh = ((LexicalHandler) this.m_contentHandler); lh.endEntity(eref.getNodeName()); } } break; default : } }
Example 16
Source Project: pra File: IdentifinderSOAPClient.java License: MIT License | 4 votes |
public String getIdentifinderOutput(String input){ //System.out.println("input:"+input); StringBuffer sb = new StringBuffer(); sb.append(inputPrefix); input = replaceSpecialSymbol(input); sb.append(input); sb.append(inputSuffix); String line = null; //System.err.println("sending request:"); //System.err.print(sb.toString()); StringBuffer serverSB = new StringBuffer(); try{ URLConnection uc = u.openConnection(); connection = (HttpURLConnection) uc; connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); OutputStream out = connection.getOutputStream(); wout = new BufferedWriter(new OutputStreamWriter(out, "UTF8")); wout.write(sb.toString()); wout.flush(); wout.close(); InputStream in = connection.getInputStream(); serverResponse = new BufferedReader(new InputStreamReader(in, "UTF8")); while ((line = serverResponse.readLine()) != null){ //System.out.println(line); serverSB.append(line); serverSB.append("\n"); } Document doc = docBuilder.parse(new ByteArrayInputStream(serverSB.toString().trim().getBytes("UTF-8"))); NodeList nodeList = doc.getElementsByTagName("SOAP-ENV:Envelope"); Node responseNode = nodeList.item(0).getChildNodes().item(0).getChildNodes().item(0).getChildNodes().item(0); NodeList children = responseNode.getChildNodes(); String text = null; for ( int j = 0; j < children.getLength(); j++ ) { Node m = children.item( j ); String name = m.getNodeName(); if(name.equals("#text")){ text = m.getNodeValue(); break; } } //System.err.println("server raw output:"+text); Matcher matcher = textContentPattern.matcher(text); if(matcher.matches()){ text = matcher.group(1); //System.err.println("server output:"+text); } text = recoverSpecialSymbol(text); return text; }catch(Exception ex){ log.error("ERROR when sending request to BBN server and getting server response"); ex.printStackTrace(); } return null; }
Example 17
Source Project: defense-solutions-proofs-of-concept File: CoTAdapter.java License: Apache License 2.0 | 4 votes |
public static String elementToString(Node n) { String name = n.getNodeName(); short type = n.getNodeType(); if (Node.CDATA_SECTION_NODE == type) { return "<![CDATA[" + n.getNodeValue() + "]]>"; } if (name.startsWith("#")) { return ""; } StringBuffer sb = new StringBuffer(); sb.append('<').append(name); NamedNodeMap attrs = n.getAttributes(); if (attrs != null) { for (int i = 0; i < attrs.getLength(); i++) { Node attr = attrs.item(i); sb.append(' ').append(attr.getNodeName()).append("=\"") .append(attr.getNodeValue()).append("\""); } } String textContent = null; NodeList children = n.getChildNodes(); if (children.getLength() == 0) { if ((textContent = n.getTextContent()) != null && !"".equals(textContent)) { sb.append(textContent).append("</").append(name).append('>'); } else { sb.append("/>").append('\n'); } } else { sb.append('>').append('\n'); boolean hasValidChildren = false; for (int i = 0; i < children.getLength(); i++) { String childToString = elementToString(children.item(i)); if (!"".equals(childToString)) { sb.append(childToString); hasValidChildren = true; } } if (!hasValidChildren && ((textContent = n.getTextContent()) != null)) { sb.append(textContent); } sb.append("</").append(name).append('>'); } return sb.toString(); }
Example 18
Source Project: openjdk-jdk8u-backup File: JFIFMarkerSegment.java License: GNU General Public License v2.0 | 4 votes |
JFIFExtensionMarkerSegment(Node node) throws IIOInvalidTreeException { super(JPEG.APP0); NamedNodeMap attrs = node.getAttributes(); if (attrs.getLength() > 0) { code = getAttributeValue(node, attrs, "extensionCode", THUMB_JPEG, THUMB_RGB, false); if (code == THUMB_UNASSIGNED) { throw new IIOInvalidTreeException ("invalid extensionCode attribute value", node); } } else { code = THUMB_UNASSIGNED; } // Now the child if (node.getChildNodes().getLength() != 1) { throw new IIOInvalidTreeException ("app0JFXX node must have exactly 1 child", node); } Node child = node.getFirstChild(); String name = child.getNodeName(); if (name.equals("JFIFthumbJPEG")) { if (code == THUMB_UNASSIGNED) { code = THUMB_JPEG; } thumb = new JFIFThumbJPEG(child); } else if (name.equals("JFIFthumbPalette")) { if (code == THUMB_UNASSIGNED) { code = THUMB_PALETTE; } thumb = new JFIFThumbPalette(child); } else if (name.equals("JFIFthumbRGB")) { if (code == THUMB_UNASSIGNED) { code = THUMB_RGB; } thumb = new JFIFThumbRGB(child); } else { throw new IIOInvalidTreeException ("unrecognized app0JFXX child node", node); } }
Example 19
Source Project: jdk8u_jdk File: JFIFMarkerSegment.java License: GNU General Public License v2.0 | 4 votes |
JFIFExtensionMarkerSegment(Node node) throws IIOInvalidTreeException { super(JPEG.APP0); NamedNodeMap attrs = node.getAttributes(); if (attrs.getLength() > 0) { code = getAttributeValue(node, attrs, "extensionCode", THUMB_JPEG, THUMB_RGB, false); if (code == THUMB_UNASSIGNED) { throw new IIOInvalidTreeException ("invalid extensionCode attribute value", node); } } else { code = THUMB_UNASSIGNED; } // Now the child if (node.getChildNodes().getLength() != 1) { throw new IIOInvalidTreeException ("app0JFXX node must have exactly 1 child", node); } Node child = node.getFirstChild(); String name = child.getNodeName(); if (name.equals("JFIFthumbJPEG")) { if (code == THUMB_UNASSIGNED) { code = THUMB_JPEG; } thumb = new JFIFThumbJPEG(child); } else if (name.equals("JFIFthumbPalette")) { if (code == THUMB_UNASSIGNED) { code = THUMB_PALETTE; } thumb = new JFIFThumbPalette(child); } else if (name.equals("JFIFthumbRGB")) { if (code == THUMB_UNASSIGNED) { code = THUMB_RGB; } thumb = new JFIFThumbRGB(child); } else { throw new IIOInvalidTreeException ("unrecognized app0JFXX child node", node); } }
Example 20
Source Project: JDKSourceCode1.8 File: JFIFMarkerSegment.java License: MIT License | 4 votes |
/** * Updates the data in this object from the given DOM Node tree. * If fromScratch is true, this object is being constructed. * Otherwise an existing object is being modified. * Throws an IIOInvalidTreeException if the tree is invalid in * any way. */ void updateFromNativeNode(Node node, boolean fromScratch) throws IIOInvalidTreeException { // none of the attributes are required NamedNodeMap attrs = node.getAttributes(); if (attrs.getLength() > 0) { int value = getAttributeValue(node, attrs, "majorVersion", 0, 255, false); majorVersion = (value != -1) ? value : majorVersion; value = getAttributeValue(node, attrs, "minorVersion", 0, 255, false); minorVersion = (value != -1) ? value : minorVersion; value = getAttributeValue(node, attrs, "resUnits", 0, 2, false); resUnits = (value != -1) ? value : resUnits; value = getAttributeValue(node, attrs, "Xdensity", 1, 65535, false); Xdensity = (value != -1) ? value : Xdensity; value = getAttributeValue(node, attrs, "Ydensity", 1, 65535, false); Ydensity = (value != -1) ? value : Ydensity; value = getAttributeValue(node, attrs, "thumbWidth", 0, 255, false); thumbWidth = (value != -1) ? value : thumbWidth; value = getAttributeValue(node, attrs, "thumbHeight", 0, 255, false); thumbHeight = (value != -1) ? value : thumbHeight; } if (node.hasChildNodes()) { NodeList children = node.getChildNodes(); int count = children.getLength(); if (count > 2) { throw new IIOInvalidTreeException ("app0JFIF node cannot have > 2 children", node); } for (int i = 0; i < count; i++) { Node child = children.item(i); String name = child.getNodeName(); if (name.equals("JFXX")) { if ((!extSegments.isEmpty()) && fromScratch) { throw new IIOInvalidTreeException ("app0JFIF node cannot have > 1 JFXX node", node); } NodeList exts = child.getChildNodes(); int extCount = exts.getLength(); for (int j = 0; j < extCount; j++) { Node ext = exts.item(j); extSegments.add(new JFIFExtensionMarkerSegment(ext)); } } if (name.equals("app2ICC")) { if ((iccSegment != null) && fromScratch) { throw new IIOInvalidTreeException ("> 1 ICC APP2 Marker Segment not supported", node); } iccSegment = new ICCMarkerSegment(child); } } } }