Import the featurable data from node.

@param root The root node reference (must not be <code>null</code>).
@return The featurable data.
@throws LionEngineException If unable to read node.
974482
public static FeaturableConfig imports(Xml root)
    {
        Check.notNull(root);

        final String clazz;
        if (root.hasChild(ATT_CLASS))
        {
            clazz = root.getChild(ATT_CLASS).getText();
        }
        else
        {
            clazz = DEFAULT_CLASS_NAME;
        }

        final String setup;
        if (root.hasChild(ATT_SETUP))
        {
            setup = root.getChild(ATT_SETUP).getText();
        }
        else
        {
            setup = Constant.EMPTY_STRING;
        }

        return new FeaturableConfig(clazz, setup);
    }
78654
public static Attribute getInstance(Node root) throws ParsingException {
      final URI id;
      final URI type;
      String issuer = null;
      DateTimeAttribute issueInstant = null;
      AttributeValue value = null;
      
      Set<AttributeValue> valueSet = null;

      AttributeFactory attrFactory = AttributeFactory.getInstance();

      // First check that we're really parsing an Attribute
      if (! SunxacmlUtil.getNodeName(root).equals("Attribute")) {
         throw new ParsingException("Attribute object cannot be created " +
               "with root node of type: " +
               SunxacmlUtil.getNodeName(root));
      }

      NamedNodeMap attrs = root.getAttributes();

      try {
         id = new URI(attrs.getNamedItem("AttributeId").getNodeValue());
      } catch (Exception e) {
         throw new ParsingException("Error parsing required attribute " +
               "AttributeId in AttributeType", e);
      }

      try {
         type = new URI(attrs.getNamedItem("DataType").getNodeValue());
      } catch (Exception e) {
         throw new ParsingException("Error parsing required attribute " +
               "DataType in AttributeType", e);
      }            

      try {
         Node issuerNode = attrs.getNamedItem("Issuer");
         if (issuerNode != null)
            issuer = issuerNode.getNodeValue();

         Node instantNode = attrs.getNamedItem("IssueInstant");
         if (instantNode != null)
            issueInstant = DateTimeAttribute.
            getInstance(instantNode.getNodeValue());
      } catch (Exception e) {
         // shouldn't happen, but just in case...
         throw new ParsingException("Error parsing optional AttributeType"
               + " attribute", e);
      }

      // now we get the attribute value
      NodeList nodes = root.getChildNodes();
      for (int i = 0; i < nodes.getLength(); i++) {
         Node node = nodes.item(i);
         if (SunxacmlUtil.getNodeName(node).equals("AttributeValue")) {
            // only one value can be in an Attribute
            
            /* 
             * SECURITY-157: multiple values
             * 
             * if (value != null)
               throw new ParsingException("Too many values in Attribute");
             */
            // now get the value
            try {
               value = attrFactory.createValue(node, type);
            } catch (UnknownIdentifierException uie) {
               throw new ParsingException("Unknown AttributeId", uie);
            }
            if(valueSet == null)
               valueSet = new HashSet<AttributeValue>(); 
            valueSet.add(value);
         }
      }

      // make sure we got a value
      if (value == null)
         throw new ParsingException("Attribute must contain a value");

      return new BasicAttribute(id, type, issuer, issueInstant, valueSet);
   }
315159
public static SurfaceConfig imports(Xml root)
    {
        Check.notNull(root);

        final Xml node = root.getChild(NODE_SURFACE);
        final String surface = node.readString(ATT_IMAGE);
        final String icon = node.readString(null, ATT_ICON);

        return new SurfaceConfig(surface, icon);
    }
444201
def apply(self, root):
        
        if not self.filter.match(root, self.ns):
            return
        if self.exists(root):
            return
        node = Element('import', ns=self.xsdns)
        node.set('namespace', self.ns)
        if self.location is not None:
            node.set('schemaLocation', self.location)
        log.debug('inserting: %s', node)
        root.insert(node)
71502
public JimfsPath createRoot(Name root) {
    return createPath(checkNotNull(root), ImmutableList.<Name>of());
  }
1128828
public static LauncherConfig imports(Xml node)
    {
        Check.notNull(node);

        final Collection<Xml> children = node.getChildren(LaunchableConfig.NODE_LAUNCHABLE);
        final Collection<LaunchableConfig> launchables = new ArrayList<>(children.size());

        for (final Xml launchable : children)
        {
            launchables.add(LaunchableConfig.imports(launchable));
        }

        final int level = node.readInteger(0, ATT_RATE);
        final int rate = node.readInteger(ATT_RATE);

        return new LauncherConfig(level, rate, launchables);
    }
