Hi Ulf,

 

Thanks for your reply! J

 

I'm just sending in the xml as a string, maybe this is the problem. I've found the documentation a bit scarce, so wasn't sure what the string argument of the parse method should be; I assumed it would just be the xml but maybe this is not right. I'll try some of the other parse methods.

 

Caroline

 


From: Ulf Ullby [mailto:[EMAIL PROTECTED]
Sent: 18 July 2005 12:27
To: [email protected]
Subject: Re: Parsing xml

 


Hi Carolin,
I'm new here too, but I'll tell you what little I know (this is for XMLBeans 2.0.0). I allways use the Doc.Factory.parse method with a XML-file (see example below) but I guess it should work the same with a XML object or stream.

... some imports ...
public class xpathtester {
    private static String pathToAltoFile = "ALTO/ALTO00001.xml";

    public xpathtester() {
    }

    public static void main(String[] args) {
        xpathtester myXpathtester = new xpathtester();

        try {
            AltoDocument myAltoDoc = AltoDocument.Factory.parse(new File(pathToAltoFile));

            AltoDocument.Alto myAlto = myAltoDoc.getAlto();

            String myXmlPath = "$this//[EMAIL PROTECTED]'P1_TL00006']";
            System.out.println(myAltoDoc.selectPath(myXmlPath)[0].xmlText());

        } catch (Exception e) {
        }
    }
}

Just saw Areks name-space post, but I'll post anyway - it might help.

Best regards,
:) Ulf




Caroline Wood <[EMAIL PROTECTED]>

18-07-2005 12:46

Please respond to
[email protected]

To

"'[email protected]'" <[email protected]>

cc

 

Subject

Parsing xml

 

 

 




Hi,
 
I'm new to this so forgive me if this is a daft question...
There is a test schema, very basic, it just contains two fields test1 and test2.
There is a String of xml:
---
<?xml version = "1.0" encoding = "UTF-8"?><Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Test"  test2="test 2" test1="test 1"></Test>
---
 
I want to unmarshall this to the relevant xmlbean.
---
testDocument = TestDocument.Factory.parse( xml );
---
 
However the code does not get past the above line, but no error is thrown.
 
Any ideas what is going wrong?
 
Thanks!
 
 


This is an email from the CPP Group Plc, Holgate Park, York, YO26 4GA; telephone 01904 544500.
This message may contain information that is confidential. If you are not the intended recipient,
you may not peruse, use, disseminate, distribute or copy this message. If you have received this
message in error, please notify the sender immediately by email, facsimile or telephone and either
return or destroy the original message.
The CPP Group Plc accepts no responsibility for any changes made to this message after it has been
sent by the original author. This email has been scanned for all viruses by the MessageLabs Email Security System.

 


This is an email from the CPP Group Plc, Holgate Park, York, YO26 4GA; telephone 01904 544500.
This message may contain information that is confidential. If you are not the intended recipient,
you may not peruse, use, disseminate, distribute or copy this message. If you have received this
message in error, please notify the sender immediately by email, facsimile or telephone and either
return or destroy the original message.
The CPP Group Plc accepts no responsibility for any changes made to this message after it has been
sent by the original author. This email has been scanned for all viruses by the MessageLabs Email Security System.

Reply via email to