question: void updateFromNativeNode ( Node node , boolean fromScratch ) throws IIOInvalidTreeException { 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 ) ; } } } }
target:  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.