You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org> on 2005/07/06 13:34:14 UTC

[jira] Created: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

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


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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
    [ 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Paul Libbrecht (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315218 ] 

Paul Libbrecht commented on JELLY-213:
--------------------------------------

Diogo,

I am surprised this works without calling startPrefixMapping (and endPrefixMapping).
It's probably a goodie of dom4j not to need it but it may fail if we use a non-dom4j XMLOutput...

Your patch only concerns AttributeTag whereas startPrefixMapping should, I think, be called by ElementTag.

Also, it would be nice to have a test-case alongside.

thanks

paul


> 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.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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by Paul Libbrecht <pa...@activemath.org>.
Diogo,

Le 7 juil. 05, à 11:09, Diogo Bacelar Quintela (JIRA) a écrit :
> I'll investigate what you said.
> Btw, I am adding a tag to jelly-xml tags that i'll add as a patch 
> later...
> A tag to suppport namespace subtitution, i'll explain it's needs then..

That might be then better together.
I tried looking around, maybe not long enough, but did not find a way 
to find registered namespaces so that the namespace URI would be pulled 
from the environment... but I forgot to look at XPath-based tags yet...

paul

PS: I am unclear how much the need for start end endPrefixMapping are 
fundamental... it may be not needed since we're not talking as a 
parser...

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315221 ] 

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

I'll investigate what you said.
Btw, I am adding a tag to jelly-xml tags that i'll add as a patch later...
A tag to suppport namespace subtitution, i'll explain it's needs then..

> 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.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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Resolved: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Paul Libbrecht (JIRA)" <co...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/JELLY-213?page=all ]
     
Paul Libbrecht resolved JELLY-213:
----------------------------------

    Resolution: Fixed

Thanks Diogo,
thanks to your patches, we were able to fix this issue and, I have commited most of it. There were a few style corrections.
Moreover, I did not take over the xmlunit usage to test the output of namespace-qualified attributes, I don't think it would actually be tested this way (but I may be wrong).
paul

> 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-patch3.patch, jelly-patch4.patch, 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315291 ] 

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

Jelly Script
############ (TestNs.jelly)
<?xml version="1.0" encoding="UTF-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
	<one>
	    <x:element URI="http://apache/testNS" name="two">
	        <x:attribute URI="http://apache/anotherNS" 
				   name="test:abc2"
				   trim="true">
			testValue
	        </x:attribute>
	        <three>hi</three>
	    </x:element>
	</one>
</j:jelly>
##############
NOTES: Element "one" has no default namespace because j:jelly does not define one, so nor does element "three".
Element "two" should be declared to be in namespace "http://apache/testNS"

