Hi everyone,

I have a problem with arrays. I get an XML document from a program that
I cant change (Xcelsius). It looks like this

<data>
   <variable name="INFO_PROVIDER">
      <row>
         <column>IP1</column>
      </row>
   </variable>
   <variable name="VIEW_ID">
      <row>
         <column>null</column>
      </row>
  </variable>
</data>


I created my own XSD to describe this document, in the XSD I have 
to use namespaces because data is already defined in the XSD namespace.
The XSD is shown here:


<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema";
        elementFormDefault="unqualified" 
targetNamespace="http://cirquent.de/XcelsiusTable";
        xmlns:tns="http://cirquent.de/XcelsiusTable";>

        <complexType name="row">
                <sequence maxOccurs="unbounded" minOccurs="0">
                        <element name="column" type="string"></element>
                </sequence>
        </complexType>
        <complexType name="variable">
                <sequence maxOccurs="unbounded" minOccurs="0">
                        <element name="row" type="tns:row"></element>
                </sequence>
                <attribute name="name" type="string" />
        </complexType>


        <element name="data" type="tns:data"></element>

        <complexType name="data">
                <sequence minOccurs="0" maxOccurs="unbounded">
                        <element name="variable" type="tns:variable"></element>
                </sequence>
        </complexType>
</schema>

In order to handle the document, I have to replace the
namespace using the substitution capabilities of XML Beans with
the following code:

        namespaceMap.put("", "http://cirquent.de/XcelsiusTable";);
        xmlOptions.setLoadSubstituteNamespaces(namespaceMap);

The document is parsed and if I call the save() method, the following
string is written:
<xcel:data xmlns:xcel="http://cirquent.de/XcelsiusTable";><xcel:variable 
name="INFO_PROVIDER"><xcel:row><xcel:column>IP1</xcel:column></xcel:row></xcel:variable><xcel:variable
 
name="VIEW_ID"><xcel:row><xcel:column>null</xcel:column></xcel:row></xcel:variable</xcel:data>


Here comes the problem: Calling getVariableArray() on the data element,
I get an empty array as response.

What am I doing wrong?

Best regards,

Stefan Schuster

Consultant NW FI


cirquent | softlab group

Cirquent GmbH

Königsberger Straße 29 | 60487 Frankfurt a.M.

Telefon +49 69 97261-800 | Fax +49 69 97261-899
E-Mail [EMAIL PROTECTED] | Mobil +49 151 1822 5456
Internet http://www.cirquent.de

Cirquent GmbH | Geschäftsführung: Peter Broicher (Vorsitzender), Dr. Stefan 
Aicher,
Thomas Balgheim (stellvertretender Vorsitzender), Bernd Stroppel, Said Tabet
Sitz und Amtsgericht: München HRB 51846

 


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

Reply via email to