RE: SV: xml-fragment containing well formed XML Documents

2006-05-06 Thread Cezar Andrei
In my example the namespaces seem to work:

XmlObject xo = XmlObject.Factory.parse(r:a
xmlns:r='a_uri'r:bsome text/r:b/r:a);

XmlCursor xc = xo.newCursor();
xc.toFirstChild();


XmlObject aContent = xc.getObject();

System.out.println(aContent:  + aContent);

XmlOptions xmlOpts = new
XmlOptions().setSaveSyntheticDocumentElement(new QName(uri, local,
prefix));
System.out.println(aContent saveSyntheticDocElem:  +
aContent.xmlText(xmlOpts));

Cezar

 -Original Message-
 From: jadiyo [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 02, 2006 12:09 PM
 To: user@xmlbeans.apache.org
 Subject: RE: SV: xml-fragment containing well formed XML Documents
 
 
 Thanks Cezar.
 I tried this and it worked.
 The only problem I found is that the xmlns attribute is lost.  So,
 instead
 of seeing
 AppHdr xmlns=urn:swift:xsd:$ahV10 I only see urn:AppHdr
 
 Any ideas?
 
 Thanks again
 
 Nirmal
 
 --
 View this message in context:
http://www.nabble.com/%3Cxml-fragment%3E-
 containing-well-formed-XML-Documents-t1480526.html#a4185490
 Sent from the Xml Beans - User forum at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

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



RE: SV: xml-fragment containing well formed XML Documents

2006-05-02 Thread jadiyo

Thanks Cezar.
I tried this and it worked.
The only problem I found is that the xmlns attribute is lost.  So,  instead
of seeing
AppHdr xmlns=urn:swift:xsd:$ahV10 I only see urn:AppHdr 

Any ideas?

Thanks again

Nirmal

--
View this message in context: 
http://www.nabble.com/%3Cxml-fragment%3E-containing-well-formed-XML-Documents-t1480526.html#a4185490
Sent from the Xml Beans - User forum at Nabble.com.


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



Re: SV: xml-fragment containing well formed XML Documents

2006-04-28 Thread jadiyo

Hi again,

What approach would be best to create this particular part of the document.
As mentioned before, the element will contain any number of well formed
documents.
In my case, I have 2 documents to add to the MessageText.These documents
are created independently.  Any attempt to add the 2 documents to the
MessageText, results in them being wrapped in a CDATA.  Ideally, what I
would like is something like this.

MessageText
  ah:AppHdr xmlns:ah=urn:swift:xsd:$ahV10
ah:From
  ah:Typeei Type From/ah:Type
  ah:Idei ID From/ah:Id
/ah:From
  /ah:AppHdr
  Doc:Document xmlns:Doc=urn:swift:xsd:swift.if.ia$setr.010.001.02
Doc:MstrRefthe Master Reference/Doc:MstrRef
  /Doc:Document
/MessageText


Again, many thanks in advance.

Nirmal

--
View this message in context: 
http://www.nabble.com/%3Cxml-fragment%3E-containing-well-formed-XML-Documents-t1480526.html#a4136239
Sent from the Xml Beans - User forum at Nabble.com.


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



RE: SV: xml-fragment containing well formed XML Documents

2006-04-28 Thread Cezar Andrei
This is a case where you have to use the XmlCursor API to copy/move the
two documents into the right place.

Cezar

 -Original Message-
 From: jadiyo [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 28, 2006 3:34 AM
 To: user@xmlbeans.apache.org
 Subject: Re: SV: xml-fragment containing well formed XML Documents
 
 
 Hi again,
 
 What approach would be best to create this particular part of the
 document.
 As mentioned before, the element will contain any number of well
formed
 documents.
 In my case, I have 2 documents to add to the MessageText.These
 documents
 are created independently.  Any attempt to add the 2 documents to the
 MessageText, results in them being wrapped in a CDATA.  Ideally, what
I
 would like is something like this.
 
 MessageText
   ah:AppHdr xmlns:ah=urn:swift:xsd:$ahV10
 ah:From
   ah:Typeei Type From/ah:Type
   ah:Idei ID From/ah:Id
 /ah:From
   /ah:AppHdr
   Doc:Document xmlns:Doc=urn:swift:xsd:swift.if.ia$setr.010.001.02
 Doc:MstrRefthe Master Reference/Doc:MstrRef
   /Doc:Document
 /MessageText
 
 
 Again, many thanks in advance.
 
 Nirmal
 
 --
 View this message in context:
http://www.nabble.com/%3Cxml-fragment%3E-
 containing-well-formed-XML-Documents-t1480526.html#a4136239
 Sent from the Xml Beans - User forum at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

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



SV: xml-fragment containing well formed XML Documents

2006-04-20 Thread Mikael.Lowgren
Hi Nirmal.
 
What happends if you just get the first child from the domnode?
 
Node node = messagetext.getDomNode().getFirstChild();
AppHdr ah = AppHdr.Factory.parse( node );
 
node = messagetext.getDomNode().getLastChild();
Document doc = Document.Factory.parse( node );
 
or with cursor:
 
  XmlCursor cur = messagetext.newCursor();
  cur.toChild( 0 );
  AppHdr ah = AppHdr.Factory.parse( cur.getDomNode() );
  
  cur.toNextSibling();

  Document doc = Document.Factory.parse( cur.getDomNode() );
  

 
Regards
 
/Mikael



Från: jadiyo [mailto:[EMAIL PROTECTED]
Skickat: to 2006-04-20 15:31
Till: user@xmlbeans.apache.org
Ämne: xml-fragment containing well formed XML Documents




Hi,

I seem to be having a problem that a lot of people are experiencing!
I am working with a 3rd party schema which has the following type
definition:

.
.
xs:complexType name=Text mixed=true
xs:complexContent
xs:extension base=xs:anyType
xs:sequence /
/xs:extension
/xs:complexContent
/xs:complexType

xs:element name=MessageText type=Text /

.

.


The MessageText element is defined to hold anyType.  In my case, it actually
holds at
least 2 (well formed/complete) XML documents.

The XML shown below is a snippet of the overall XML reveived.


MessageText
  ah:AppHdr xmlns:ah=urn:swift:xsd:$ahV10
ah:MsgRefthe message ref/ah:MsgRef
ah:CrDate2006-04-18T16:04:55.739+01:00/ah:CrDate
  /ah:AppHdr
  Doc:Document xmlns:Doc=urn:swift:xsd:swift.ia$setr.010.001.02
Doc:setr.010.001.02
  Doc:MsgNmsetr.010.001.02/Doc:MsgNm
/Doc:setr.010.001.02
  /Doc:Document
/MessageText


AppHdr is a complete XML document in its own right, as is
Document.

When I use XMLBeans to get to the MessageText content, it gets wrapped
in an xml-fragment as shown below.


xml-fragment xmlns:urn=urn:swift:xsd:saa.mxs.01
  ah:AppHdr xmlns:ah=urn:swift:xsd:$ahV10
ah:MsgRefthe message ref/ah:MsgRef
ah:CrDate2006-04-18T16:04:55.739+01:00/ah:CrDate
  /ah:AppHdr
  Doc:Document xmlns:Doc=urn:swift:xsd:swift.ia$setr.010.001.02
Doc:setr.010.001.02
  Doc:MsgNmsetr.010.001.02/Doc:MsgNm
/Doc:setr.010.001.02
  /Doc:Document
/xml-fragment



I need to extract AppHdr and Document individually so they they themsleves
can be
parsed with XMLBeans.



I'd appreciate any help at all.



Many Thanks



Nirmal


--
View this message in context: 
http://www.nabble.com/%3Cxml-fragment%3E-containing-well-formed-XML-Documents-t1480526.html#a4007281
Sent from the Xml Beans - User forum at Nabble.com.


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



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

Re: SV: xml-fragment containing well formed XML Documents

2006-04-20 Thread jadiyo

You are a genius!

The first approach didn't work for some reason, but using XmlCursor worked a
treat.

Thanks for the quick (and working) response.
FYI, the first approach approach returned xml-fragment/xml-fragment when
I sent to stdout

Nirmal



--
View this message in context: 
http://www.nabble.com/%3Cxml-fragment%3E-containing-well-formed-XML-Documents-t1480526.html#a4010624
Sent from the Xml Beans - User forum at Nabble.com.


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