[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    RE: [jira] Commented: (XMLBEANS-245) Make use of the EntityResolver set in XmlOptions throughout the
From:       <Ramesh.Chitturi () wellsfargo ! com>
Date:       2006-02-09 16:42:10
Message-ID: 557CC0164B4B154C9E6566D4024A6F47F6C304 () msgswbiadsm35 ! wellsfargo ! com
[Download RAW message or body]

Hi 
               
   Thank you so much for your help I have one more issue
  when I am doing the marshalling the request string I am getting with
namespaces and servies don't like the name spaces because they are using
XMLBooster for parsing and on the flip they are sending me the response
with no namespaces but xmlBeans will need namespaces to parse right.So
right now what I am doing is string operation to format the string in
both ways I know this is not the right way to do.

   Do you have any idea how to do this using xmlOptions or any thing
like that.Below I gave example 

Request String:-

 <purchase-order xmlns="http://openuri.org/easypo">
    <easypo:customer>
        <name>Gladys Kravitz</name>
        <address>Anytown, PA</address>
    </easypo:customer>
    <easypo:date>2003-01-07T14:16:00-05:00</easypo:date>
    <easypo:line-item>
        <description>Burnham's Celestial Handbook, Vol 1</description>
        <per-unit-ounces>5</per-unit-ounces>
        <price>21.79</price>
        <quantity>2</quantity>
    </easypo:line-item>
    <easypo:shipper>
        <name>ZipShip</name>
        <per-ounce-rate>0.74</per-ounce-rate>
    </easypo:shipper>
</purchase-order>

       Should be like this format for Service to  accept

<purchase-order>
   <customer>
       <name>Gladys Kravitz</name>
       <address>Anytown, PA</address>
   </customer>
   <date>2003-01-07T14:16:00-05:00</date>
   <line-item>
       <description>Burnham's Celestial Handbook, Vol 1</description>
       <per-unit-ounces>5</per-unit-ounces>
       <price>21.79</price>
       <quantity>2</quantity>
   </line-item>
   <shipper>
       <name>ZipShip</name>
       <per-ounce-rate>0.74</per-ounce-rate>
   </shipper>
</purchase-order>


Response String returned from Service:-

<purchase-order>
   <customer>
       <name>Gladys Kravitz</name>
       <address>Anytown, PA</address>
   </customer>
   <date>2003-01-07T14:16:00-05:00</date>
   <line-item>
       <description>Burnham's Celestial Handbook, Vol 1</description>
       <per-unit-ounces>5</per-unit-ounces>
       <price>21.79</price>
       <quantity>2</quantity>
   </line-item>
   <shipper>
       <name>ZipShip</name>
       <per-ounce-rate>0.74</per-ounce-rate>
   </shipper>
</purchase-order>


But XMLBeans Like This Format

<purchase-order xmlns="http://openuri.org/easypo">
    <easypo:customer>
        <name>Gladys Kravitz</name>
        <address>Anytown, PA</address>
    </easypo:customer>
    <easypo:date>2003-01-07T14:16:00-05:00</easypo:date>
    <easypo:line-item>
        <description>Burnham's Celestial Handbook, Vol 1</description>
        <per-unit-ounces>5</per-unit-ounces>
        <price>21.79</price>
        <quantity>2</quantity>
    </easypo:line-item>
    <easypo:shipper>
        <name>ZipShip</name>
        <per-ounce-rate>0.74</per-ounce-rate>
    </easypo:shipper>
</purchase-order>


Thanks
Ramesh.


-----Original Message-----
From: Jimisola Laursen (JIRA) [mailto:xmlbeans-dev@xml.apache.org] 
Sent: Thursday, February 09, 2006 8:20 AM
To: xmlbeans-dev@xml.apache.org
Subject: [jira] Commented: (XMLBEANS-245) Make use of the EntityResolver
set in XmlOptions throughout the whole library

    [
http://issues.apache.org/jira/browse/XMLBEANS-245?page=comments#action_1
2365739 ] 

Jimisola Laursen commented on XMLBEANS-245:
-------------------------------------------

Manage to work around the problem using Xerces-J and
XmlOptions.setLoadUseXMLReader(...);

// SAXParser Xerces-J
SAXParser parser = new SAXParser();
XMLReader reader = parser;
		
parser.setFeature("http://xml.org/sax/features/validation", true);
parser.setFeature("http://apache.org/xml/features/validation/schema",
true);
parser.setFeature("http://apache.org/xml/features/validation/schema-full
-checking", true); 

reader.setEntityResolver(new MyClassPathEntityResolver());

XmlOptions xmlOpts = new XmlOptions();

xmlOpts.setLoadUseDefaultResolver();
xmlOpts.setLoadUseXMLReader(reader);

// parse() does not use setEntityResolver (yet)
//xmlOpts.setEntityResolver(new MyEntityResolver()); 

xmlObject = XmlObject.Factory.parse(in, xmlOpts);

> Make use of the EntityResolver set in XmlOptions throughout the whole 
> library
> ----------------------------------------------------------------------
> -------
>
>          Key: XMLBEANS-245
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-245
>      Project: XMLBeans
>         Type: Improvement
>     Versions: Version 2.1
>     Reporter: Jimisola Laursen
>      Fix For: Version 2.1

>
> Appearently, XmlObject.Factory.parse(... XmlOptions) method to use the
value set by XmlOptions.setEntityResolver in order to replace the
default EntityResolver used
(http://xmlbeans.apache.org/docs/2.0.0/reference/org/apache/xmlbeans/Xml
Options.html#setEntityResolver(org.xml.sax.EntityResolver)):
> "If this option is set when compiling a schema, then the given
EntityResolver will be consulted in order to resolve any URIs while
downloading imported schemas. EntityResolvers are currently only used by
compileXsd; they are not consulted by other functions, for example,
parse. This will likely change in the future."
> I am in need of this change to replace the EntitiyResolver used with
one that uses getClass().getResourceAsStream() to load the schema from
class path.
> Hopefully, it should be too much work :) IoC also helps out when doing
JUnit tests etc.
> There might be a temporary work around using
XmlOptions.setLoadUseXMLReader and the default JDK's SAX parser. I'll
get back on that one.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic