Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.qi4j.library.rdf.model;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.qi4j.api.composite.DependencyDescriptor;
import org.qi4j.api.composite.MethodDescriptor;
import org.qi4j.api.composite.TransientDescriptor;
import org.qi4j.api.mixin.MixinDescriptor;
import org.qi4j.api.structure.ApplicationDescriptor;
import org.qi4j.api.structure.LayerDescriptor;
import org.qi4j.api.structure.ModuleDescriptor;
import org.qi4j.functional.Function;
import org.qi4j.functional.HierarchicalVisitor;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import static org.qi4j.functional.Iterables.first;
/**
* TODO
*/
public class Model2XML
implements Function
{
private static Map simpleMappings = new HashMap();
static
{
simpleMappings.put( "TransientsModel", "transients" );
simpleMappings.put( "EntitiesModel", "entities" );
simpleMappings.put( "ServicesModel", "services" );
simpleMappings.put( "ImportedServicesModel", "importedservices" );
simpleMappings.put( "ObjectsModel", "objects" );
simpleMappings.put( "ValuesModel", "values" );
simpleMappings.put( "MixinsModel", "mixins" );
simpleMappings.put( "CompositeMethodsModel", "methods" );
simpleMappings.put( "InjectedFieldsModel", "injectedfields" );
simpleMappings.put( "InjectedFieldModel", "injectedfield" );
}
@Override
public Document map( ApplicationDescriptor Application )
{
try
{
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
final Document document = builder.newDocument();
final Stack current = new Stack();
current.push( document );
Application.accept( new HierarchicalVisitor