/** * Constructor for the <code>OutputAttribute</code> object. This * is used to create a simple name value pair attribute holder. * * @param name this is the name that is used for the node * @param value this is the value used for the node */ public OutputAttribute(OutputNode source, String name, String value) { this.scope = source.getNamespaces(); this.source = source; this.value = value; this.name = name; }
/** * Constructor for the <code>OutputAttribute</code> object. This * is used to create a simple name value pair attribute holder. * * @param name this is the name that is used for the node * @param value this is the value used for the node */ public OutputAttribute(OutputNode source, String name, String value) { this.scope = source.getNamespaces(); this.source = source; this.value = value; this.name = name; }
/** * Constructor for the <code>OutputAttribute</code> object. This * is used to create a simple name value pair attribute holder. * * @param name this is the name that is used for the node * @param value this is the value used for the node */ public OutputAttribute(OutputNode source, String name, String value) { this.scope = source.getNamespaces(); this.source = source; this.value = value; this.name = name; }
/** * This method will resolve the reference or the specified prefix * by searching the parent nodes in order. This allows the prefix * that is currently in scope for the reference to be acquired. * * @param prefix the prefix to find a matching reference for * * @return this will return the reference that is is scope */ private String resolveReference(String prefix) { NamespaceMap parent = source.getNamespaces(); if(parent != null) { return parent.getReference(prefix); } return null; }
/** * This method will resolve the reference or the specified prefix * by searching the parent nodes in order. This allows the prefix * that is currently in scope for the reference to be acquired. * * @param prefix the prefix to find a matching reference for * * @return this will return the reference that is is scope */ private String resolveReference(String prefix) { NamespaceMap parent = source.getNamespaces(); if(parent != null) { return parent.getReference(prefix); } return null; }
/** * This method will resolve the reference or the specified prefix * by searching the parent nodes in order. This allows the prefix * that is currently in scope for the reference to be acquired. * * @param prefix the prefix to find a matching reference for * * @return this will return the reference that is is scope */ private String resolveReference(String prefix) { NamespaceMap parent = source.getNamespaces(); if(parent != null) { return parent.getReference(prefix); } return null; }
public static void write(OutputNode parent, Element domElement) throws Exception { OutputNode child = parent.getChild(domElement.getNodeName()); child.getNamespaces().setReference(domElement.getNamespaceURI(), domElement.getPrefix()); child.setValue(domElement.getTextContent()); child.commit(); } }
/** * This is used to write the namespaces of the specified node to * the output. This will iterate over each namespace entered on * to the node. Once written the node is considered qualified. * * @param node this is the node to have is attributes written */ private void writeNamespaces(OutputNode node) throws Exception { NamespaceMap map = node.getNamespaces(); for(String name : map) { String prefix = map.getPrefix(name); writer.writeNamespace(name, prefix); } } }
/** * This is used to write the namespaces of the specified node to * the output. This will iterate over each namespace entered on * to the node. Once written the node is considered qualified. * * @param node this is the node to have is attributes written */ private void writeNamespaces(OutputNode node) throws Exception { NamespaceMap map = node.getNamespaces(); for(String name : map) { String prefix = map.getPrefix(name); writer.writeNamespace(name, prefix); } } }
/** * This is used to write the namespaces of the specified node to * the output. This will iterate over each namespace entered on * to the node. Once written the node is considered qualified. * * @param node this is the node to have is attributes written */ private void writeNamespaces(OutputNode node) throws Exception { NamespaceMap map = node.getNamespaces(); for(String name : map) { String prefix = map.getPrefix(name); writer.writeNamespace(name, prefix); } } }
/** * This method will resolve the prefix or the specified reference * by searching the parent nodes in order. This allows the prefix * that is currently in scope for the reference to be acquired. * * @param reference the reference to find a matching prefix for * * @return this will return the prefix that is is scope */ private String resolvePrefix(String reference) { NamespaceMap parent = source.getNamespaces(); if(parent != null) { String prefix = parent.getPrefix(reference); if(!containsValue(prefix)) { return prefix; } } return null; }
/** * This method will resolve the prefix or the specified reference * by searching the parent nodes in order. This allows the prefix * that is currently in scope for the reference to be acquired. * * @param reference the reference to find a matching prefix for * * @return this will return the prefix that is is scope */ private String resolvePrefix(String reference) { NamespaceMap parent = source.getNamespaces(); if(parent != null) { String prefix = parent.getPrefix(reference); if(!containsValue(prefix)) { return prefix; } } return null; }
/** * This method will resolve the prefix or the specified reference * by searching the parent nodes in order. This allows the prefix * that is currently in scope for the reference to be acquired. * * @param reference the reference to find a matching prefix for * * @return this will return the prefix that is is scope */ private String resolvePrefix(String reference) { NamespaceMap parent = source.getNamespaces(); if(parent != null) { String prefix = parent.getPrefix(reference); if(!containsValue(prefix)) { return prefix; } } return null; }
/** * This is use to apply for <code>NamespaceList</code> annotations * on the node. If there is no namespace list then this will return * and the node will be left unchanged. If however the namespace * list is not empty the the namespaces are added. * * @param node this is the node to apply the namespace list to */ private void scope(OutputNode node) { NamespaceMap map = node.getNamespaces(); for(Namespace next : scope) { String reference = next.reference(); String prefix = next.prefix(); map.setReference(reference, prefix); } }
/** * This is use to apply for <code>NamespaceList</code> annotations * on the node. If there is no namespace list then this will return * and the node will be left unchanged. If however the namespace * list is not empty the the namespaces are added. * * @param node this is the node to apply the namespace list to */ private void scope(OutputNode node) { NamespaceMap map = node.getNamespaces(); for(Namespace next : scope) { String reference = next.reference(); String prefix = next.prefix(); map.setReference(reference, prefix); } }
/** * This is use to apply for <code>NamespaceList</code> annotations * on the node. If there is no namespace list then this will return * and the node will be left unchanged. If however the namespace * list is not empty the the namespaces are added. * * @param node this is the node to apply the namespace list to */ private void scope(OutputNode node) { NamespaceMap map = node.getNamespaces(); for(Namespace next : scope) { String reference = next.reference(); String prefix = next.prefix(); map.setReference(reference, prefix); } }
/** * This <code>writeSection</code> method is used to perform serialization * of the given source object. Serialization is performed by appending * elements and attributes from the source object to the provided XML * element object. How the objects contacts are serialized is * determined by the XML schema class that the source object is an * instance of. If a required contact is null an exception is thrown. * * @param source this is the source object to be serialized * @param node the XML element the object is to be serialized to * @param section this is the section that defines the XML structure */ private void writeSection(OutputNode node, Object source, Section section) throws Exception { NamespaceMap scope = node.getNamespaces(); String prefix = section.getPrefix(); if(prefix != null) { String reference = scope.getReference(prefix); if(reference == null) { throw new ElementException("Namespace prefix '%s' in %s is not in scope", prefix, type); } else { node.setReference(reference); } } writeAttributes(node, source, section); writeElements(node, source, section); writeText(node, source, section); }
/** * This <code>writeSection</code> method is used to perform serialization * of the given source object. Serialization is performed by appending * elements and attributes from the source object to the provided XML * element object. How the objects contacts are serialized is * determined by the XML schema class that the source object is an * instance of. If a required contact is null an exception is thrown. * * @param source this is the source object to be serialized * @param node the XML element the object is to be serialized to * @param section this is the section that defines the XML structure */ private void writeSection(OutputNode node, Object source, Section section) throws Exception { NamespaceMap scope = node.getNamespaces(); String prefix = section.getPrefix(); if(prefix != null) { String reference = scope.getReference(prefix); if(reference == null) { throw new ElementException("Namespace prefix '%s' in %s is not in scope", prefix, type); } else { node.setReference(reference); } } writeAttributes(node, source, section); writeElements(node, source, section); writeText(node, source, section); }
/** * This <code>writeSection</code> method is used to perform serialization * of the given source object. Serialization is performed by appending * elements and attributes from the source object to the provided XML * element object. How the objects contacts are serialized is * determined by the XML schema class that the source object is an * instance of. If a required contact is null an exception is thrown. * * @param source this is the source object to be serialized * @param node the XML element the object is to be serialized to * @param section this is the section that defines the XML structure */ private void writeSection(OutputNode node, Object source, Section section) throws Exception { NamespaceMap scope = node.getNamespaces(); String prefix = section.getPrefix(); if(prefix != null) { String reference = scope.getReference(prefix); if(reference == null) { throw new ElementException("Namespace prefix '%s' in %s is not in scope", prefix, type); } else { node.setReference(reference); } } writeAttributes(node, source, section); writeElements(node, source, section); writeText(node, source, section); }