I am attempting to create a level for enigma using the built in xml dom
package packaged with java.
I am having trouble doing this because of the "el:" prefix that needs
added to all xml tags in the xml portion of the level.
Does anyone have any knowledge of the java xml parser?
If anyone does, could you help me figure this out? It will be much
Hello Reece, You need to define the prefixes using the Namespace APIs. Usually, they do not need to be "el:". It's up to the user to choose these prefixes. The key part is to map the prefix to a namespace, there should be a xmlns:el attribute on an appropriate parent node.
Typical code looks (here: SVG, adding an xlink: namespace) like this:
I also have another problem that you might be able to help me with, when
I use transformer factory/transformer to output my dom tree to an xml
file, the transformer outputs into a single line.
Do you know how to get the transformer to output the xml file with line
breaks and indentations(tabs)?
On 6/19/2012 1:38 AM, Erich Schubert wrote:
> Hello Reece,
> You need to define the prefixes using the Namespace APIs.
> Usually, they do not need to be "el:". It's up to the user to choose
> these prefixes.
> The key part is to map the prefix to a namespace, there should be a
> xmlns:el attribute on an appropriate parent node.
> Typical code looks (here: SVG, adding an xlink: namespace) like this:
> root = document.getDocumentElement();
> SVGConstants.XMLNS_PREFIX + ":" + SVGConstants.XLINK_PREFIX,
> using a namespaced attribute:
> SVGConstants.XLINK_HREF_QNAME, value);
> creating a namespaced element:
> document.createElementNS(namespaceURI, qualifiedName);
> qualifiedName here is prefix+":"+tag name
> namespaceURI is the actual URI of the namespace. I guess the XML DOM
> factory will check the the namespace has been defined as above.