Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2008

Tip: Looking for answers? Try searching our database.

parsing an inner Xml inside XML

Thread view: 
kris - 05 Jan 2008 15:07 GMT
hi,

              I have a requirement to parse an XML which contains
another xml as a string content. I am able to parse the parent xml.
when I am parsing the second xml I am getting the following exception.
I have used CDATA to mark the string. And I have given the prolog
inside the inner xml which under one tag in the parent XML. I tried
without prolog also.

RdCanL::parseCanonical::XML EXCEPTION
org.apache.xmlbeans.XmlException: error: XML declaration is not well-
formed
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:
3467)
    at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:706)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:
690)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:
677)
    at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:
208)
    at com.abc.fusion.rd.xmlbeans.ltm.LTCanDocument$Factory.parse(Unknown
Source)
    at com.abc.fusion.rd.integration.RdCanL.parseCanonical(RdCanL.java:
124)
    at
com.abc.fusion.rd.integration.RdCanBase.processCanonical(RdCanonicalBase.java:
287)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:
287)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
181)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
148)
    at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:
96)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
170)
    at
org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:
97)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
170)
    at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:
176)
    at $Proxy47.processCanonical(Unknown Source)
Arne Vajhøj - 05 Jan 2008 15:15 GMT
>                I have a requirement to parse an XML which contains
> another xml as a string content. I am able to parse the parent xml.
> when I am parsing the second xml I am getting the following exception.
> I have used CDATA to mark the string. And I have given the prolog
> inside the inner xml which under one tag in the parent XML. I tried
> without prolog also.

If you extract the inner XML and it is valud XML you can parse it.

Based on what you write it is impossible to say what goes wrong.

Arne
Alexander.V.Kasatkin@gmail.com - 05 Jan 2008 18:09 GMT
> hi,
>
[quoted text clipped - 18 lines]
> org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoader-Base.java:
> 208)

If you use XML Beans to parse inner xml string, you should wrap
this xml string with <xml-fragment>...</xml-fragment> tags.
raja.vikram@gmail.com - 10 Jan 2008 09:24 GMT
On Jan 5, 11:09 pm, Alexander.V.Kasat...@gmail.com wrote:

> > hi,
>
[quoted text clipped - 23 lines]
>
> - Show quoted text -

Hi
I tried with the <xml-fragment> tags too. Still it gives the same
exception.
Please find the XMLs below.

<?xml version="1.0" encoding="UTF-8"?>
<Integration>
    <IntegrationHeader>
        <SENDER>9812</SENDER>
        <RECEIVER>9813</RECEIVER>
    </IntegrationHeader>
    <Content>
          <xml-fragment>
          <![CDATA[<?xml version="1.0" encoding="UTF-8"?>
              <Canonical xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance">
                  <DOCUMENT_TYPE>Load</DOCUMENT_TYPE>
              </Canonical>]]>
          </xml-fragment>
    </Content>
</Integration>

I need to parse the XML injside <Content> tag. I tried with and
without having <xml-fragment> and CDATA. Still I am not able to parse
the inner XML using xml beans.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.