Generate xml and to existing xml

Generate xml and to existing xml

Post by mike » Sat, 14 Mar 2009 01:47:32


Hi,

We have the following xml that needs to be generated for 200 users.



<wopi:createUser>
<typ:WOUser>
<typ:id>
<typ:serviceProviderId>AOne</typ:serviceProviderId>
<typ:companyId>Acme</typ:companyId>
<typ:userId>Alice</typ:userId>
</typ:id>
<typ:sipAddress>sip: XXXX@XXXXX.COM </typ:sipAddress>
<typ:firstName>Alice</typ:firstName>
<typ:lastName>Wonderland</typ:lastName>
</typ:WOUser>
</wopi:createUser>

ServiceProviderId and companyId will be the same but I need to
generate a user like:

user001
user002
user003

and so on...

So I will generate a <wopi:createUser>-Node for each user. Then I have
to add this into the existing xml document where we create the
serviceProvider and company.

I am using java 1.5 and I wonder if you have any advice to me in this
matter on how to implement it.

cheers,

//mike
 
 
 

1. ASP XML Support - Generate XML string from FORM DATA based on XML schema

2. Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser)

Hello Usenet.

I'm subject to some confusion with XML and UTF8. I'm working with
XML-Simple and I try to decode some XML with with german umlauts
(ISO-8859-1). The first XML line declared the encoding correct (see code
below). But I'm getting different results using XML-Simple with the
default XML parser named XML::Sax and a second parser named XML::Parser.
The following code tries to decode the mini XML file and prints the UTF8
flags of the resulting strings.

Can someone run this code on his machine and post the results? Thanks.
The results on my machine are this:

(0) cmp ?(0) = -1
?(1) cmp ?(0) = 0

The first line was parsed by XML::Sax and the second line was parsed by
XML::Parser. My conclusions:

1) Line 1 is wrong, line 2 is correct
2) The output should be line 2 two times.
3) There is a bug in XML::Sax

Your opinion?

The code (written in ISO-8859-1 on disc):

#!/usr/bin/perl -w

use strict;
use warnings;

use XML::Simple;
use Encode;

foreach (1..2)
{
my $q1 = XMLin("<?xml version='1.0' encoding='iso-8859-1'?>\n<a>?/a>");
my $q2 = "?;

printf "%s (%d) cmp %s (%d) = %d\n"
, $q1, Encode::is_utf8($q1)
, $q2, Encode::is_utf8($q2)
, $q1 cmp $q2;
# and again with the non default parser
$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
}

PS: I'm using perl v5.8.7, XML-SAX-0.13, XML-Parser-2.34 and
expat-1.95.8.

--
So long... Fuzz

3. generate xml from sample xml

4. remove ?xml from generated xml serialization

5. Generating an XML file from an XML schema

6. !Help..... Generating xml from xml schema

7. How to generate xml using a xml schema in java?

8. problem in binding xml file data to datagrid xml file is generated through JSP file

9. Generate XML files from C# class (XML serialization)

10. XML error in ElementType, attribute tag in generated XML spreadsheet

11. XML ERROR in PivotTable on generated XML spreadsheet

12. Rendering word reports using XML and XSL to generate Word XML

13. Generate XML File From XML File Using XSLT

14. ADO.NET and XML Schemas: Generating the XML using the DataSet

15. Generate XML string from FORM DATA based on XML schema