The namespace URI set for ElementTag don't get reset if using a no dom4j-XMLOutput, and exists before patch 1
(http://issues.apache.org/jira/browse/JELLY-213, jelly-xml.patch)
because ElementTag already allows to set a namespace.
See bellow "SAMPLE OUTPUTS"


Java Test
######### (TestNs.java)
import java.io.File; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.StringWriter; import java.io.Writer; import java.net.URL; import org.apache.commons.jelly.JellyContext; import org.apache.commons.jelly.JellyException; import org.apache.commons.jelly.XMLOutput; import org.apache.xml.serialize.Method; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.XMLSerializer; import org.dom4j.io.SAXContentHandler; import org.dom4j.io.SAXReader; import org.dom4j.io.XMLWriter; import org.xml.sax.SAXException;

public class TestNs {
    public TestNs() {

    }

    public void serializeUsingSimpleXMLOutput(
		String fileName, 
		Writer writer) 
    throws JellyException, IOException {
        JellyContext context = new JellyContext();

        // cature the output
        // XMLOutput output = XMLOutput.createXMLOutput(writer);
        org.dom4j.io.OutputFormat outputFormat = 
			new org.dom4j.io.OutputFormat();
        outputFormat.setSuppressDeclaration(true);
        outputFormat.setNewlines(true);
        outputFormat.setIndent(true);
        outputFormat.setIndentSize(4);
        XMLWriter xmlWriter = new XMLWriter(writer, outputFormat);
        XMLOutput output = new XMLOutput(xmlWriter);

        URL fUrl = getClass().getResource(fileName);
        context.runScript( fUrl, output );
        //xmlWriter.close();
        output.flush();
        writer.write('\n');
        writer.flush();

    }

    public void serializeUsingSAXContentHandler(
		String fileName, 
		Writer writer) 
    throws IOException, JellyException, SAXException {
        org.dom4j.io.OutputFormat outputFormat = 
			new org.dom4j.io.OutputFormat();
        outputFormat.setSuppressDeclaration(true);
        outputFormat.setNewlines(true);
        outputFormat.setIndent(true);
        outputFormat.setIndentSize(4);

        XMLWriter xmlWriter = new XMLWriter(writer, outputFormat);
        xmlWriter.setEscapeText(false);

        SAXContentHandler saxHandler = new SAXContentHandler();
        XMLOutput output = new XMLOutput(saxHandler);

        // now run a script using a URL
        JellyContext context = new JellyContext();
        URL fUrl = getClass().getResource(fileName);

        output.startDocument();
        context.runScript(fUrl, output);
        output.endDocument();
        xmlWriter.write(saxHandler.getDocument());
        xmlWriter.flush();
    }

    public static void main(String[] args) {
        try {
            TestNs t = new TestNs();
            Writer someWriter = new OutputStreamWriter(System.out);

            System.out.println("------");
            t.serializeUsingSAXContentHandler("TestNs.jelly", someWriter);
            System.out.println("------");
            t.serializeUsingSimpleXMLOutput("TestNs.jelly", someWriter);
            System.out.println("------");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
#########
NOTES:
serializeUsingSAXContentHandler uses dom4j facilities
serializeUsingSimpleXMLOutput does not


SAMPLE OUTPUTS
##############

With PATCH 1 (http://issues.apache.org/jira/browse/JELLY-213, jelly-xml.patch).
As Paul said, imcomplete because of lack of use of startPrefixMapping/endPrefixMapping

### OUTPUT ###
------
<one>
    <two xmlns="http://apache/testNS" 
	   xmlns:test="http://apache/anotherNS" 
	   test:abc2="testValue">
        <three xmlns="">hi</three>
    </two>
</one>
------
<one>
    <two test:abc2="testValue">
        <three>hi</three>
    </two>
</one>
------
##############

With PATCH 2 (http://issues.apache.org/jira/browse/JELLY-213, jelly-xml-updated.patch).
startPrefixMapping/endPrefixMapping as possible, presenting better results.
Problem. XMLOutput doesn't have state, JellyPipeline doesn't allow to when "two" element is used, when know what was
the previous namespace to reset it's value as it's done in trunk 1 bellow for element "three"

### OUTPUT ###
------
<one>
    <two xmlns="http://apache/testNS" 
	   xmlns:test="http://apache/anotherNS" 
	   test:abc2="testValue">
        <three xmlns="">hi</three>
    </two>
</one>
------
<one>
    <two xmlns:test="http://apache/anotherNS" 
 	   xmlns="http://apache/testNS" 
	   test:abc2="testValue">
        <three>hi</three>
    </two>
</one>
------
##############

SAXContentHandler manage state of parsing so it's able handle well with the situation,
as seen in trunk 1 of above output.

Discussion:
Should we discard PATCH 2 and let the client XMLOutput responsible for this handling ?
If soo, for sake of XMLOutput factory methods coeherence, shall we modify
XMLOutput.createXMLOutput(Writer[,boolean]) and
XMLOutput.createXMLOutput(OutputStream[,boolean])
to follow the aproach given in "serializeUsingSAXContentHandler method in java sample" ?


> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315428 ] 

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

 <x:replaceNamespace toURI="${plugin.version.ns}" includeAttributes="true">
should be
 <x:replaceNamespace toURI="${plugin.version.ns}">
:)
At the beginning i though i should have that option :) now replaces all, nodes and their attributes.


> 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-patch3.patch, 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Paul Libbrecht (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315357 ] 

Paul Libbrecht commented on JELLY-213:
--------------------------------------

Now, we're starting go deep but it's quite good!

I've been reading several times your example class... until I realized the differences:

- in the first, your xmlOutput is one created on top of an dom4j XMLWriter
- in the second your xmlOutput is actually a parser which loads into a dom4j (default) tree and re-outputs it.

I don't think we should wish the usage of SAXContentHandler as for an outputter, it would be a catastrophe for memory!



> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/JELLY-213?page=all ]

Diogo Bacelar Quintela updated JELLY-213:
-----------------------------------------

    Attachment: jelly-xml.patch

<?xml version="1.0" encoding="UTF-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:jsl="jelly:jsl">
    <x:element URI="http://java.sun.com/xml/ns/j2ee" name="ejb-jar">
        <x:attribute URI="http://www.w3.org/2001/XMLSchema-instance" 
                     name="xsi:schemaLocation" trim="true">
            http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd
        </x:attribute>
        <x:attribute name="version" trim="true">
            1.2
        </x:attribute>
    </x:element>
</j:jelly>

Works as expected generating

<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" 
         version="1.2">
</ejb-jar>


> 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.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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/JELLY-213?page=all ]

Diogo Bacelar Quintela updated JELLY-213:
-----------------------------------------

    Attachment: jelly-patch4.patch

Fixed an error when generating 
the following sample.
<env:Envelope 
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

env:encodingStyle was comming with uri="", localName and qName="env:encodingStyle"

Fixed junit tests:
included xmlunit in junit testing in "xml" tag library.


> 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-patch3.patch, jelly-patch4.patch, 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315419 ] 

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

