skjolber / xswi

The simple, standalone XML Stream Writer for iOS
30 stars 5 forks source link

Namespace not printed out in second start tag with namespace. #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write and print XML with the following commands:

[writer setPrefix:@"wsse" namespaceURI:NAMESPACE_WS_SECURITY];
  [writer writeStartElementWithNamespace:NAMESPACE_WS_SECURITY localName:@"Security"];
  [writer writeAttribute:@"mustUnderstand" value:@"1"];
  [writer writeStartElementWithNamespace:NAMESPACE_WS_SECURITY localName:@"UsernameToken"];
  [writer writeStartElementWithNamespace:NAMESPACE_WS_SECURITY localName:@"Username"];
  [writer writeCharacters:USER_NAME];
  [writer writeEndElement];
  [writer writeStartElementWithNamespace:NAMESPACE_WS_SECURITY localName:@"Password"];
  [writer writeCharacters:PASSWORD];
  [writer writeEndElement];
  [writer writeEndElement];
  [writer writeEndElement];
  [writer setPrefix:@"ns2" namespaceURI:NAMESPACE_COMMON_COMPLEX_ELEMENTS];
  [writer writeStartElementWithNamespace:NAMESPACE_COMMON_COMPLEX_ELEMENTS localName:@"ClientInformation"];
  [writer writeStartElementWithNamespace:NAMESPACE_COMMON_COMPLEX_ELEMENTS localName:@"SalesUnitKey"];
  [writer writeCharacters:SALES_UNIT_KEY_ACCEPTANCE_TEST];
  [writer writeEndElement];
  [writer writeStartElementWithNamespace:NAMESPACE_COMMON_COMPLEX_ELEMENTS localName:@"ApplicationName"];
  [writer writeCharacters:@""];
  [writer writeEndElement];
  [writer writeEndElement];

NSLog(@"%@", [writer toString]);

What is the expected output? What do you see instead?

The expected output is to get the ns2 namespace uri printed out on the form 
xmlns:ns2="<ns2_namespace_uri>" inside the <ns2:ClientInformation> tag in the 
same way as for the wsse:Security tag. Instead the output looks like this:

<wsse:Security mustUnderstand="1" 
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-s
ecext-1.0.xsd">
    <wsse:UsernameToken>
        <wsse:Username>xxxxx</wsse:Username>
        <wsse:Password>yyyyy</wsse:Password>
    </wsse:UsernameToken>
</wsse:Security>
<ns2:ClientInformation>  // Missing xmlns:ns2="..." here
    <ns2:SalesUnitKey>zzzzzz</ns2:SalesUnitKey>
    <ns2:ApplicationName></ns2:ApplicationName>
</ns2:ClientInformation>

What version of the product are you using? On what operating system?

Version 1.01. Mac OS operating system.

Original issue reported on code.google.com by henrik.l...@gmail.com on 21 Dec 2010 at 10:38

GoogleCodeExporter commented 9 years ago
Thanks for the report, it has now been fixed for 1.02.

Original comment by skjol...@gmail.com on 25 Dec 2010 at 5:22