461607
protected DefaultMutableTreeNode getDataAsTree() {
        try {
            return (DefaultMutableTreeNode) MethodUtils.invokeMethod(view, "getDataAsTree", null);
        } catch (Exception e) {
            return null;
        }
    }
583001
@Override
    public Element getXML(Document root) {
        Element node = root.createElement("folder");
        this.addNodeAttributes(node);
        return node;
    }
228551
def add(self, root):
        
        node = Element('import', ns=self.xsdns)
        node.set('namespace', self.ns)
        if self.location is not None:
            node.set('schemaLocation', self.location)
        log.debug('%s inserted', node)
        root.insert(node)
445882
protected void importXMLBuilderImpl(BaseXMLBuilder builder) {
        assertElementContainsNoOrWhitespaceOnlyTextNodes(this.xmlNode);
        Node importedNode = getDocument().importNode(
            builder.getDocument().getDocumentElement(), true);
        this.xmlNode.appendChild(importedNode);
    }
759646
public static Node getNode(Object root, String path) {
        return getNode(root, Path.create(path));
    }
89056
public static Element[] getChildren( Element root, String name )
    {
        if( null == root )
        {
            return new Element[0];
        }
        NodeList list = root.getElementsByTagName( name );
        int n = list.getLength();
        ArrayList<Element> result = new ArrayList<Element>();
        for( int i = 0; i < n; i++ )
        {
            Node item = list.item( i );
            if( item instanceof Element )
            {
                result.add( (Element) item );
            }
        }
        Element[] retval = new Element[result.size()];
        result.toArray( retval );
        return retval;
    }
738156
public static CollisionCategory imports(Xml root, MapTileCollision map)
    {
        Check.notNull(root);
        Check.notNull(map);

        final Collection<Xml> children = root.getChildren(TileGroupsConfig.NODE_GROUP);
        final Collection<CollisionGroup> groups = new ArrayList<>(children.size());

        for (final Xml groupNode : children)
        {
            final String groupName = groupNode.getText();
            final CollisionGroup group = map.getCollisionGroup(groupName);
            groups.add(group);
        }

        final String axisName = root.readString(ATT_AXIS);
        final Axis axis;
        try
        {
            axis = Axis.valueOf(axisName);
        }
        catch (final IllegalArgumentException exception)
        {
            throw new LionEngineException(exception, ERROR_AXIS + axisName);
        }

        final int x = root.readInteger(ATT_X);
        final int y = root.readInteger(ATT_Y);
        final boolean glue = root.readBoolean(true, ATT_GLUE);
        final String name = root.readString(ATT_NAME);

        return new CollisionCategory(name, axis, x, y, glue, groups);
    }
80060
public static SizeConfig imports(Xml root)
    {
        Check.notNull(root);

        final Xml node = root.getChild(NODE_SIZE);
        final int width = node.readInteger(ATT_WIDTH);
        final int height = node.readInteger(ATT_HEIGHT);

        return new SizeConfig(width, height);
    }
119297
public <T> T read(InputStream input, Class<T> rootType) {
        if (input == null) {
            throw new NullPointerException("input");
        }
        if (rootType == null) {
            throw new NullPointerException("rootType");
        }
        DataInputStream dataInput;
        if (input instanceof DataInputStream) {
            dataInput = (DataInputStream) input;
        } else {
            dataInput = new DataInputStream(input);
        }
        try {
            try {
                return parseVersion(dataInput, rootType);
            } finally {
                input.close();
            }
        } catch (RuntimeException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
982644
private Element genEntityCommon(final Element root, final ResourceXMLParser.Entity entity) {
        final Element tag = root.addElement(entity.getResourceType());
        tag.addAttribute(COMMON_NAME, entity.getName());
        tag.addAttribute(COMMON_DESCRIPTION, notNull(entity.getProperty(COMMON_DESCRIPTION)));
        tag.addAttribute(COMMON_TAGS, notNull(entity.getProperty(COMMON_TAGS)));
        return tag;
    }
517633
public static TreeElement getRoot(TreeElement node)
    {
        TreeElement parentNode = node.getParent();
        while (parentNode != null) {
            node = parentNode;
            parentNode = node.getParent();
        }
        return node;
    }