I am already working on it.
It would behave has using a saxcontenthandler :) i mean transparently.
Higher correctness, less complex for tags. Even Element tag would not need to implement 
org.apache.commons.jelly.NamespaceAwareTag.

> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315134 ] 

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

I guess this is related to 
http://issues.apache.org/jira/browse/JELLY-173



> 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

>
> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315133 ] 

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

I posted this into commons-user@jakarta.apache.org on 06/07/2005.
Paul Libbrecht, told me to fill a Jira Issue.


> 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

>
> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/JELLY-213?page=all ]

Diogo Bacelar Quintela updated JELLY-213:
-----------------------------------------

    Attachment: jelly-patch3.patch

Here is patch3 :)

AtributeTag and ElementTag are exactly the same as patch 1
XMLOutput now has a stack of namespaces, and manages the calls to startPrefixMapping and endPrefixMapping.
It passes common testcases and jelly-xml testcases (haven't tried the others :)

It now generates equivalent outputs in both cases (described in above java class TestNS) 
[equivalent means equivalent xml, not necessarly the same order of attributes].

I've included a new tag, that i mentionated some comments above.
A ReplaceNamespaceTag. As it name implies, it replaces all namespaces from one uri to another in its body (fromURI and toURI properties).
XMLOutput does it job perfectly, again :)


Ex:

<?xml version="1.0" encoding="UTF-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
    <x:element URI="${ns}" name="test-node">
        <x:attribute URI="http://apache/testNS" name="test:abc" trim="true">testValue</x:attribute>

        <test-subnode attr="test">
            <test-anotherSubNode />
            <x:element URI="${ns}" name="test-anotherSubNodeAgain">
                <x:attribute URI="${ns}" name="other:abc" trim="true">testValue</x:attribute>
            </x:element>
        </test-subnode>

        <x:replaceNamespace toURI="${ns}">
            <test-subnode attr="test">
                <test-anotherSubNode />
                <x:element URI="${ns}" name="test-anotherSubNodeAgain">
                    <x:attribute URI="${ns}" name="other:abc" trim="true">testValue</x:attribute>
                </x:element>
            </test-subnode>
        </x:replaceNamespace>
    </x:element>
</j:jelly>

Generates

When 'ns' is empty/inexistent

<test-node xmlns:test="http://apache/testNS" test:abc="testValue">
<test-subnode attr="test">
<test-anotherSubNode>
</test-anotherSubNode>
<test-anotherSubNodeAgain xmlns:other="" other:abc="testValue">
</test-anotherSubNodeAgain>
</test-subnode>
</test-node>

And when 'ns' if for example 'http://java/ns'

<test-node xmlns:test="http://apache/testNS" xmlns="http://java/ns" test:abc="testValue">
<test-subnode xmlns="" attr="test">
<test-anotherSubNode>
</test-anotherSubNode>
<test-anotherSubNodeAgain xmlns:other="http://java/ns" xmlns="http://java/ns" other:abc="testValue">
</test-anotherSubNodeAgain>
</test-subnode>
<test-subnode attr="test">
<test-anotherSubNode>
</test-anotherSubNode>
<test-anotherSubNodeAgain xmlns:other="http://java/ns" other:abc="testValue">
</test-anotherSubNodeAgain>
</test-subnode>
</test-node>

