[ 
http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315405 ] 

Diogo Bacelar Quintela commented on JELLY-213:
----------------------------------------------

org.apache.commons.jelly.NamespaceAwareTag interface
helps in knowing the current namespaces...

for example:

<?xml version="1.0" encoding="UTF-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns="abc">
    <top-node>
        <x:element name="test-node">
            <x:attribute URI="http://apache/testNS"; name="test:abc" 
trim="true">testValue</x:attribute>
            <!-- attributes without ':' should not have namespace -->
            <x:attribute URI="http://apache/testNS"; name="abc2" 
trim="true">testValue</x:attribute>
            <x:attribute name="abc3" trim="true">testValue</x:attribute>
        </x:element>
    </top-node>
</j:jelly>

and the following code in doTag of ElementTag

------------------
Set entries = prefixToUriMap.entrySet();
        
System.out.println("localName="+localName+",name="+name+"---------------------");
        for (Iterator iter = entries.iterator(); iter.hasNext();) {
            Map.Entry entry = (Entry) iter.next();
            System.out.println("ElementTag.doTag() prefix="+entry.getKey() + ", 
value="+entry.getValue());
        }
        System.out.println("----------------------------------------");
------------------

results in...

----------------------------------------
localName=test-node,name=test-node---------------------
ElementTag.doTag() prefix=x, value=jelly:xml
ElementTag.doTag() prefix=j, value=jelly:core
ElementTag.doTag() prefix=, value=abc
----------------------------------------


However...(running with patch2, and a non dom4j xmloutput) [ie, in TestXMLTags 
testcase]
ends with
<top-node>
<test-node xmlns:test="http://apache/testNS"; test:abc="testValue" 
abc2="testValue" abc3="testValue">
</test-node>
</top-node>

:( 
top-node doesn't come with 'xmlns="abc"'

We really need to set a namespace stack in xmloutput i guess.. :(

> Generating xml nodes with attributes in diferente namespaces (for schemas..)
> ----------------------------------------------------------------------------
>
>          Key: JELLY-213
>          URL: http://issues.apache.org/jira/browse/JELLY-213
>      Project: jelly
>         Type: Bug
>     Reporter: Diogo Bacelar Quintela
>  Attachments: jelly-xml-updated.patch, jelly-xml.patch
>
> I tried to find some info googling around and in the faq and couldn't find
> the answer, so here it goes.
> I need to generate the following xml (it's a sample off course), to support
> schemas.
> ------------------------------------------------
> <NodeName 
> xmlns="http://blah/bleh"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema"; 
> xsi:schemaLocation="http://blah/blehSchemaLocation";>
> <!-- Other content here -->
> </NodeName>
> ------------------------------------------------
> After several tries and some inconsistent behaviour, I thought the following
> jelly excerpt should be close to the solution, however "xml:attribute"
> doesn't support namespaces values.
> ------------------------------------------------
> <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
>       <x:element URI="${myns}" name="NodeName">
>               <x:attribute 
>                       name="xsi:schemaLocation" 
>                       URI="${myxsins}" 
>                       trim="true">
>               ${myschemaloc}
>               </x:attribute>
>               <!-- Other content here -->
>       <x:element>
> </j:jelly>
> Where 
> "myns" is for example http://blah/bleh
> "myschemaloc" is for example http://blah/blehSchemaLocation
> "myxsins" is for example http://www.w3.org/2001/XMLSchema
> ------------------------------------------------
> Is there any known solution for this problem?  Even if working only for
> schemas?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to