Usefull ? I'll demonstrate with my example.
I am working in ejb plugin for xdoclet-plugins project, 
the plugins for xdoclet2 project.

plugin.version.isDtd says true if we need an dtd, false, if we are using a schema.
If we are using a dtd, we don't need a namespace, if we are using a schema we need to use 'http://java.sun.com/xml/ns/j2ee' as
default namespace. So plugin.version.ns return null when is a dtd, and 'http://java.sun.com/xml/ns/j2ee' when its not.
With this 'replaceNamespace' tag we can use the default namespace in jelly script, 
(replacing "" for "" let's it exactly the same :D) for dtd output, and when plugin.version.ns
is http://java.sun.com/xml/ns/j2ee all nodes get automatically updated to that namespace.

It will be usefull for xdoclet-plugins, and maybe for other projects.


<?xml version="1.0" encoding="UTF-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:jsl="jelly:jsl">
    <j:if test="${plugin.version.isDtd()}">
        <x:doctype name="ejb-jar" publicId="${plugin.version.publicId}" systemId="${plugin.version.systemId}" trim="true" />
    </j:if>
    <x:element URI="${plugin.version.ns}" name="ejb-jar">
        <j:if test="${!plugin.version.isDtd()}">
            <x:attribute URI="${plugin.version.xsiNs}" name="xsi:schemaLocation" trim="true">${plugin.version.schemaLocation}</x:attribute>
            <x:attribute name="version" trim="true">${plugin.version.version}</x:attribute>
        </j:if>
        <x:replaceNamespace toURI="${plugin.version.ns}" includeAttributes="true">
            <enterprise-beans>
                <j:forEach var="class" items="${metadata}">
                    <j:if test="${plugin.shouldGenerate(class)}">
                        <entity>
                            <ejb-name>${plugin.ejbUtils.getEjbName(class)}</ejb-name>
                            ....
                        </entity>
                    </j:if>
                </j:forEach>
            </enterprise-beans>
        </x:replaceNamespace>

        <j:import uri="org/xdoclet/plugin/ejb/descriptor/entity-beans.jelly" inherit="true"/>
    </x:element>
    <!--</ejb-jar> -->
</j:jelly>

If this patch is usefull as a full (as i think it is), 
i'd be happy to known when it gets added to jelly project, and jelly-xml.

> 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-patch3.patch, 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/JELLY-213?page=all ]

Diogo Bacelar Quintela updated JELLY-213:
-----------------------------------------

    Attachment: jelly-xml-updated.patch

Patch superseeds already uploaded patch.
Fixed namespace processing using 
startPrefixMapping and endPrefixMapping as Paul Libbrecht sugested.
TestCase included.

> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Paul Libbrecht (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315413 ] 

Paul Libbrecht commented on JELLY-213:
--------------------------------------

> I also believe that the solution should be maintaining a stack 
> of declared namespaces as SAXContentHandler does, 
> managed in XMLOutput, in startPrefixMapping/endPrefixMapping and 
> startElement (maybe endElement also..). 

So... how would that look like ?
Should an xmlOutput be readable for namespace-context letting the care to each xmlOutput to call appropriately startPrefixMapping ? (and leave wrong the ones that don't do these calls)

Or should it act transparently ?
(with, maybe, some loss of control but a higher guarantee for correctness)

paul

> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Paul Libbrecht (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315358 ] 

Paul Libbrecht commented on JELLY-213:
--------------------------------------

A quick trick into these troubles (which are quite hard, I fear, at least in the current pure SAX approach) would to force that anything that is not in the blank namespace has a prefix by a simple check.

This prefix could even be generated (oh ugly!).

Otherwise, there's no other way than have a stack of declared namespaces and namespace prefixes along with the XML-output, I fear...

In the meantime, the attribute namespace issue should be easy to fix with your patch.

> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

Posted by "Diogo Bacelar Quintela (JIRA)" <co...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/JELLY-213?page=comments#action_12315396 ] 

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

I also believe that the solution should be maintaining a stack of declared namespaces as SAXContentHandler does,
managed in XMLOutput, in startPrefixMapping/endPrefixMapping and startElement (maybe endElement also..).
If this aproach is taken, we could be using only patch 1 (discarding patch 2)...

Forcing generation of a prefix seems very ugly..

> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org